/* Ad Portal — minimal design system */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --border: #e7e9ee;
  --border-strong: #d5d9e0;
  --text: #101828;
  --text-2: #475467;
  --text-3: #98a2b3;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --success: #067647;
  --success-bg: #ecfdf3;
  --warn: #b54708;
  --warn-bg: #fffaeb;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --wa: #128c4b;
  --wa-bg: #ecfdf3;
  --tg: #229ed9;
  --tg-bg: #eef8fd;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--text); }

.boot {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; color: var(--text-3); font-size: 13px;
}

/* ---------- auth screen ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 16px; padding: 32px;
  box-shadow: var(--shadow);
}
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 9px; background: var(--accent);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
}
.logo-text { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.auth-title { font-size: 20px; font-weight: 650; letter-spacing: -0.02em; }
.auth-sub { color: var(--text-2); font-size: 13px; margin: 4px 0 22px; }
.auth-switch { text-align: center; margin-top: 18px; color: var(--text-2); font-size: 13px; }
.auth-switch button {
  background: none; border: none; color: var(--accent); font-weight: 600;
  font-size: 13px; cursor: pointer;
}

/* ---------- forms ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 12px; font-weight: 600; color: var(--text-2);
  margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface); outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 76px; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; transition: background .12s, border-color .12s, opacity .12s;
  white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: #f2f4f7; }
.btn-danger { background: var(--surface); color: var(--danger); border-color: #f0c9c5; }
.btn-danger:hover:not(:disabled) { background: var(--danger-bg); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn-wa { background: var(--wa-bg); color: var(--wa); border-color: #b7e7c9; }
.btn-wa:hover { background: #dcf5e6; }
.btn-tg { background: var(--tg-bg); color: var(--tg); border-color: #b9dff0; }
.btn-tg:hover { background: #dceffa; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border); padding: 20px 14px;
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: var(--radius-sm); color: var(--text-2); font-size: 13.5px;
  font-weight: 550; cursor: pointer; border: none; background: none; width: 100%;
  text-align: left;
}
.nav-item:hover { background: #f2f4f7; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item .icon { width: 18px; text-align: center; font-size: 15px; }
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; }
.user-chip { padding: 6px 10px 10px; }
.user-chip .name { font-size: 13px; font-weight: 600; }
.user-chip .email {
  font-size: 11.5px; color: var(--text-3); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; max-width: 180px;
}
.main { flex: 1; margin-left: 232px; padding: 34px 40px 60px; }
.content { max-width: 1060px; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-title { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.page-sub { color: var(--text-2); font-size: 13.5px; margin-top: 3px; }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-title { font-size: 14px; font-weight: 650; margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* stat cards */
.stat-label { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 32px; font-weight: 650; letter-spacing: -0.02em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.stat-meta { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }

/* platform rows */
.platform-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.platform-row:last-child { border-bottom: none; }
.p-icon {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; background: #fff;
}
.p-icon img { width: 17px; height: 17px; }
.p-name { font-weight: 600; font-size: 13.5px; }
.p-sub { font-size: 12px; color: var(--text-3); }
.p-amount { margin-left: auto; font-weight: 650; font-variant-numeric: tabular-nums; }

/* CTA */
.cta {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  background: linear-gradient(120deg, #1c1b2e, #2a2752);
  border-radius: var(--radius); padding: 24px 26px; color: #fff;
}
.cta h3 { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.cta p { color: rgba(255,255,255,.72); font-size: 13px; margin-top: 4px; }
.cta .btns { display: flex; gap: 10px; flex-shrink: 0; }
.cta .btn-wa, .cta .btn-tg { background: rgba(255,255,255,.94); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; font-weight: 650; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
td {
  padding: 13px 12px; border-bottom: 1px solid var(--border); font-size: 13px;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }
.cell-strong { font-weight: 600; }
.cell-muted { color: var(--text-3); font-size: 12px; }
.cell-num { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.cell-actions { display: flex; gap: 6px; justify-content: flex-end; }
.icon-chip { display: inline-flex; align-items: center; gap: 8px; }
.icon-chip img { width: 16px; height: 16px; }

/* badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2.5px 9px;
  border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-green { background: var(--success-bg); color: var(--success); }
.badge-amber { background: var(--warn-bg); color: var(--warn); }
.badge-red { background: var(--danger-bg); color: var(--danger); }
.badge-gray { background: #f2f4f7; color: var(--text-2); }
.badge-indigo { background: var(--accent-soft); color: var(--accent); }

/* filters */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.chip {
  height: 32px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); font-size: 12.5px; font-weight: 600; color: var(--text-2);
  cursor: pointer;
}
.chip.active { background: var(--text); color: #fff; border-color: var(--text); }
.search {
  height: 32px; padding: 0 12px; border: 1px solid var(--border-strong);
  border-radius: 999px; outline: none; margin-left: auto; width: 210px; font-size: 13px;
}
.search:focus { border-color: var(--accent); }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab {
  padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--text-2);
  border: none; background: none; cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* empty state */
.empty { text-align: center; padding: 42px 20px; color: var(--text-3); font-size: 13px; }

/* modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .38);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal {
  width: 100%; max-width: 480px; background: var(--surface); border-radius: 16px;
  padding: 24px; box-shadow: 0 20px 50px rgba(16,24,40,.18); max-height: 90vh; overflow-y: auto;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-title { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.modal-close {
  border: none; background: none; font-size: 18px; color: var(--text-3);
  cursor: pointer; line-height: 1; padding: 4px 8px; border-radius: 6px;
}
.modal-close:hover { background: #f2f4f7; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* toasts */
#toasts { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast {
  background: var(--text); color: #fff; padding: 11px 16px; border-radius: 10px;
  font-size: 13px; font-weight: 550; box-shadow: 0 8px 24px rgba(16,24,40,.22);
  animation: slide-in .18s ease-out;
}
.toast.error { background: var(--danger); }
@keyframes slide-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* file input */
.file-label {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 13px; cursor: pointer; background: #fafbfc;
}
.file-label:hover { border-color: var(--accent); color: var(--accent); }
input[type="file"] { display: none; }

/* responsive */
@media (max-width: 920px) {
  .sidebar {
    position: static; width: 100%; flex-direction: row; align-items: center;
    border-right: none; border-bottom: 1px solid var(--border); padding: 10px 14px;
    overflow-x: auto;
  }
  .shell { flex-direction: column; }
  .brand { padding: 0 8px 0 0; }
  .nav { flex-direction: row; }
  .sidebar-footer { margin: 0 0 0 auto; border-top: none; padding-top: 0; display: flex; align-items: center; gap: 8px; }
  .user-chip { display: none; }
  .main { margin-left: 0; padding: 22px 18px 48px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .cta { flex-direction: column; align-items: flex-start; }
}

.nav-sep { height: 1px; background: var(--border); margin: 10px 4px; }
a.nav-item { text-decoration: none; display: flex; align-items: center; gap: 8px; }

/* ---------- polish ---------- */
.nav-item { position: relative; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item.active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.page-sub { color: var(--text-2); }
.page-title { font-weight: 700; }
th { color: var(--text-2); background: #fafbfc; }
td { padding-top: 14px; padding-bottom: 14px; }
.btn-quiet-danger { color: var(--danger); }
.platform-row.empty { opacity: .5; }
.profile-card { padding: 24px; }
.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.avatar { width: 52px; height: 52px; border-radius: 14px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; }
.profile-name { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
.field input:disabled { background: #f6f7f9; color: var(--text-3); cursor: not-allowed; }
.sidebar-footer { padding-bottom: 4px; }

.amt-pos { color: #067647; font-weight: 600; }
.amt-neg { color: var(--danger); font-weight: 600; }
.cell-num.amt-pos, .cell-num.amt-neg { text-align: right; }

.logo-img { width: 32px; height: 32px; border-radius: 8px; display: block; flex-shrink: 0; }
.auth-logo .logo-img { width: 36px; height: 36px; }
