:root {
  --bg: #f2f3ee;
  --surface: #ffffff;
  --ink: #171815;
  --muted: #777b70;
  --line: #dedfd8;
  --accent: #caff59;
  --danger: #b42318;
  --success: #2e7d32;
  --radius: 22px;
  --sidebar: 230px;
}
* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
a { color: inherit; }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 12% 12%, rgba(255,255,255,.95), transparent 34%), linear-gradient(135deg, #e8eadf 0%, #f6f5ef 55%, #e4e7da 100%); }
.login-card { width: min(960px, 100%); min-height: 610px; display: grid; grid-template-columns: 1.08fr .92fr; overflow: hidden; border: 1px solid rgba(255,255,255,.75); border-radius: 30px; background: rgba(255,255,255,.78); box-shadow: 0 30px 90px rgba(59,63,47,.16); backdrop-filter: blur(18px); }
.login-intro { padding: 48px; display: flex; flex-direction: column; justify-content: space-between; color: white; background: linear-gradient(155deg, rgba(23,24,21,.96), rgba(52,57,44,.94)); }
.login-brand { color: white; padding: 0; align-self: flex-start; }
.login-brand .brand-mark { color: var(--ink); background: #eef0e6; }
.login-intro h1 { margin: 10px 0 18px; font-size: clamp(38px, 5vw, 58px); line-height: 1.02; letter-spacing: -.05em; }
.login-intro p { max-width: 480px; margin: 0; color: #c9cec0; line-height: 1.7; }
.login-points { display: grid; gap: 10px; color: #e3e6dc; font-size: 13px; }
.login-form { padding: 58px 48px; display: flex; flex-direction: column; justify-content: center; gap: 20px; }
.login-form h2 { margin: 7px 0 8px; font-size: 32px; letter-spacing: -.035em; }
.password-field { position: relative; }
.password-field input { padding-right: 68px; }
.password-field button { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); border: 0; padding: 8px 10px; color: var(--muted); background: transparent; font-weight: 700; cursor: pointer; }
.login-error { margin: -4px 0 0; }
.setup-link { margin-top: -10px; color: var(--danger); font-size: 13px; font-weight: 800; text-align: center; }
.login-button { width: 100%; min-height: 48px; }
.back-link { align-self: center; color: var(--muted); font-size: 13px; font-weight: 700; }
.shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 18px; background: #171815; color: white; }
.admin-brand { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; padding: 4px 8px 30px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--accent); color: #171815; font-weight: 900; }
.admin-brand strong, .admin-brand small { display: block; }
.admin-brand small { margin-top: 2px; color: #9da095; font-size: 11px; }
.side-nav { display: grid; gap: 6px; }
.nav-item { border: 0; text-align: left; color: #afb2a8; background: transparent; padding: 12px 14px; border-radius: 12px; cursor: pointer; }
.nav-item:hover, .nav-item.active { color: #171815; background: var(--accent); font-weight: 750; }
.sidebar-bottom { margin-top: auto; display: grid; gap: 10px; padding: 16px 8px 4px; border-top: 1px solid rgba(255,255,255,.12); }
.sidebar-bottom a { color: #a9aca2; text-decoration: none; font-size: 12px; }
.sidebar-bottom a:hover { color: white; }
.main { min-width: 0; padding: 36px clamp(24px, 4vw, 62px) 72px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.topbar h1 { margin: 4px 0 0; font-size: clamp(32px, 4vw, 52px); letter-spacing: -.05em; }
.eyebrow { margin: 0; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.live-pill { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: rgba(255,255,255,.55); border-radius: 999px; padding: 9px 12px; font-size: 12px; }
.live-pill i, .success i { width: 8px; height: 8px; border-radius: 50%; background: var(--success); display: inline-block; }
.live-pill i.off, .error i { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); display: inline-block; }
.admin-user { padding: 9px 12px; border-radius: 10px; color: var(--muted); background: #eeefe9; font-size: 12px; font-weight: 800; }
.logout-button { padding: 10px 13px; }
.view { display: none; }
.view.active { display: block; }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
.metric-card, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.metric-card { min-height: 180px; padding: 24px; display: flex; flex-direction: column; }
.metric-card > span { color: var(--muted); font-size: 13px; }
.metric-card strong { font-size: 42px; letter-spacing: -.05em; margin: auto 0 2px; }
.metric-card small { color: var(--muted); }
.panel { padding: 26px; margin-bottom: 14px; }
.panel-head, .ads-hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.panel-head { margin-bottom: 22px; }
.panel-head.compact { align-items: end; }
.panel h2, .ads-hero h2, dialog h2 { margin: 5px 0 0; font-size: 27px; letter-spacing: -.04em; }
.muted { color: var(--muted); margin: 8px 0 0; }
.status-list { border-top: 1px solid var(--line); }
.status-list > div, .summary-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.status-list > div:last-child, .summary-row:last-child { border-bottom: 0; }
.status-list span, .summary-row span { color: var(--muted); }
.ads-hero { margin-bottom: 22px; align-items: end; }
.hero-buttons, .inline-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.button { min-height: 42px; border: 1px solid transparent; border-radius: 999px; padding: 0 16px; font-weight: 750; font-size: 13px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.button.primary { background: #171815; color: white; }
.button.secondary { background: white; border-color: var(--line); color: var(--ink); }
.button.danger-outline { background: #fff7f6; border-color: #f0c5c1; color: var(--danger); }
.button.danger-solid { background: var(--danger); color: white; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .5; cursor: wait; transform: none; }
.button.is-loading::before { content: ""; width: 13px; height: 13px; margin-right: 8px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: button-spin .7s linear infinite; }
form[aria-busy="true"] { cursor: wait; }
@keyframes button-spin { to { transform: rotate(360deg); } }
.success { color: var(--success); display: inline-flex; gap: 8px; align-items: center; }
.error { color: var(--danger); display: inline-flex; gap: 8px; align-items: center; }
.ads-summary { padding-top: 6px; padding-bottom: 6px; }
.summary-row a { font-weight: 700; }
.search { display: grid; gap: 6px; color: var(--muted); font-size: 11px; }
.search input { min-width: 250px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); background: white; color: var(--ink); border-radius: 12px; padding: 12px 13px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: #969a8c; box-shadow: 0 0 0 3px rgba(120,125,108,.1); }
textarea { resize: vertical; }
.seller-list { display: grid; gap: 10px; }
.seller-card { display: grid; grid-template-columns: minmax(160px, .8fr) minmax(260px, 1.2fr) auto; gap: 20px; align-items: center; padding: 18px; border: 1px solid var(--line); border-radius: 17px; background: white; }
.seller-card.disabled { opacity: .65; background: #fafaf8; }
.seller-name strong { display: block; }
.seller-name small { display: block; color: var(--muted); margin-top: 4px; }
.enabled-tag { display: inline-block; margin-top: 6px; padding: 3px 8px; border-radius: 6px; font-size: 10px; font-weight: 800; text-transform: uppercase; background: #e8f5e9; color: var(--success); }
.disabled-tag { display: inline-block; margin-top: 6px; padding: 3px 8px; border-radius: 6px; font-size: 10px; font-weight: 800; text-transform: uppercase; background: #fbe9e7; color: var(--danger); }
.seller-values { display: grid; gap: 6px; min-width: 0; }
.seller-values code { overflow-wrap: anywhere; color: #4f524b; font-size: 12px; }
.seller-values .line-preview { color: var(--ink); font-size: 12px; font-weight: 700; background: #f6f7f3; padding: 4px 8px; border-radius: 6px; }
.seller-actions { display: flex; gap: 7px; align-items: center; }
.mini-button { border: 1px solid var(--line); background: white; border-radius: 9px; padding: 8px 10px; cursor: pointer; font-size: 12px; font-weight: 700; }
.mini-button.danger { color: var(--danger); }
.switch { position: relative; width: 40px; height: 22px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #c7c9c0; cursor: pointer; transition: .2s; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: white; transition: .2s; }
.switch input:checked + span { background: #171815; }
.switch input:checked + span::after { transform: translateX(18px); }
.empty-card, .empty { text-align: center; color: var(--muted); padding: 34px 12px; }
.preview-panel pre { margin: 0; min-height: 150px; padding: 20px; border-radius: 15px; background: #171815; color: #d8dbcF; white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.7 ui-monospace, SFMono-Regular, Menlo, monospace; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px 12px; border-top: 1px solid var(--line); font-size: 13px; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.app-cell { display: flex; gap: 12px; align-items: center; min-width: 220px; }
.app-cell img { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; }
.app-cell strong, .app-cell small { display: block; }
.app-cell small { color: var(--muted); margin-top: 3px; }
td code { font-size: 11px; color: #5b5f56; }

dialog { border: 0; padding: 0; border-radius: 24px; width: min(660px, calc(100% - 28px)); color: var(--ink); box-shadow: 0 30px 90px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(20,20,18,.55); backdrop-filter: blur(3px); }
.dialog-card { padding: 26px; }
.dialog-head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.icon-button { border: 1px solid var(--line); width: 36px; height: 36px; border-radius: 50%; background: white; font-size: 22px; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; gap: 7px; }
.field > span { font-size: 12px; font-weight: 700; }
.field em { font-style: normal; color: var(--muted); font-weight: 400; }
.full { grid-column: 1 / -1; }
.toggle-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.toggle-row input { width: auto; }
.form-error { margin-top: 14px; border-radius: 12px; padding: 12px; background: #fff1f0; color: var(--danger); font-size: 12px; white-space: pre-wrap; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.danger-dialog { width: min(520px, 100%); }
.delete-warning { margin-top: 18px; padding: 14px; border: 1px solid #f0c5c1; border-radius: 12px; color: var(--danger); background: #fff7f6; font-size: 13px; font-weight: 700; }
.toast { position: fixed; right: 24px; bottom: 24px; background: #171815; color: white; border-radius: 12px; padding: 12px 15px; font-size: 12px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .login-card { grid-template-columns: 1fr; }
  .login-intro { min-height: 250px; gap: 34px; }
  .login-points { display: none; }
  :root { --sidebar: 78px; }
  .admin-brand span:last-child, .nav-item { font-size: 0; }
  .nav-item::first-letter { font-size: 14px; }
  .sidebar-bottom { display: none; }
  .metric-grid { grid-template-columns: 1fr; }
  .seller-card { grid-template-columns: 1fr; }
  .seller-actions { justify-content: flex-start; }
}
@media (max-width: 620px) {
  .login-screen { padding: 0; place-items: stretch; }
  .login-card { min-height: 100vh; border: 0; border-radius: 0; }
  .login-intro { min-height: auto; padding: 30px 24px; }
  .login-intro h1 { font-size: 36px; }
  .login-form { padding: 38px 24px; }
  .top-actions { flex-wrap: wrap; }
  .admin-user { display: none; }
  .shell { display: block; }
  .sidebar { position: sticky; z-index: 10; width: 100%; height: auto; padding: 10px 12px; flex-direction: row; align-items: center; gap: 12px; }
  .admin-brand { padding: 0; }
  .admin-brand span:last-child { display: none; }
  .side-nav { display: flex; overflow-x: auto; }
  .nav-item { font-size: 12px; white-space: nowrap; padding: 10px; }
  .nav-item::first-letter { font-size: inherit; }
  .main { padding: 22px 14px 54px; }
  .topbar, .ads-hero, .panel-head { align-items: flex-start; flex-direction: column; }
  .search, .search input { width: 100%; min-width: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .full { grid-column: auto; }
}
