:root {
  color-scheme: dark;
  --bg: #071019;
  --panel: rgba(16, 28, 39, .92);
  --panel-strong: #101c27;
  --panel-soft: #0b1721;
  --text: #f4f7fa;
  --muted: #91a5b5;
  --line: #263946;
  --accent: #ff5d55;
  --accent-soft: rgba(255, 93, 85, .13);
  --cyan: #59d6d0;
  --green: #5de29c;
  --yellow: #ffc857;
  --shadow: 0 24px 80px rgba(0, 0, 0, .32);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; line-height: 1.55; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.ambient { position: fixed; z-index: 0; border-radius: 999px; filter: blur(80px); opacity: .18; pointer-events: none; }
.ambient-one { width: 420px; height: 420px; right: -120px; top: -100px; background: #287eb1; }
.ambient-two { width: 360px; height: 360px; left: 18%; bottom: -220px; background: #ff5d55; }

.login-shell { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 32px 18px; }
.login-card { width: min(460px, 100%); padding: 42px; border: 1px solid var(--line); border-radius: 30px; background: linear-gradient(150deg, rgba(17, 31, 43, .98), rgba(8, 18, 27, .98)); box-shadow: var(--shadow); }
.brand-mark { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 18px; background: linear-gradient(135deg, var(--accent), #ff914d); color: white; font-weight: 950; font-size: 28px; box-shadow: 0 12px 32px rgba(255, 93, 85, .28); }
.brand-mark.small { width: 42px; height: 42px; border-radius: 13px; font-size: 20px; }
.eyebrow { margin: 22px 0 5px; color: var(--cyan); font-size: 11px; font-weight: 900; letter-spacing: .18em; }
.login-card h1 { margin: 0 0 10px; font-size: 38px; letter-spacing: -.04em; }
.muted { color: var(--muted); }
.form-stack { display: grid; gap: 10px; margin-top: 26px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .wide { grid-column: 1 / -1; }
label { display: grid; gap: 7px; color: #dce7ee; font-size: 13px; font-weight: 750; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 13px; color: var(--text); background: #07131d; padding: 12px 14px; outline: none; transition: border-color .18s, box-shadow .18s; }
input:focus, textarea:focus, select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(89, 214, 208, .11); }
textarea { resize: vertical; min-height: 110px; }
input[type="file"] { padding: 10px; }
input[type="file"]::file-selector-button { margin-right: 12px; border: 0; border-radius: 9px; padding: 8px 12px; background: #1c3343; color: var(--text); }

.button { border: 1px solid transparent; border-radius: 12px; padding: 11px 17px; color: white; background: #1c3343; font-weight: 850; }
.button:hover { filter: brightness(1.08); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.primary { background: linear-gradient(135deg, var(--accent), #ff764c); box-shadow: 0 12px 26px rgba(255, 93, 85, .2); }
.button.ghost { border-color: var(--line); background: transparent; }
.button.danger { background: var(--accent); }
.button.compact { padding: 9px 14px; }
.message { min-height: 24px; margin: 18px 0 0; color: var(--yellow); font-size: 13px; }
.message.error, .global-message.error { color: #ff8f8a; }
.message.success, .global-message.success { color: var(--green); }
.security-note { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; display: flex; gap: 8px; align-items: center; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(93, 226, 156, .1); }

.app-shell { position: relative; z-index: 1; min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 18px; border-right: 1px solid var(--line); background: rgba(7, 16, 25, .94); backdrop-filter: blur(18px); }
.sidebar-brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 24px; }
.sidebar-brand strong, .sidebar-brand span { display: block; }
.sidebar-brand strong { letter-spacing: .16em; }
.sidebar-brand span { color: var(--muted); font-size: 12px; }
nav { display: grid; gap: 6px; }
.nav-item { width: 100%; display: flex; gap: 12px; align-items: center; border: 0; border-radius: 12px; padding: 12px 14px; color: var(--muted); background: transparent; text-align: left; font-weight: 750; }
.nav-item span { width: 20px; color: #6e899c; font-size: 18px; }
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, .035); }
.nav-item.active { color: white; background: var(--accent-soft); }
.nav-item.active span { color: var(--accent); }
.sidebar-footer { margin-top: auto; display: grid; gap: 8px; padding: 18px 10px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.sidebar-footer a { color: var(--muted); text-decoration: none; }

.workspace { min-width: 0; padding: 0 30px 60px; }
.topbar { min-height: 102px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid rgba(38, 57, 70, .55); }
.topbar .eyebrow { margin: 0; }
.topbar h1 { margin: 2px 0 0; font-size: 28px; letter-spacing: -.03em; }
.topbar-actions { display: flex; gap: 14px; align-items: center; }
.live-status { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; color: var(--muted); font-size: 12px; }
.admin-identity { display: grid; text-align: right; font-size: 12px; }
.admin-identity small { color: var(--muted); }
.icon-button, .text-button { border: 0; color: var(--muted); background: transparent; font-weight: 750; }
.icon-button { border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; }
.text-button:hover, .icon-button:hover { color: white; }
.global-message { margin: 18px 0 -4px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-soft); color: var(--yellow); }

.panel { display: none; padding-top: 26px; }
.panel.active { display: block; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card { position: relative; overflow: hidden; min-height: 142px; padding: 20px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); }
.metric-card::after { content: ""; position: absolute; right: -28px; bottom: -52px; width: 120px; height: 120px; border-radius: 50%; background: var(--metric-color, var(--cyan)); opacity: .08; }
.metric-label { color: var(--muted); font-size: 12px; }
.metric-value { margin: 8px 0 0; font-size: 34px; font-weight: 900; letter-spacing: -.04em; }
.metric-note { color: var(--muted); font-size: 11px; }
.two-column { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.release-layout { align-items: start; }
.surface { border: 1px solid var(--line); border-radius: 20px; padding: 22px; background: var(--panel); box-shadow: 0 16px 48px rgba(0, 0, 0, .12); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.section-heading.wrap { flex-wrap: wrap; }
.section-heading .eyebrow { margin: 0 0 3px; }
.section-heading h2 { margin: 0; font-size: 19px; }
.section-heading p { margin: 5px 0 0; font-size: 12px; }
.detail-list { display: grid; gap: 2px; }
.detail-row { display: grid; grid-template-columns: minmax(110px, .8fr) minmax(0, 1.2fr); gap: 16px; padding: 11px 0; border-bottom: 1px solid rgba(38, 57, 70, .65); }
.detail-row:last-child { border-bottom: 0; }
.detail-row span { color: var(--muted); font-size: 12px; }
.detail-row strong { min-width: 0; text-align: right; overflow-wrap: anywhere; font-size: 13px; }
.hash-badge, .status-badge { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; color: var(--muted); font-family: ui-monospace, monospace; font-size: 10px; }
.status-badge.good { color: var(--green); border-color: rgba(93, 226, 156, .35); }
.action-row { display: flex; justify-content: flex-end; gap: 10px; }
.warning-copy { margin: 16px 0 0; padding: 11px 13px; border-left: 3px solid var(--yellow); background: rgba(255, 200, 87, .06); color: var(--muted); font-size: 11px; }
.divider { height: 1px; margin: 22px 0; background: var(--line); }

.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { min-width: 240px; }
.table-wrap { overflow-x: auto; border: 1px solid rgba(38, 57, 70, .65); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 13px 14px; border-bottom: 1px solid rgba(38, 57, 70, .55); text-align: left; vertical-align: top; }
th { color: var(--muted); background: rgba(7, 19, 29, .75); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
td small { display: block; color: var(--muted); }
.table-action { border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; color: var(--text); background: transparent; font-size: 11px; }
.table-action:disabled { opacity: .35; cursor: not-allowed; }
.badge { display: inline-flex; border-radius: 999px; padding: 4px 8px; color: var(--muted); background: #162633; font-size: 10px; }
.badge.owner { color: #ffd28e; background: rgba(255, 200, 87, .1); }
.empty { padding: 44px 16px; text-align: center; color: var(--muted); }

.timeline { display: grid; gap: 0; }
.timeline-item { position: relative; padding: 0 0 20px 23px; border-left: 1px solid var(--line); }
.timeline-item::before { content: ""; position: absolute; left: -5px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 4px rgba(89, 214, 208, .08); }
.timeline-item:last-child { border-left-color: transparent; }
.timeline-item strong { display: block; }
.timeline-item span { color: var(--muted); font-size: 11px; }
.progress-wrap { display: flex; gap: 10px; align-items: center; margin: 14px 0; color: var(--muted); font-size: 11px; }
.progress-track { flex: 1; height: 7px; overflow: hidden; border-radius: 99px; background: #08131d; }
.progress-bar { width: 0; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--green)); transition: width .2s; }

.ticket-list { display: grid; gap: 12px; }
.ticket { display: grid; grid-template-columns: minmax(0, 1fr) 160px; gap: 18px; padding: 17px; border: 1px solid rgba(38, 57, 70, .65); border-radius: 15px; background: rgba(7, 19, 29, .55); }
.ticket p { margin: 7px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.ticket-meta { color: var(--muted); font-size: 11px; }
.ticket select { align-self: start; }
.feedback-facts { display: grid; gap: 4px; margin-top: 12px; color: var(--muted); font-size: 11px; }
.feedback-facts a { color: var(--cyan); text-decoration: none; }
.road-feedback details { margin-top: 12px; border-top: 1px solid rgba(38, 57, 70, .65); padding-top: 10px; }
.road-feedback summary { cursor: pointer; color: var(--cyan); font-size: 11px; }
.road-feedback pre { max-height: 340px; overflow: auto; margin: 10px 0 0; border-radius: 10px; padding: 12px; color: #c7d7e2; background: #061019; font: 10px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-column { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: sticky; z-index: 5; top: 0; width: 100%; height: auto; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-brand, .sidebar-footer { display: none; }
  nav { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; }
  .nav-item { flex: 0 0 auto; width: auto; padding: 9px 12px; font-size: 12px; }
  .nav-item span { display: none; }
  .workspace { padding: 0 14px 40px; }
  .topbar { min-height: 86px; }
  .topbar h1 { font-size: 22px; }
  .live-status, .admin-identity { display: none; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 118px; padding: 16px; }
  .metric-value { font-size: 28px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .ticket { grid-template-columns: 1fr; }
  .inline-form { width: 100%; }
  .inline-form input { min-width: 0; }
}

@media (max-width: 460px) {
  .login-card { padding: 28px 22px; border-radius: 24px; }
  .metric-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; }
  .detail-row { grid-template-columns: 1fr; gap: 3px; }
  .detail-row strong { text-align: left; }
}
