:root {
  --bg: #0a0f18;
  --sidebar: #0d1421;
  --panel: #111a2a;
  --panel-2: #0e1624;
  --border: #21304a;
  --border-soft: #19253a;
  --text: #e8eef8;
  --muted: #8090a8;
  --accent: #4c9aff;
  --accent-soft: #17345c;
  --ok: #46d19b;
  --warn: #f3b94b;
  --danger: #ff6b7a;
  --ink: #07111e;
  --radius: 12px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.ok { color: var(--ok); }
.bad { color: var(--danger); }
.spacer { flex: 1; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.2px; }
h3 { font-size: 14px; margin: 20px 0 10px; color: #c8d5e8; }
p { margin: 0; }

/* Login */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 20% -10%, rgba(76, 154, 255, .12), transparent 60%),
    radial-gradient(800px 500px at 110% 110%, rgba(70, 209, 155, .08), transparent 60%),
    var(--bg);
}
.login-card {
  width: 380px;
  max-width: 100%;
  padding: 36px;
  background: linear-gradient(180deg, #121c2e, #0e1624);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
}
.login-card h1 { font-size: 26px; margin-top: 14px; }
.login-card label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.login-card input {
  width: 100%;
  padding: 11px 12px;
  color: var(--text);
  background: #0a121e;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
}
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(76, 154, 255, .14); }
.error { min-height: 18px; color: var(--danger); font-size: 12px; }

.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: .3px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 14px rgba(70, 209, 155, .7); }

