/* 4Masters Portal */
:root {
  color-scheme: light;
  --navy: #14213d;
  --navy-2: #1c2c50;
  --navy-3: #2a3d6b;
  --lime: #c9d92b;
  --lime-soft: #f4f8d2;
  --blue: #1e8fd0;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --faint: #98a2b3;
  --line: #e4e7ec;
  --line-2: #f2f4f7;
  --bg: #f5f7fa;
  --card: #ffffff;
  --primary: #1c2c50;
  --primary-hover: #14213d;
  --focus: #1e8fd0;

  --good: #067647;
  --good-bg: #e7f6ec;
  --good-dot: #0ca30c;
  --warning: #93370d;
  --warning-bg: #fef3d7;
  --warning-dot: #fab219;
  --critical: #b42318;
  --critical-bg: #fdecec;
  --critical-dot: #d03b3b;
  --info: #175cd3;
  --info-bg: #eaf2fe;
  --neutral: #475467;
  --neutral-bg: #eef1f5;

  --series-1: #2a78d6;
  --series-2: #eb6834;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, .25);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --sidebar-w: 256px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); }
img { max-width: 100%; display: block; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
code, .mono { font-family: var(--mono); font-size: .92em; }

.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico.inline { width: 14px; height: 14px; vertical-align: -2px; margin-right: 3px; }

/* utilities */
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.strong { font-weight: 600; }
.block { display: block; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.prewrap { white-space: pre-wrap; word-break: break-word; }
.danger-text { color: var(--critical); }
.spacer { flex: 1; }
.stack { display: grid; gap: 16px; }
.stack-sm { display: grid; gap: 8px; }
.link { background: none; border: 0; padding: 0; color: var(--info); cursor: pointer; text-align: left; }
.link:hover { text-decoration: underline; }

/* boot */
.boot { min-height: 100vh; display: grid; place-items: center; opacity: .5; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 7px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
  font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--line-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--critical); border-color: var(--critical); color: #fff; }
.btn-danger:hover { background: #912018; }
.btn-good { background: var(--good); border-color: var(--good); color: #fff; }
.btn-good:hover { background: #055a36; }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: 12.5px; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--line-2); color: var(--ink); text-decoration: none; }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.sm .ico { width: 16px; height: 16px; }
.icon-btn.on-dark { color: #c3cbe0; }
.icon-btn.on-dark:hover { background: rgba(255, 255, 255, .08); color: #fff; }

/* ---------- auth ---------- */
.auth-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 10% -10%, #26396a 0, transparent 60%), linear-gradient(160deg, var(--navy) 0%, #0d1629 100%);
}
.auth-card { width: 100%; max-width: 420px; background: var(--card); border-radius: 16px; padding: 28px; box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
.auth-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 6px; background: repeating-linear-gradient(-45deg, var(--lime) 0 10px, transparent 10px 18px); }
.auth-top { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 22px; }
.auth-card h1 { font-size: 22px; }
.auth-card > .muted { margin: 4px 0 20px; }
.auth-form { display: grid; gap: 14px; }
.auth-note { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); text-align: center; }
.auth-login-hint { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--lime-soft); color: var(--ink-2); }

.lang-switch { display: inline-flex; border-radius: 999px; background: rgba(255, 255, 255, .08); padding: 2px; }
.lang-switch button { border: 0; background: none; color: #c3cbe0; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; cursor: pointer; }
.lang-switch button.active { background: var(--lime); color: var(--navy); }
.lang-switch.light { background: var(--line-2); }
.lang-switch.light button { color: var(--muted); }

/* ---------- layout ---------- */
.layout { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  display: flex; flex-direction: column; background: var(--navy); color: #dfe5f2;
}
.brand { display: flex; align-items: flex-end; gap: 10px; padding: 20px 20px 16px; text-decoration: none; position: relative; }
.brand:hover { text-decoration: none; }
.brand::after { content: ""; position: absolute; left: 20px; right: 20px; bottom: 0; height: 4px; background: repeating-linear-gradient(-45deg, var(--lime) 0 6px, transparent 6px 11px); opacity: .9; }
.brand-sub { color: var(--lime); font-weight: 700; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; padding-bottom: 6px; }
.nav { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius-sm);
  color: #c3cbe0; font-weight: 500; text-decoration: none; position: relative;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--navy-3); color: #fff; }
.nav-item.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--lime); }
.nav-item .ico { width: 19px; height: 19px; }
.nav-label { flex: 1; }
.nav-sep { margin: 16px 12px 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #7d8bab; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--lime); color: var(--navy); font-size: 11.5px; font-weight: 800; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, .08); padding: 12px; display: grid; gap: 8px; }
.me-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); color: #fff; text-decoration: none; }
.me-card:hover, .me-card.active { background: rgba(255, 255, 255, .06); text-decoration: none; }
.me-text { display: grid; min-width: 0; }
.me-text strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { color: #9aa6c2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-tools { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }

.content { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: none; }
.scrim { display: none; }
.main { flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; padding: 28px 32px 48px; }
.main.main-flush { max-width: none; padding: 0; }

@media (max-width: 899px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .layout.nav-open .sidebar { transform: none; }
  .layout.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(16, 24, 40, .45); z-index: 30; }
  .content { margin-left: 0; }
  .topbar {
    display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 20;
    height: 56px; padding: 0 12px; background: var(--card); border-bottom: 1px solid var(--line);
  }
  .topbar-brand { flex: 1; display: flex; }
  .topbar-chat { position: relative; display: grid; place-items: center; width: 40px; height: 40px; color: var(--ink-2); }
  .topbar-chat .badge { position: absolute; top: 2px; right: 0; }
  .main { padding: 20px 16px 40px; }
  .hide-sm { display: none; }
}

/* ---------- page ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 20px; }
.page-titles h1 { font-size: 24px; letter-spacing: -.01em; }
.page-sub { margin: 4px 0 0; color: var(--muted); }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 10px; color: var(--muted); font-weight: 500; }
.back-link .ico { width: 16px; height: 16px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.search-wrap { position: relative; display: flex; align-items: center; min-width: 0; flex: 0 1 300px; }
.search-wrap .ico { position: absolute; left: 10px; color: var(--faint); pointer-events: none; }
.search-wrap .input { padding-left: 34px; width: 100%; }
.date-range { display: inline-flex; align-items: center; gap: 6px; }
.date-range .input { width: auto; }

.seg { display: inline-flex; background: var(--line-2); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; border-radius: 6px; padding: 5px 8px; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.seg-text button { padding: 5px 12px; font-weight: 600; font-size: 13px; }
.seg button.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.highlight { border-color: #f5d17a; background: #fffcf2; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head.pad { padding: 16px 20px 0; margin-bottom: 10px; }
.card-title { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card > .card-title { margin-bottom: 12px; }
.card .card-title + * { margin-top: 0; }
h3.card-title { margin-top: 18px; margin-bottom: 10px; }
.stack > .card h3.card-title:first-child, .card > h3.card-title:first-child { margin-top: 0; }
.link-more { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 600; }
.link-more .ico { width: 15px; height: 15px; }

.cols-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; align-items: start; }
.cols-2.wide-left { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .cols-2.wide-left { grid-template-columns: 1fr; } }

.empty { display: grid; justify-items: center; gap: 8px; padding: 32px 16px; color: var(--muted); text-align: center; }
.empty .ico { width: 30px; height: 30px; color: var(--faint); }
.empty p { margin: 0; max-width: 42ch; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--navy-3); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.note { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--info-bg); color: var(--ink-2); margin: 12px 0 0; font-size: 13px; }
.note .ico { color: var(--info); margin-top: 1px; }
.note.warn { background: var(--warning-bg); }
.note.warn .ico { color: var(--warning); }
.note.good { background: var(--good-bg); }
.note.good .ico { color: var(--good); }

/* status: color + icon/label, never color alone */
.status { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.status .ico { width: 13px; height: 13px; stroke-width: 2.2; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status:has(.ico)::before { display: none; }
.status-good { background: var(--good-bg); color: var(--good); }
.status-warning { background: var(--warning-bg); color: var(--warning); }
.status-critical { background: var(--critical-bg); color: var(--critical); }
.status-info { background: var(--info-bg); color: var(--info); }
.status-neutral { background: var(--neutral-bg); color: var(--neutral); }
.status-muted { background: var(--line-2); color: var(--muted); }
.status-navy { background: #e6e9f2; color: var(--navy-2); }

.platform { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px 1px 6px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.platform::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--pc); }
.platforms { display: inline-flex; flex-wrap: wrap; gap: 4px; }

.avatar {
  --av: #98a2b3; position: relative; flex: none; display: inline-grid; place-items: center; border-radius: 50%;
  background: var(--av); color: #fff; font-weight: 700; letter-spacing: .02em; user-select: none;
}
.avatar-xs { width: 22px; height: 22px; font-size: 9.5px; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-md { width: 36px; height: 36px; font-size: 13px; }
.avatar-xl { width: 64px; height: 64px; font-size: 22px; }
.avatar.is-online::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 30%; height: 30%; min-width: 8px; min-height: 8px; border-radius: 50%; background: var(--good-dot); border: 2px solid var(--card); }
.user-cell { display: inline-flex; align-items: center; gap: 10px; }

/* ---------- forms ---------- */
.input {
  width: 100%; min-height: 38px; padding: 8px 11px; border-radius: var(--radius-sm);
  border: 1px solid #d0d5dd; background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(30, 143, 208, .18); }
select.input { padding-right: 28px; }
textarea.input { resize: vertical; min-height: 64px; }
.input.readonly, .input[readonly] { background: var(--line-2); color: var(--muted); }
.input-inline { width: auto; }
input[type="file"].input { padding: 6px; }
.input-with-btn { display: flex; gap: 6px; }
.input-with-btn .input { flex: 1; min-width: 0; }

.field { display: grid; gap: 5px; align-content: start; min-width: 0; }
.field.full, .form-grid > .full { grid-column: 1 / -1; }
.field-label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.req { color: var(--critical); }
.field-hint { font-size: 12px; color: var(--muted); }
.check-field { grid-template-columns: auto 1fr; align-items: start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); align-self: end; }
.check-field input { margin-top: 3px; width: 16px; height: 16px; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); cursor: pointer; margin-top: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid.narrow { grid-template-columns: 1fr; max-width: 420px; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.form-error { grid-column: 1 / -1; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--critical-bg); color: var(--critical); font-weight: 500; }
.form-foot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 6px; }
.progress { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--series-1); transition: width .2s; }

/* ---------- modal & toast ---------- */
.modal-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(16, 24, 40, .5); overflow-y: auto; }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--card); border-radius: 14px; box-shadow: var(--shadow-lg); }
.modal-wide { max-width: 820px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 12px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 17px; overflow: hidden; text-overflow: ellipsis; }
.modal-body { padding: 18px 22px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 22px; border-top: 1px solid var(--line); }
.confirm-text { margin: 0; font-size: 15px; }
.lightbox { display: grid; place-items: center; background: var(--line-2); border-radius: var(--radius-sm); }
.lightbox img { max-height: 70vh; object-fit: contain; }

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px; background: var(--navy); color: #fff; box-shadow: var(--shadow-lg); animation: toast-in .2s ease; transition: opacity .3s, transform .3s; }
.toast .ico { color: var(--lime); }
.toast-error { background: var(--critical); }
.toast-error .ico { color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 10px 14px; background: #fafbfc; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { border-top: 1px solid var(--line); border-bottom: 0; }
.table th.right, .table td.right { text-align: right; }
.table th.center, .table td.center { text-align: center; }
.table.compact td, .table.compact th { padding: 7px 10px; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #fafbfd; }
.table tr.row-alert td:first-child { box-shadow: inset 3px 0 0 var(--critical-dot); }
.row-actions { white-space: nowrap; }
.row-actions > * { vertical-align: middle; }
.thumb-cell { width: 56px; }
.thumb { width: 40px; height: 40px; object-fit: contain; border-radius: 6px; background: var(--line-2); }
.empty-thumb { display: grid; place-items: center; color: var(--faint); background: var(--line-2); }
.dir { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.dir-sales { background: #eaf2fe; color: #1849a9; }
.dir-cost { background: #f2f4f7; color: #344054; }
.role { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; margin-right: 6px; }
.role .ico { width: 14px; height: 14px; }
.role-owner { color: #9a6700; }
.role-admin { color: var(--navy-3); }

/* ---------- dashboard ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tiles.inner { margin: 0 0 18px; }
.tile { display: grid; gap: 2px; align-content: start; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; position: relative; }
a.tile:hover { border-color: #c9cfdb; text-decoration: none; }
.tiles.inner .tile { box-shadow: none; background: #fafbfc; }
.tile-icon { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--lime-soft); color: var(--navy-2); }
.tile-label { color: var(--muted); font-size: 13px; font-weight: 500; padding-right: 40px; }
.tile-value { font-size: 26px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; margin: 2px 0 4px; }
.tile-value.neg { color: var(--critical); }
.tile .status { justify-self: start; }

.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; align-items: start; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li + li { border-top: 1px solid var(--line-2); }
.row-link { display: flex; align-items: center; gap: 12px; padding: 10px 4px; color: inherit; text-decoration: none; }
.row-link:hover { background: #fafbfd; text-decoration: none; }
.row-date { width: 42px; flex: none; display: grid; justify-items: center; line-height: 1.1; padding: 5px 0; border-radius: 8px; background: var(--line-2); }
.row-date strong { font-size: 16px; }
.row-date small { font-size: 10.5px; text-transform: uppercase; color: var(--muted); }
.row-main { flex: 1; min-width: 0; display: grid; }
.row-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-side { display: grid; justify-items: end; gap: 3px; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.feed li { display: flex; gap: 10px; align-items: flex-start; }
.feed li > div { min-width: 0; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }

.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.profile-head h2 { font-size: 19px; }
.profile-head p { margin: 2px 0 0; }
.perm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.perm-list li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.perm { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.perm-0 { background: var(--line-2); color: var(--faint); }
.perm-1 { background: var(--info-bg); color: var(--info); }
.perm-2 { background: var(--good-bg); color: var(--good); }
.perm-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.perm-matrix input[type="radio"] { width: 17px; height: 17px; cursor: pointer; }
.perm-matrix.disabled { opacity: .45; }

/* ---------- catalog ---------- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.product-card { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: inherit; text-decoration: none; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.product-card:hover { border-color: #b9c2d3; transform: translateY(-1px); text-decoration: none; }
.product-img { aspect-ratio: 1 / 1; max-width: 100%; display: grid; place-items: center; background: #f7f8fa; color: var(--faint); padding: 10px; }
.product-img img { width: 100%; height: 100%; object-fit: contain; }
.product-img .ico { width: 36px; height: 36px; }
.product-info { display: grid; gap: 3px; padding: 12px 14px 14px; flex: 1; align-content: start; }
.product-top { display: flex; gap: 6px; align-items: center; min-height: 20px; }
.code { font-family: var(--mono); font-size: 12px; color: var(--muted); background: var(--line-2); padding: 0 6px; border-radius: 5px; }
.product-name { font-size: 14px; line-height: 1.3; }
.product-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.price { font-weight: 700; font-size: 15px; }
.doc-count { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-size: 12.5px; }
.doc-count .ico { width: 14px; height: 14px; }

.product-layout { display: grid; grid-template-columns: minmax(260px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .product-layout { grid-template-columns: 1fr; } }
.gallery { display: grid; gap: 10px; }
.gallery-main { display: grid; place-items: center; aspect-ratio: 1 / 1; max-width: 100%; width: 100%; border: 0; border-radius: var(--radius-sm); background: #f7f8fa; cursor: zoom-in; padding: 12px; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; }
div.gallery-main { cursor: default; gap: 6px; align-content: center; }
.gallery-main .ico { width: 40px; height: 40px; }
.gallery-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.gallery-thumb { display: grid; gap: 4px; }
.gallery-thumb > button:first-child { border: 2px solid transparent; border-radius: 8px; background: #f7f8fa; padding: 4px; aspect-ratio: 1 / 1; cursor: pointer; }
.gallery-thumb.active > button:first-child { border-color: var(--lime); }
.gallery-thumb img { width: 100%; height: 100%; object-fit: contain; }
.set-main { border: 0; background: none; font-size: 11px; color: var(--info); cursor: pointer; padding: 0; }
.price-hero { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line-2); }
.hero-num { font-size: 28px; font-weight: 700; letter-spacing: -.01em; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; min-width: 0; word-break: break-word; }
.copyable { display: inline-flex; align-items: center; gap: 2px; }
.doc-kind { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 16px 0 6px; }
.card > .doc-kind:nth-child(2) { margin-top: 0; }
.file-list { list-style: none; margin: 0; padding: 0; }
.file-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.file-list li:last-child { border-bottom: 0; }
.file-list li > .ico { color: var(--muted); }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- files ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; min-width: 0; }
.crumbs a { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2); }
.crumbs a:last-child { color: var(--ink); }
.crumbs .ico { width: 16px; height: 16px; }
.crumb-sep { color: var(--faint); }
.dropzone { position: relative; transition: box-shadow .15s; }
.dropzone.drag { box-shadow: 0 0 0 3px var(--lime), var(--shadow); }
.dropzone.drag::after { content: ""; position: absolute; inset: 0; background: rgba(201, 217, 43, .08); pointer-events: none; }
.file-cell { display: inline-flex; align-items: center; gap: 10px; min-width: 0; color: var(--ink); font-weight: 500; }
a.file-cell:hover { text-decoration: none; }
.fi { width: 32px; height: 32px; flex: none; border-radius: 8px; display: grid; place-items: center; background: var(--line-2); color: var(--muted); }
.fi-folder { background: #fff6d6; color: #b07d00; }
.fi-pdf { background: #fdecec; color: #c0392b; }
.fi-image { background: #eaf2fe; color: #1e6ad0; }
.upload-bar { display: grid; gap: 6px; margin-bottom: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.upload-bar .progress { grid-column: auto; }

/* ---------- charts ---------- */
.chart { position: relative; }
.chart-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.chart-canvas { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-grid { stroke: #eceef2; stroke-width: 1; }
.chart-base { stroke: #c3c8d2; stroke-width: 1; }
.chart-tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-hit { fill: transparent; cursor: default; }
.chart-col.hover .chart-hit { fill: rgba(16, 24, 40, .035); }
.chart-tip { position: absolute; top: 0; transform: translateX(-50%); min-width: 160px; padding: 8px 10px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-lg); font-size: 12.5px; pointer-events: none; z-index: 2; }
.tip-row { display: grid; grid-template-columns: auto 1fr auto; gap: 6px; align-items: center; margin-top: 3px; }
.tip-row .num { font-weight: 600; }
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hbars li { display: grid; grid-template-columns: minmax(80px, 110px) 1fr auto; align-items: center; gap: 10px; }
.hbar-label { font-size: 13px; color: var(--ink-2); }
.hbar-track { height: 10px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.hbar-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--series-1); }
.hbar-value { font-weight: 600; min-width: 2ch; text-align: right; }
.meter { display: inline-flex; align-items: center; gap: 8px; min-width: 120px; }
.meter-track { flex: 1; height: 6px; border-radius: 999px; background: var(--line-2); overflow: hidden; min-width: 60px; }
.meter-fill { display: block; height: 100%; background: var(--series-1); border-radius: 0 3px 3px 0; }

/* ---------- social ---------- */
.platform-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.platform-stat { display: grid; gap: 4px; padding: 12px; border-radius: var(--radius-sm); background: #fafbfc; border: 1px solid var(--line-2); }
.platform-stat .platform { justify-self: start; }
.account-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.account-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: grid; gap: 8px; align-content: start; border-top: 4px solid var(--pc); }
.account-top { display: flex; justify-content: space-between; align-items: center; min-height: 30px; }
.account-card h3 { font-size: 16px; }
.account-url { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; word-break: break-all; }
.account-url .ico { width: 13px; height: 13px; }
.account-followers { display: grid; }

/* ---------- planner ---------- */
.month-nav { display: flex; align-items: center; gap: 4px; }
.month-label { font-size: 17px; min-width: 170px; text-align: center; text-transform: capitalize; }
.planner-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
@media (max-width: 1200px) { .planner-layout { grid-template-columns: 1fr; } }
.planner-side { display: grid; gap: 16px; }
.planner-side .card-title .ico { color: var(--muted); }
.side-post { display: grid; gap: 3px; justify-items: start; width: 100%; text-align: left; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); cursor: pointer; }
.side-post:hover { border-color: #b9c2d3; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: capitalize; background: #fafbfc; border-bottom: 1px solid var(--line); }
.cal-cell { min-height: 118px; padding: 6px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.out { background: #fbfcfd; }
.cal-cell.out .cal-num { color: var(--faint); }
.cal-date { display: flex; align-items: center; justify-content: space-between; min-height: 26px; }
.cal-num { font-weight: 600; font-size: 13px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.cal-cell.today .cal-num { background: var(--navy-2); color: #fff; }
.cal-wd { display: none; }
.cal-add { opacity: 0; }
.cal-cell:hover .cal-add, .cal-add:focus-visible { opacity: 1; }
.cal-chip { display: flex; gap: 5px; align-items: baseline; width: 100%; min-width: 0; padding: 3px 6px; border: 0; border-left: 3px solid var(--st); border-radius: 5px; background: var(--st-bg); font-size: 12px; text-align: left; cursor: pointer; color: var(--ink); }
.cal-chip:hover { filter: brightness(.97); }
.cal-time { font-variant-numeric: tabular-nums; color: var(--muted); flex: none; }
.cal-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-more { border: 0; background: none; color: var(--info); font-size: 12px; text-align: left; padding: 2px 6px; cursor: pointer; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; }
.st-idea { --st: #98a2b3; --st-bg: #f2f4f7; }
.st-draft { --st: #528bff; --st-bg: #eef4ff; }
.st-review { --st: #f79009; --st-bg: #fef6e7; }
.st-approved { --st: #12b76a; --st-bg: #ecfdf3; }
.st-published { --st: #1c2c50; --st-bg: #e9ecf3; }
.swatch.st-idea, .swatch.st-draft, .swatch.st-review, .swatch.st-approved, .swatch.st-published { background: var(--st); }
@media (max-width: 760px) {
  .cal { grid-template-columns: 1fr; }
  .cal-dow, .cal-cell.out, .cal-cell.empty-day:not(.today) { display: none; }
  .cal-cell { min-height: 0; border-right: 0; }
  .cal-wd { display: inline; flex: 1; margin-left: 6px; color: var(--muted); text-transform: capitalize; }
  .cal-add { opacity: 1; }
}

.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { position: relative; cursor: pointer; }
.pill input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.pill span { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--ink-2); background: var(--card); }
.pill span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--pc); }
.pill input:checked + span { border-color: var(--navy-2); background: var(--navy-2); color: #fff; }
.pill input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.post-image { max-height: 320px; object-fit: contain; border-radius: var(--radius-sm); background: var(--line-2); }
.post-image.small { max-height: 140px; margin-bottom: 6px; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.post-content { padding: 14px; border-radius: var(--radius-sm); background: #fafbfc; border: 1px solid var(--line-2); }
.comments-wrap { border-top: 1px solid var(--line); padding-top: 4px; margin-top: 4px; }
.comments { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 12px; }
.comments li { display: flex; gap: 10px; }
.comments li > div { min-width: 0; }
.comment-new { display: grid; gap: 6px; justify-items: end; }

/* ---------- chat ---------- */
.chat-page { display: grid; grid-template-columns: 290px minmax(0, 1fr); height: 100vh; }
.chat-side { border-right: 1px solid var(--line); background: var(--card); display: flex; flex-direction: column; min-height: 0; }
.chat-side-head { padding: 22px 18px 10px; }
.chat-side-head h1 { font-size: 20px; }
.chat-list { overflow-y: auto; padding: 4px 10px 16px; }
.chat-group { margin-top: 12px; }
.chat-group-head { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); min-height: 30px; }
.chat-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink-2); cursor: pointer; text-align: left; }
.chat-item:hover { background: var(--line-2); }
.chat-item.active { background: var(--navy-2); color: #fff; }
.chat-item.active .ico { color: var(--lime); }
.chat-item .ico { width: 16px; height: 16px; color: var(--faint); }
.chat-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.chat-conv { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg); }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 20px; background: var(--card); border-bottom: 1px solid var(--line); min-height: 64px; }
.chat-head:empty { display: none; }
.chat-head h2 { font-size: 16px; }
.chat-head-text { display: grid; min-width: 0; }
.chat-hash { width: 36px; height: 36px; border-radius: 10px; background: var(--lime-soft); color: var(--navy-2); display: grid; place-items: center; }
.chat-back { display: none; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 16px 20px; }
.chat-more { display: flex; justify-content: center; margin-bottom: 12px; }
.chat-day { display: flex; align-items: center; gap: 12px; margin: 18px 0 10px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: capitalize; }
.chat-day::before, .chat-day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.msg { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; padding: 6px 8px; border-radius: var(--radius-sm); margin-top: 6px; }
.msg.compact { margin-top: 0; padding-top: 1px; padding-bottom: 1px; }
.msg:hover { background: rgba(255, 255, 255, .7); }
.msg-side-time { font-size: 10.5px; color: transparent; text-align: center; padding-top: 3px; font-variant-numeric: tabular-nums; }
.msg:hover .msg-side-time { color: var(--faint); }
.msg-meta { display: flex; align-items: baseline; gap: 8px; }
.msg-meta time { font-size: 11.5px; color: var(--faint); }
.msg-text { white-space: pre-wrap; word-break: break-word; }
.msg-text.deleted { color: var(--faint); font-style: italic; }
.msg-edited { font-size: 11.5px; color: var(--faint); }
.msg-actions { position: absolute; top: -10px; right: 8px; display: none; gap: 2px; padding: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.msg:hover .msg-actions, .msg:focus-within .msg-actions { display: flex; }
.msg-image { display: block; margin-top: 6px; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); cursor: zoom-in; max-width: min(320px, 100%); }
.msg-image img { max-height: 240px; object-fit: cover; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); max-width: 100%; }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip small { color: var(--muted); flex: none; }
.file-chip:hover { text-decoration: none; border-color: #b9c2d3; }
.chat-composer { padding: 12px 20px 16px; background: var(--bg); }
.composer-row { display: flex; align-items: flex-end; gap: 8px; padding: 6px; background: var(--card); border: 1px solid #d0d5dd; border-radius: 12px; box-shadow: var(--shadow); }
.composer-row:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(30, 143, 208, .15); }
.chat-input { border: 0; box-shadow: none; resize: none; min-height: 38px; max-height: 180px; padding: 8px 4px; }
.chat-input:focus { box-shadow: none; }
.chat-send { width: 40px; height: 38px; padding: 0; flex: none; }
.composer-file { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 4px 4px 4px 10px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); font-size: 13px; max-width: 100%; }
.composer-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 899px) {
  .chat-page { grid-template-columns: 1fr; height: calc(100vh - 56px); }
  .chat-page .chat-conv { display: none; }
  .chat-page.show-conv .chat-side { display: none; }
  .chat-page.show-conv .chat-conv { display: flex; }
  .chat-back { display: inline-grid; margin-left: -8px; }
  .chat-head { padding: 8px 12px; min-height: 56px; }
  .chat-scroll { padding: 12px; }
  .chat-composer { padding: 8px 12px 12px; }
  .msg-actions { display: flex; position: static; grid-column: 2; justify-self: start; box-shadow: none; }
}
@supports (height: 100dvh) {
  .chat-page { height: 100dvh; }
  @media (max-width: 899px) { .chat-page { height: calc(100dvh - 56px); } }
}

@media print {
  .sidebar, .topbar, .page-actions, .toolbar, .row-actions { display: none !important; }
  .content { margin: 0; }
  .card { box-shadow: none; }
}
