:root { --green: #16a34a; --green-dark: #15803d; --soft: #dcfce7; --ink: #0f172a; --muted: #64748b; --line: #e2e8f0; --bg: #f1f5f9; --red: #dc2626; --orange: #d97706; }
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.5; font-size: 14.5px; }
a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.3; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
code, .code { font-family: Consolas, "Courier New", monospace; font-size: 13px; }

.shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.nav-side { background: #0b1220; color: #cbd5e1; padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { color: #fff; font-weight: 800; font-size: 19px; display: block; padding: 4px 10px 16px; }
.brand:hover { text-decoration: none; }
.brand small { display: block; color: #86efac; font-size: 12px; font-weight: 500; }
.nav-side nav { display: grid; gap: 2px; }
.nav-side nav a { color: #cbd5e1; padding: 8px 10px; border-radius: 10px; display: flex; align-items: center; gap: 9px; }
.nav-side nav a span { width: 22px; text-align: center; }
.nav-side nav a:hover, .nav-side nav a.on { background: #1e293b; color: #fff; text-decoration: none; }
.badge { margin-left: auto; background: #f59e0b; color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 8px; }
.badge.red { background: var(--red); }
.side-foot { margin-top: auto; display: grid; gap: 2px; padding-top: 16px; border-top: 1px solid #1e293b; }
.side-foot a { color: #94a3b8; padding: 6px 10px; }

.content { padding: 20px 26px 60px; min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.top h1 { margin: 0; font-size: 23px; }
.menu-toggle { display: none; background: #fff; border: 1px solid var(--line); border-radius: 10px; font-size: 20px; padding: 2px 10px; cursor: pointer; }

.flash { border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; background: var(--soft); color: #14532d; }
.flash.err { background: #fee2e2; color: #991b1b; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; min-height: 40px; text-decoration: none !important; }
.btn:hover { border-color: var(--green); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-dark); }
.btn.danger { color: var(--red); }
.btn.big { min-height: 46px; font-size: 15.5px; width: 100%; }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.link { background: none; border: 0; color: var(--green-dark); cursor: pointer; font: inherit; padding: 0; }
.link.danger, .danger-text { color: var(--red); }
form.inline { display: inline; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: block; color: var(--ink); }
.stat b { display: block; font-size: 28px; line-height: 1.2; }
.stat span { color: var(--muted); }
.stat small { display: block; color: var(--muted); font-size: 12px; }
.stat.big { background: linear-gradient(135deg, #14532d, #16a34a); color: #fff; border: 0; }
.stat.big span, .stat.big small { color: #bbf7d0; }
.stat.link:hover { border-color: var(--green); text-decoration: none; }
.stat.warn b { color: #b45309; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin-bottom: 16px; min-width: 0; }
.panel h2 { margin: 0 0 12px; font-size: 17px; }
.panel h2:not(:first-child) { margin-top: 22px; }
.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.more { display: inline-block; margin-top: 8px; }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 10px; }
.bar { flex: 1; height: 100%; position: relative; display: flex; align-items: flex-end; justify-content: center; }
.bar i, .bar em { position: absolute; bottom: 20px; width: 70%; border-radius: 6px 6px 0 0; max-height: calc(100% - 20px); }
.bar i { background: #bbf7d0; }
.bar em { background: var(--green); width: 40%; }
.bar small { position: absolute; bottom: 0; font-size: 11px; color: var(--muted); }
.legend { font-size: 13px; color: var(--muted); }
.legend span { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; margin: 0 4px 0 10px; }
.legend .k1 { background: #bbf7d0; } .legend .k2 { background: var(--green); }

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 10px 12px; background: #f8fafc; white-space: nowrap; text-transform: uppercase; letter-spacing: .03em; }
.table td { padding: 9px 12px; border-top: 1px solid #f1f5f9; vertical-align: middle; }
.table tr:hover td { background: #f8fafc; }
.actions { white-space: nowrap; }
.actions a, .actions .link { margin-right: 10px; }
.mini { width: 100%; border-collapse: collapse; }
.mini td { padding: 7px 6px; border-bottom: 1px solid #f1f5f9; }
.mini td:last-child { text-align: right; font-weight: 600; }
.bars-h .w { width: 45%; }
.bars-h .w span { display: block; height: 10px; border-radius: 6px; background: var(--green); }
.av { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; object-fit: cover; vertical-align: middle; line-height: 1; }
.av.xl { width: 72px; height: 72px; font-size: 24px; }
.pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; }
.pill.ok { background: var(--soft); color: #14532d; }
.pill.wait { background: #fef3c7; color: #92400e; }
.pill.no { background: #fee2e2; color: #991b1b; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.tabs a { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 5px 14px; color: var(--ink); }
.tabs a.on { background: var(--green); color: #fff; border-color: var(--green); }
.tabs a:hover { text-decoration: none; border-color: var(--green); }
.tabs b { font-size: 12px; opacity: .75; }
.filters, .bulk, .inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 12px; }
.bulk span { color: var(--muted); }
.pager { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 12px; }
.pager a { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 4px 12px; }
.pager a.on { background: var(--green); color: #fff; }

label, .label { display: grid; gap: 4px; margin: 0 0 14px; font-weight: 600; }
label small, .label small { font-weight: 400; color: var(--muted); font-size: 12.5px; }
small.len { color: #0369a1; font-weight: 500; }
input, select, textarea { font: inherit; font-weight: 400; border: 1px solid #cbd5e1; border-radius: 10px; padding: 9px 11px; width: 100%; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid #86efac; border-color: var(--green); }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--green); flex: none; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.big-check { align-items: flex-start !important; background: #f8fafc; border-radius: 12px; padding: 12px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
/* the one-click main switch on Live & Score */
.master-switch { display: grid; grid-template-columns: 1fr minmax(180px, 240px); gap: 14px; align-items: center; margin-bottom: 14px; border-left: 6px solid var(--green); }
.master-switch.off { border-left-color: #94a3b8; }
.master-switch h2 { margin: 0 0 4px; }
.master-switch p { margin: 0; }
.master-switch .btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
@media (max-width: 700px) { .master-switch { grid-template-columns: 1fr; } }
.counter { font-size: 12.5px; font-weight: 600; margin-top: -2px; }
.counter.good { color: var(--green-dark); }
.counter.short { color: var(--orange); }
.counter.over { color: var(--red); }
.filters input, .filters select, .inline-form input, .inline-form select { width: auto; min-width: 190px; }
.inline-form label { margin: 0; }

.edit-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.side-panel { position: sticky; top: 16px; display: grid; gap: 4px; }
.head-row { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.seo-box { border: 1px dashed #86efac; border-radius: 12px; padding: 10px 16px 2px; margin: 18px 0 0; }
.seo-box legend { padding: 0 6px; font-weight: 700; }
.thumb-prev { width: 100%; border-radius: 10px; margin-bottom: 6px; }
.hint { background: #f8fafc; border-radius: 12px; padding: 6px 16px; font-size: 13.5px; margin-top: 10px; }
.hint h3 { font-size: 14.5px; margin: 8px 0 4px; }
.hint code { word-break: break-all; }
.narrow-form { max-width: 760px; }
.add-box summary { cursor: pointer; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; margin-top: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.preview { display: flex; gap: 10px; align-items: center; background: var(--soft); border-radius: 12px; padding: 8px; margin-bottom: 14px; }
.preview img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: #fff; }
.preview small { display: block; color: #166534; }

.editor { border: 1px solid #cbd5e1; border-radius: 12px; overflow: hidden; margin-bottom: 14px; background: #fff; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px; background: #f8fafc; border-bottom: 1px solid var(--line); }
.toolbar button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 4px 10px; cursor: pointer; font: inherit; font-size: 13px; }
.toolbar button:hover, .toolbar button.on { border-color: var(--green); }
.words { margin-left: auto; font-size: 12.5px; color: var(--muted); padding-right: 6px; }
.area { min-height: 380px; padding: 16px 18px; outline: none; line-height: 1.7; font-size: 15.5px; }
.area h2 { font-size: 22px; } .area h3 { font-size: 18px; }
.area img { max-width: 100%; }
.html-area { min-height: 380px; border: 0; border-radius: 0; font-family: Consolas, monospace; font-size: 13px; }

.picker { border: 1px solid #bbf7d0; background: #f0fdf4; border-radius: 12px; padding: 10px 16px 14px; margin: 16px 0; }
.picker legend { font-weight: 700; padding: 0 6px; }
.picker-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.picker-bar select, .picker-bar input { width: auto; flex: 1; min-width: 160px; }
.picker-list { max-height: 320px; overflow-y: auto; }
.picker-list td { padding: 6px 10px; }
.picker h4 { margin: 12px 0 6px; }
.chosen { margin: 0; padding-left: 22px; }
.chosen li { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; margin-bottom: 5px; display: flex; align-items: center; gap: 8px; }
.chosen li span { flex: 1; }
.chosen li small { color: var(--muted); }
.chosen button { border: 0; background: #f1f5f9; border-radius: 6px; cursor: pointer; padding: 2px 8px; }

.auth { display: grid; place-items: center; min-height: 100vh; padding: 16px; background: linear-gradient(135deg, #052e16, #166534); }
.auth-card { background: #fff; border-radius: 18px; padding: 28px; width: 100%; max-width: 400px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.auth-card.wide { max-width: 640px; }
.auth-card h1 { margin: 0 0 4px; font-size: 24px; }
.auth-card h3 { margin: 18px 0 8px; color: var(--green-dark); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .nav-side { position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  .nav-side.open { transform: none; box-shadow: 10px 0 30px rgba(0,0,0,.3); }
  .menu-toggle { display: block; }
  .content { padding: 12px; }
  .edit-grid, .form-grid, .two { grid-template-columns: 1fr; }
  .side-panel { position: static; }
  .panel-grid { grid-template-columns: 1fr; }
}