/* Shell */
.app { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 224px;
  flex: 0 0 224px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 24px 16px;
  background: var(--sidebar);
  border-right: 1px solid var(--border-soft);
}
.sidebar .brand { padding: 0 8px; font-size: 15px; }
.nav { display: grid; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  color: #9aabc2;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  text-align: left;
}
.nav-item:hover { background: #121d2f; color: var(--text); }
.nav-item.active {
  color: #dceaff;
  background: linear-gradient(90deg, #16345b, #12233b);
  border-color: #244672;
}
.nav-index { width: 20px; font-size: 10px; color: #5e7899; letter-spacing: .5px; }
.nav-item.active .nav-index { color: var(--accent); }
.sidebar-foot { margin-top: auto; display: grid; gap: 10px; padding: 0 8px; font-size: 12px; }

.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 82px;
  padding: 16px 28px;
  background: rgba(10, 15, 24, .88);
  border-bottom: 1px solid var(--border-soft);
  backdrop-filter: blur(8px);
}
.topbar h1 { font-size: 22px; }
.topbar p { margin-top: 3px; font-size: 12px; }
.content { flex: 1; overflow: auto; padding: 24px 28px 40px; }
.view { display: none; max-width: 1440px; margin: 0 auto; }
.view.active { display: block; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.card {
  padding: 18px;
  background: linear-gradient(180deg, #121c2e, #0e1624);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}
.card .label { color: var(--muted); font-size: 12px; }
.card .value { margin-top: 10px; font-size: 30px; font-weight: 700; letter-spacing: -1px; color: #f2f7ff; }
.hint-panel { margin-top: 18px; }
.hint-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; padding-top: 4px; }
.hint-grid div { display: grid; gap: 5px; }
.hint-grid b { font-size: 13px; color: #d4e2f5; }
.hint-grid span { color: var(--muted); font-size: 12px; line-height: 1.6; }

/* Panels / tables */
.panel {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { font-size: 16px; }
.panel-head p { margin-top: 3px; font-size: 12px; }
.panel-head .search { margin-top: 2px; }
.table-wrap { width: 100%; overflow: auto; border: 1px solid var(--border-soft); border-radius: 9px; }
table { width: 100%; border-collapse: collapse; min-width: 620px; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid #182337; vertical-align: top; }
th { color: #8fa3bd; background: #0d1625; font-size: 11px; font-weight: 600; letter-spacing: .3px; white-space: nowrap; }
td { font-size: 12.5px; color: #cbd8e9; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr[data-id] { cursor: pointer; }
tbody tr[data-id]:hover { background: #142138; }
.empty { text-align: center; color: var(--muted); padding: 32px 12px !important; }
.actions { white-space: nowrap; display: flex; flex-wrap: wrap; gap: 5px; }

/* Detail drawer */
.drawer-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(2, 7, 14, .62); backdrop-filter: blur(2px); }
.drawer {
  position: fixed;
  z-index: 50;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(760px, 92vw);
  display: flex;
  flex-direction: column;
  background: #0e1624;
  border-left: 1px solid var(--border);
  box-shadow: -24px 0 60px rgba(0, 0, 0, .45);
}
.drawer-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--border-soft);
}
.drawer-head h2 { font-size: 18px; word-break: break-all; }
.drawer-head .meta { margin-top: 10px; }
.drawer-body { flex: 1; overflow: auto; padding: 4px 24px 30px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: 12px; }
.meta b { color: #d8e5f5; font-weight: 600; }

/* Controls */
button { border: 0; border-radius: 8px; padding: 9px 14px; color: var(--text); background: #18253a; transition: .15s; }
button:hover { filter: brightness(1.12); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { color: var(--ink); background: var(--accent); font-weight: 650; }
button.ghost { color: #b7c7dc; background: transparent; border: 1px solid var(--border); }
button.small { padding: 7px 11px; font-size: 12px; }
button.tiny { padding: 4px 8px; font-size: 11px; }
button.danger { color: var(--danger); border-color: rgba(255, 107, 122, .3); background: rgba(255, 107, 122, .06); }
input, select {
  min-width: 0;
  padding: 9px 11px;
  color: var(--text);
  background: #0a121e;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(76, 154, 255, .12); }
.search { width: 280px; max-width: 100%; }

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 7, 14, .7);
  backdrop-filter: blur(3px);
}
.modal-card {
  width: 460px;
  max-width: 100%;
  max-height: 92vh;
  overflow: auto;
  padding: 24px;
  background: linear-gradient(180deg, #142034, #0f1827);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.modal-card h3 { margin-top: 0; font-size: 18px; }
.modal-card > .muted { margin: 7px 0 18px; font-size: 12px; }
.modal-field { display: grid; gap: 6px; margin-bottom: 13px; color: #a9bbd1; font-size: 12px; }
.modal-field input { width: 100%; }
.modal-row { display: flex; gap: 8px; align-items: center; }
.modal-row input { flex: 1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
#create-user-msg, #password-modal-msg { min-height: 18px; margin-top: 6px; font-size: 12px; word-break: break-all; }

/* Logs */
#logs-body details summary { cursor: pointer; color: #b9cae0; }
#logs-body pre {
  max-width: 720px;
  max-height: 300px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 10px;
  white-space: pre-wrap;
  color: #9fb2ca;
  background: #09111d;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  font-size: 11px;
}
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; color: #a9c7ff; }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  max-width: 420px;
  padding: 12px 16px;
  background: #17263c;
  border: 1px solid #2c496f;
  border-radius: 9px;
  box-shadow: var(--shadow);
  font-size: 13px;
}

/* Responsive */
@media (max-width: 1180px) {
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hint-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .app { flex-direction: column; height: auto; min-height: 100vh; overflow: visible; }
  .sidebar { width: 100%; flex: none; padding: 14px 14px 10px; gap: 12px; }
  .sidebar .brand { padding: 0 4px; }
  .nav { display: flex; overflow-x: auto; gap: 6px; }
  .nav-item { width: auto; white-space: nowrap; padding: 8px 10px; }
  .nav-index { display: none; }
  .sidebar-foot { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
  .workspace { overflow: visible; }
  .content { overflow: visible; padding: 16px; }
  .topbar { padding: 14px 16px; min-height: 0; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hint-grid { grid-template-columns: 1fr; }
  .panel { padding: 15px; }
  .search { width: 100%; }
  .drawer { width: 100vw; }
}

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin: 1px 4px 1px 0;
  padding: 3px 7px;
  color: #b9d4ff;
  background: #132b49;
  border: 1px solid #264a76;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.5;
}
.account-chip span { color: #7f9cbd; }
.account-chip:hover { background: #1b3b63; }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: #d8e8ff; }
th[data-sort][data-direction="asc"]::after { content: " ↑"; color: var(--accent); }
th[data-sort][data-direction="desc"]::after { content: " ↓"; color: var(--accent); }
#daily-summary { margin: 0 0 10px; }
.drawer-tabs { display: flex; gap: 6px; margin: 18px 0 12px; border-bottom: 1px solid var(--border-soft); }
.drawer-tab { padding: 8px 12px; color: var(--muted); background: transparent; border-radius: 8px 8px 0 0; border-bottom: 2px solid transparent; }
.drawer-tab.active { color: #dceaff; background: #13233a; border-bottom-color: var(--accent); }
.permission-note { margin: 0 0 10px; font-size: 12px; }

/* Statistics center */
.stats-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.segmented { display: inline-flex; padding: 3px; background: #0d1727; border: 1px solid var(--border-soft); border-radius: 9px; }
.segmented button { padding: 6px 10px; color: var(--muted); background: transparent; border-radius: 6px; font-size: 12px; }
.segmented button.active { color: #dceaff; background: #1a3455; }
.stats-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.chart-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 16px; margin: 16px 0; }
.chart-panel { min-width: 0; }
.chart-svg { width: 100%; height: auto; display: block; min-height: 260px; }
.chart-legend { display: flex; gap: 18px; padding: 4px 0 0 46px; color: var(--muted); font-size: 11px; }
.dot-line { display: inline-block; width: 14px; height: 2px; margin-right: 5px; vertical-align: middle; border-radius: 2px; }
.dot-line.request { background: #4c9aff; }
.dot-line.key { background: #f3b94b; }
.dot-line.contact { background: #46d19b; }
.account-bars { display: grid; gap: 14px; }
.account-bar-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: #d4e2f5; }
.account-bar-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-bar-head b { color: #f2f7ff; }
.account-bar-track { height: 6px; margin-top: 6px; overflow: hidden; background: #0a121e; border-radius: 5px; }
.account-bar-track i { display: block; height: 100%; min-width: 2px; border-radius: 5px; background: linear-gradient(90deg, #2f6fbe, #4c9aff); }
.account-bar-sub { margin-top: 3px; color: var(--muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1000px) {
  .chart-grid { grid-template-columns: 1fr; }
  .stats-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-toolbar { flex-wrap: wrap; }
}
.account-name {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0;
  color: #dceaff;
  background: transparent;
  text-align: left;
}
.account-name:hover { color: var(--accent); text-decoration: underline; }

/* Theme toggle */
.theme-toggle { width: auto; align-self: flex-start; padding: 5px 9px; color: var(--muted); background: transparent; border: 1px solid var(--border); border-radius: 7px; font-size: 11px; }
.theme-toggle:hover { color: var(--text); }

/* Light theme */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f6fb;
  --sidebar: #ffffff;
  --panel: #ffffff;
  --panel-2: #f7f9fc;
  --border: #d5dfec;
  --border-soft: #e5ebf3;
  --text: #17263a;
  --muted: #66768b;
  --accent: #1e6fc4;
  --accent-soft: #e5f1ff;
  --ok: #17835b;
  --warn: #a66b10;
  --danger: #c33d4e;
  --ink: #ffffff;
  --shadow: 0 14px 38px rgba(28, 50, 78, .12);
}
html[data-theme="light"] body { background: var(--bg); color: var(--text); }
html[data-theme="light"] .login-wrap {
  background:
    radial-gradient(900px 500px at 20% -10%, rgba(30, 111, 196, .12), transparent 60%),
    radial-gradient(800px 500px at 110% 110%, rgba(23, 131, 91, .08), transparent 60%),
    var(--bg);
}
html[data-theme="light"] .login-card,
html[data-theme="light"] .card {
  background: linear-gradient(180deg, #ffffff, #f7faff);
  border-color: var(--border);
}
html[data-theme="light"] .login-card input,
html[data-theme="light"] input,
html[data-theme="light"] select { background: #ffffff; color: var(--text); }
html[data-theme="light"] .sidebar { background: var(--sidebar); }
html[data-theme="light"] .nav-item { color: #5f7188; }
html[data-theme="light"] .nav-item:hover { background: #eef4fb; color: var(--text); }
html[data-theme="light"] .nav-item.active { color: #164f8d; background: #e7f1fe; border-color: #b9d7f5; }
html[data-theme="light"] .nav-index { color: #8aa0b8; }
html[data-theme="light"] .nav-item.active .nav-index { color: var(--accent); }
html[data-theme="light"] .topbar { background: rgba(255, 255, 255, .88); border-color: var(--border-soft); }
html[data-theme="light"] .card .value { color: #14263b; }
html[data-theme="light"] .hint-grid b { color: #2a405b; }
html[data-theme="light"] .panel { background: var(--panel); }
html[data-theme="light"] th { color: #60738a; background: #f0f5fb; }
html[data-theme="light"] td { color: #2a3d54; }
html[data-theme="light"] tbody tr[data-id]:hover { background: #eef5fd; }
html[data-theme="light"] .drawer { background: #ffffff; }
html[data-theme="light"] .drawer-backdrop { background: rgba(24, 42, 64, .35); }
html[data-theme="light"] .meta b { color: #233b55; }
html[data-theme="light"] button { color: #263c55; background: #edf3fa; }
html[data-theme="light"] button.ghost { color: #526880; background: transparent; }
html[data-theme="light"] button.primary { color: #ffffff; background: var(--accent); }
html[data-theme="light"] button.danger { background: #fff2f3; }
html[data-theme="light"] .modal { background: rgba(24, 42, 64, .38); }
html[data-theme="light"] .modal-card {
  background: #ffffff;
  border-color: var(--border);
}
html[data-theme="light"] .modal-field { color: #536b84; }
html[data-theme="light"] #logs-body pre { color: #3c5269; background: #f6f9fd; }
html[data-theme="light"] #logs-body details summary { color: #34516f; }
html[data-theme="light"] code { color: #1e5f9e; }
html[data-theme="light"] .toast { color: #243d58; background: #ffffff; border-color: var(--border); }
html[data-theme="light"] .account-chip { color: #1c5b96; background: #e8f3ff; border-color: #bdd9f5; }
html[data-theme="light"] .account-chip span { color: #68839d; }
html[data-theme="light"] .account-chip:hover { background: #dceeff; }
html[data-theme="light"] th[data-sort]:hover { color: var(--accent); }
html[data-theme="light"] .drawer-tab.active { color: #1a5188; background: #eaf4ff; }
html[data-theme="light"] .segmented { background: #f0f5fb; }
html[data-theme="light"] .segmented button.active { color: #1b558e; background: #dceeff; }
html[data-theme="light"] .account-bar-head { color: #2c425b; }
html[data-theme="light"] .account-bar-head b { color: #14263b; }
html[data-theme="light"] .account-bar-track { background: #e5edf6; }
html[data-theme="light"] .account-name { color: #1d4f83; }
html[data-theme="light"] .account-name:hover { color: var(--accent); }
html[data-theme="light"] .dot-line.request { background: #2678d7; }
html[data-theme="light"] .dot-line.key { background: #c78a18; }
html[data-theme="light"] .dot-line.contact { background: #15926a; }
html[data-theme="light"] h3 { color: #314b67; }
html[data-theme="light"] .theme-toggle { color: #5b7088; }
html[data-theme="light"] .nav-item {
  background: transparent !important;
  border-color: transparent;
  color: #52677f;
}
html[data-theme="light"] .nav-item:hover {
  background: #eef4fb !important;
  color: var(--text);
}
html[data-theme="light"] .nav-item.active {
  background: #e7f1fe !important;
  border-color: #b9d7f5 !important;
  color: #164f8d;
}
.stats-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1180px) {
  .stats-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .stats-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.chart-tooltip {
  position: fixed;
  z-index: 80;
  min-width: 170px;
  padding: 10px 12px;
  pointer-events: none;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: var(--shadow);
  font-size: 12px;
  line-height: 1.8;
}
.chart-tooltip-title { margin-bottom: 3px; color: var(--muted); font-size: 11px; }
.chart-tooltip b { float: right; color: var(--text); margin-left: 20px; }
.chart-tooltip .dot-line { margin-right: 6px; }
.drawer-head > div { flex: 1; min-width: 0; }
.drawer-head button { flex-shrink: 0; white-space: nowrap; }
.stat-summary-row { cursor: pointer; }
.stat-summary-row:hover { background: #142138; }
html[data-theme="light"] .stat-summary-row:hover { background: #eef5fd; }
.stat-expand { display: inline-block; width: 16px; color: var(--muted); transition: transform .15s; }
.stat-detail-row > td { padding: 0 !important; background: var(--panel-2); }
.stat-detail-loading, .stat-detail-empty { padding: 16px 18px; color: var(--muted); font-size: 12px; }
.stat-detail-panel { display: grid; gap: 18px; padding: 16px 18px 20px; }
.stat-detail-section h4 { margin: 0 0 8px; color: var(--text); font-size: 13px; }
.stat-detail-section h4 span { margin-left: 6px; color: var(--muted); font-weight: 400; }
.stat-detail-section table { min-width: 0; }
.stat-detail-section th, .stat-detail-section td { padding: 7px 9px; font-size: 11.5px; }
.theme-toggle { align-self: auto; }
.login-card .theme-toggle { align-self: flex-start; }
.topbar .theme-toggle { display: inline-flex; align-items: center; justify-content: center; height: 32px; padding: 0 10px; }
.release-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.release-form input:not([type=file]) { min-width: 150px; }
.release-form input[type=file] { max-width: 260px; }
.release-form .check { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; }
/* Release publisher */
.release-grid {
  display: grid;
  grid-template-columns: 140px 120px minmax(220px, 1fr) 130px 110px 250px;
  gap: 14px;
  align-items: end;
}
.release-grid .field { display: grid; gap: 7px; min-width: 0; }
.release-grid .field > span { color: var(--muted); font-size: 11px; }
.release-grid .field input,
.release-grid .field select { width: 100%; min-width: 0; }
.release-grid .field-file input { width: 100%; }
.release-actions { display: flex; align-items: center; gap: 16px; margin-top: 16px; flex-wrap: wrap; }
.release-actions .check { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.release-actions #release-status { margin-left: auto; font-size: 11px; }
.release-actions-cell { display: flex; gap: 6px; white-space: nowrap; }
.status-pill { display: inline-flex; padding: 2px 7px; border-radius: 20px; color: var(--muted); background: var(--panel-2); font-size: 10px; }
.status-pill.ok { color: var(--ok); background: rgba(23, 131, 91, .1); }
@media (max-width: 1100px) {
  .release-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .release-grid .field-wide, .release-grid .field-file { grid-column: span 2; }
  .release-actions #release-status { margin-left: 0; flex-basis: 100%; }
}
.release-grid input[type=file]::file-selector-button {
  margin-right: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  background: var(--panel-2);
  cursor: pointer;
}
/* Release form v2 */
.release-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px 18px;
  align-items: end;
}
.release-grid .field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.release-grid .field > span:first-child { color: var(--muted); font-size: 11px; line-height: 1; }
.field-version { grid-column: span 3; }
.field-channel { grid-column: span 2; }
.field-min { grid-column: span 3; }
.field-rollout { grid-column: span 2; }
.field-notes { grid-column: span 8; }
.field-file { grid-column: span 4; }
.release-grid input,
.release-grid select {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel);
  font: inherit;
  font-size: 12.5px;
  outline: none;
}
.release-grid input:focus, .release-grid select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(30,111,196,.12); }
.input-suffix { position: relative; display: block; }
.input-suffix input { padding-right: 30px; }
.input-suffix b { position: absolute; right: 11px; top: 10px; color: var(--muted); font-size: 12px; font-weight: 500; }
.release-grid input[type=number] { -moz-appearance: textfield; }
.release-grid input[type=number]::-webkit-inner-spin-button { opacity: .55; }
.file-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  height: 38px;
  padding: 4px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  cursor: pointer;
  background: var(--panel-2);
}
.file-picker:hover { border-color: var(--accent); }
.file-picker input { display: none; }
.file-picker-button {
  flex-shrink: 0;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  background: var(--panel);
  font-size: 11px;
}
.file-picker-name { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.release-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}
.release-checks { display: flex; gap: 18px; }
.release-actions .check { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.release-actions .check input { width: 15px; height: 15px; accent-color: var(--accent); }
.release-actions #release-status { flex: 1; min-width: 0; font-size: 11px; text-align: right; }
.release-actions #release-upload { height: 38px; padding: 0 18px; }
@media (max-width: 1100px) {
  .field-version, .field-channel, .field-min, .field-rollout { grid-column: span 6; }
  .field-notes, .field-file { grid-column: span 12; }
  .release-actions { flex-wrap: wrap; }
  .release-actions #release-status { flex-basis: 100%; text-align: left; }
}
.release-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.release-tools .check { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.version-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.version-chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 7px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); }
.version-chip b { font-size: 13px; color: var(--text); }
.version-chip em { font-style: normal; font-size: 11px; color: var(--muted); }
.brand-icon-preview { width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 8px; object-fit: contain; background: var(--panel); }
.nav-context { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 11px; color: var(--muted); }
.nav-context.hidden { display: none; }
.link-button { padding: 0; border: 0; background: transparent; color: var(--accent); font: inherit; cursor: pointer; text-align: left; }
.link-button:hover { text-decoration: underline; }
.row-highlight { outline: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.global-search { position: relative; width: min(360px, 30vw); }
.global-search input { width: 100%; height: 34px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); padding: 0 10px; font: inherit; font-size: 12px; outline: none; }
.global-search input:focus { border-color: var(--accent); }
.global-search-results { position: absolute; z-index: 30; top: 40px; left: 0; right: 0; max-height: 420px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); box-shadow: 0 12px 32px rgba(0,0,0,.28); padding: 6px; }
.global-search-results.hidden { display: none; }
.global-search-group { padding: 4px 8px; font-size: 10px; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.global-search-result { display: block; width: 100%; border: 0; border-radius: 7px; background: transparent; color: var(--text); text-align: left; padding: 8px; cursor: pointer; }
.global-search-result:hover, .global-search-result.active { background: var(--bg); }
.global-search-result strong { display: block; font-size: 12px; font-weight: 600; }
.global-search-result span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.global-search-empty { padding: 12px; color: var(--muted); font-size: 12px; }


/* Overview data panels */
.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr);
  gap: 16px;
  margin-top: 16px;
}
@media (max-width: 900px) {
  .overview-grid { grid-template-columns: 1fr; }
}
.overview-trend {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 170px;
  padding: 12px 4px 0;
}
.overview-trend .trend-item {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  justify-content: flex-end;
}
.overview-trend .trend-bar {
  width: 100%;
  max-width: 38px;
  border-radius: 4px 4px 0 0;
  background: var(--accent, #4c9aff);
  min-height: 2px;
  opacity: .85;
}
.overview-trend .trend-value { font-size: 11px; color: var(--muted, #6f849e); }
.overview-trend .trend-day { font-size: 11px; color: var(--muted, #6f849e); white-space: nowrap; }
.overview-list { display: flex; flex-direction: column; gap: 2px; }
.overview-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border, #1c2a40);
}
.overview-list > div:last-child { border-bottom: 0; }
.overview-list span { color: var(--muted, #6f849e); font-size: 12px; }
.overview-list b { font-size: 16px; }


/* TOTP setup */
.totp-codes {
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.8;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-soft, rgba(255,255,255,.03));
}
.ok { color: var(--success, #46d19b); }

.status-pill.warn { color: var(--warn); background: rgba(255, 179, 71, .12); }
.status-pill.danger { color: var(--danger); background: rgba(255, 107, 122, .1); }
