:root {
    --ink: #17232b;
    --muted: #77848a;
    --line: #e6eceb;
    --paper: #f7faf9;
    --white: #ffffff;
    --teal: #187d78;
    --teal-dark: #12615d;
    --teal-pale: #e7f4f2;
    --coral: #e36c50;
    --coral-pale: #fff0eb;
    --yellow-pale: #fff7d9;
    --shadow: 0 18px 50px rgba(28, 58, 62, .08);
    font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font-size: 14px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 254px; padding: 28px 18px 20px; display: flex; flex-direction: column; background: #123e3d; color: #d5e7e4; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 42px; }
.sidebar-brand strong { display: block; color: white; font-size: 15px; letter-spacing: .2px; }
.sidebar-brand span { display: block; margin-top: 4px; color: #7ea8a5; font-size: 10px; letter-spacing: 1.2px; }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; color: white; background: var(--coral); font-weight: 800; letter-spacing: -1px; transform: rotate(-5deg); border-radius: 12px 5px 12px 5px; }
.brand-mark.small { width: 36px; height: 36px; font-size: 12px; border-radius: 9px 4px 9px 4px; }
.nav-list { display: grid; gap: 8px; }
.nav-list a { display: flex; align-items: center; gap: 13px; padding: 13px 14px; color: #a8c8c4; border-radius: 6px; transition: .18s ease; }
.nav-list a:hover, .nav-list a.active { color: white; background: #1d5c59; }
.nav-list a.active { box-shadow: inset 3px 0 0 var(--coral); }
.nav-icon { width: 18px; color: #8ab8b2; font-size: 18px; text-align: center; }
.sidebar-bottom { margin-top: auto; padding: 16px 10px 0; border-top: 1px solid rgba(210, 240, 235, .14); }
.server-status { display: flex; gap: 8px; align-items: center; color: #9fc6c0; font-size: 12px; }
.server-status i { width: 7px; height: 7px; border-radius: 50%; background: #66cf9e; box-shadow: 0 0 0 4px rgba(102, 207, 158, .12); }
.logout-link { display: block; margin-top: 18px; color: #88aaa7; font-size: 12px; }
.main-shell { min-width: 0; flex: 1; }
.topbar { height: 112px; display: flex; align-items: center; justify-content: space-between; padding: 22px 54px; background: var(--white); border-bottom: 1px solid var(--line); }
.topbar-kicker, .section-kicker, .eyebrow { margin: 0 0 5px; color: var(--teal); font-size: 10px; letter-spacing: 1.8px; font-weight: 800; }
.topbar h1, .page-intro h2, .section-heading h3, .form-panel h3 { margin: 0; font-weight: 700; }
.topbar h1 { font-size: 24px; }
.account-chip { display: flex; align-items: center; gap: 10px; color: #536268; font-weight: 600; }
.avatar { width: 32px; height: 32px; display: grid; place-items: center; color: white; background: var(--teal); border-radius: 50%; font-size: 12px; }
.content { max-width: 1440px; margin: 0 auto; padding: 42px 54px 70px; }
.page-intro { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.page-intro h2 { font-size: 28px; letter-spacing: -.5px; }
.muted { margin: 0 0 7px; color: var(--muted); font-size: 13px; }
.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 17px; border: 0; border-radius: 5px; cursor: pointer; font-weight: 700; transition: .18s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: white; background: var(--teal); box-shadow: 0 8px 18px rgba(24, 125, 120, .18); }
.button-primary:hover { background: var(--teal-dark); }
.button-light { color: #516167; background: #eef3f2; }
.button-wide { width: 100%; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 48px; }
.metric-card { padding: 22px 24px; background: var(--white); border: 1px solid var(--line); box-shadow: var(--shadow); }
.metric-label, .metric-note { display: block; color: var(--muted); font-size: 12px; }
.metric-card strong { display: block; margin: 12px 0 8px; color: var(--ink); font-size: 31px; letter-spacing: -.5px; }
.metric-note.positive { color: var(--teal); }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 14px; }
.section-heading h3 { font-size: 20px; }
.text-link { color: var(--teal); font-size: 13px; font-weight: 700; }
.table-wrap { overflow: auto; background: var(--white); border: 1px solid var(--line); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; min-width: 800px; }
th, td { padding: 17px 20px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: #879297; background: #fbfcfc; font-size: 11px; font-weight: 700; letter-spacing: .7px; }
tbody tr:last-child td { border-bottom: 0; }
td { color: #58676c; font-size: 13px; }
.ad-cell { display: flex; align-items: center; gap: 12px; min-width: 245px; }
.ad-cell img { width: 50px; height: 38px; object-fit: cover; background: #edf2f1; border-radius: 4px; }
.ad-cell strong { display: block; max-width: 210px; overflow: hidden; color: var(--ink); text-overflow: ellipsis; font-size: 13px; }
.ad-cell span { display: block; max-width: 210px; overflow: hidden; margin-top: 5px; color: var(--muted); text-overflow: ellipsis; font-size: 11px; }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-live { color: var(--teal); }
.status-pending { color: #c28d22; }
.status-off { color: #a2abad; }
.flash { margin-bottom: 20px; padding: 12px 15px; border-left: 3px solid; font-size: 13px; }
.flash-success { color: #12615d; background: var(--teal-pale); border-color: var(--teal); }
.flash-error { color: #a74931; background: var(--coral-pale); border-color: var(--coral); }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.search-box { width: min(340px, 100%); display: flex; align-items: center; gap: 8px; padding: 0 12px; color: #97a5a7; background: white; border: 1px solid var(--line); border-radius: 5px; }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; }
select, input:not([type="checkbox"]), textarea { width: 100%; padding: 11px 12px; color: var(--ink); background: #fbfdfd; border: 1px solid #dce7e5; border-radius: 4px; outline: 0; }
select:focus, input:not([type="checkbox"]):focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(24, 125, 120, .1); }
.toolbar select { width: 130px; }
.form-panel { margin-bottom: 22px; padding: 24px; background: var(--white); border: 1px solid #cfe2df; box-shadow: var(--shadow); }
.compact-panel { max-width: 900px; }
.form-panel-heading { display: flex; align-items: start; justify-content: space-between; margin-bottom: 22px; }
.form-panel h3 { font-size: 19px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-grid label { display: grid; gap: 8px; color: #647276; font-size: 12px; font-weight: 700; }
.form-grid textarea { resize: vertical; }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: end; gap: 10px; padding-top: 5px; }
.switch-label { display: flex !important; align-items: center; grid-auto-flow: column; grid-template-columns: auto 1fr; justify-content: start; align-content: center; padding-top: 25px; }
.switch-label input { width: 17px; height: 17px; accent-color: var(--teal); }
.notice { margin-bottom: 18px; padding: 12px; color: #8b691f; background: var(--yellow-pale); font-size: 12px; }
.code-tag { display: inline-block; padding: 4px 7px; color: var(--teal-dark); background: var(--teal-pale); border-radius: 3px; font-family: Consolas, monospace; font-size: 11px; }
.date-range { line-height: 1.7; color: #718086; font-size: 11px; }
.align-right { text-align: right; }
.actions { display: flex; align-items: center; justify-content: end; gap: 5px; }
.inline-form { display: inline; }
.icon-button { width: 30px; height: 30px; display: inline-grid; place-items: center; padding: 0; color: #75858a; background: transparent; border: 0; border-radius: 4px; cursor: pointer; }
.icon-button:hover { color: var(--teal); background: var(--teal-pale); }
.icon-button.danger:hover { color: var(--coral); background: var(--coral-pale); }
.empty-state { padding: 42px 20px; color: #91a0a3; text-align: center; }
.placement-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.placement-card { padding: 22px; background: white; border: 1px solid var(--line); box-shadow: var(--shadow); }
.placement-top, .placement-footer { display: flex; align-items: center; justify-content: space-between; }
.placement-symbol { width: 34px; height: 34px; display: grid; place-items: center; color: var(--teal); background: var(--teal-pale); font-size: 21px; }
.placement-card h3 { margin: 22px 0 10px; font-size: 17px; }
.placement-meta { display: flex; justify-content: space-between; margin: 28px 0 20px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.placement-meta strong { color: var(--ink); font-size: 12px; }
.placement-footer { color: var(--muted); font-size: 12px; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: #123e3d; }
.login-panel { width: min(420px, 100%); padding: 42px; background: white; box-shadow: 0 26px 80px rgba(4, 29, 30, .25); }
.login-panel .brand-mark { margin-bottom: 28px; }
.login-panel h1 { margin: 0; font-size: 28px; }
.login-copy { margin: 10px 0 28px; color: var(--muted); line-height: 1.7; }
.login-form { display: grid; gap: 16px; }
.login-form label { display: grid; gap: 8px; color: #68777a; font-size: 12px; font-weight: 700; }
.login-footnote { margin: 28px 0 0; color: #a1adaf; font-size: 11px; text-align: center; }

@media (max-width: 980px) {
    .sidebar { width: 208px; }
    .content, .topbar { padding-left: 28px; padding-right: 28px; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .placement-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
    .app-shell { display: block; }
    .sidebar { width: 100%; padding: 14px 14px 10px; }
    .sidebar-brand { padding: 0 4px 14px; }
    .nav-list { display: flex; overflow: auto; gap: 5px; }
    .nav-list a { flex: 0 0 auto; padding: 9px 11px; font-size: 12px; }
    .sidebar-bottom { display: none; }
    .topbar { height: auto; padding: 22px 18px; }
    .topbar h1 { font-size: 20px; }
    .account-chip { font-size: 0; }
    .content { padding: 28px 18px 50px; }
    .page-intro { align-items: start; flex-direction: column; }
    .page-intro h2 { font-size: 24px; }
    .metric-grid, .placement-grid { grid-template-columns: 1fr; }
    .toolbar { align-items: stretch; flex-wrap: wrap; }
    .search-box { width: 100%; }
    .toolbar select { flex: 1; }
    .form-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .switch-label { padding-top: 0; }
    .login-panel { padding: 30px 24px; }
}
