:root {
  --accent: #e0533c;
  --accent-dark: #bb3f2d;
  --accent-soft: #fbe8e4;
  --green: #16864b;
  --green-soft: #e6f4eb;
  --blue: #2768b4;
  --ink: #18231f;
  --muted: #68736e;
  --line: #dbe2de;
  --surface: #ffffff;
  --canvas: #f3f6f4;
  --danger: #c83c3c;
  --font: "Segoe UI", Inter, -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: var(--font); letter-spacing: 0; }
button, input, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
.hidden { display: none !important; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.login-view { min-height: 100vh; display: grid; place-items: center; padding: 32px; background: #eef2ef; }
.login-panel { width: min(390px, 100%); display: grid; gap: 18px; padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 16px 42px rgba(24,35,31,.09); }
.login-panel h1 { margin: 0; font-size: 25px; }
.login-panel p { margin: 3px 0 0; color: var(--muted); }
.brand-mark { width: 52px; height: 52px; display: grid; place-items: center; color: #fff; background: var(--accent); border-radius: 8px; }
.brand-mark svg { width: 30px; height: 30px; }
.brand-mark.small { width: 40px; height: 40px; }
.brand-mark.small svg { width: 24px; height: 24px; }

label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); outline: none; }
input { height: 42px; padding: 0 12px; }
textarea { padding: 11px 12px; resize: vertical; }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-error { margin: -5px 0 0 !important; color: var(--danger) !important; font-size: 13px; }

.dashboard-view { min-width: 1080px; min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0, 1fr); }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 238px; display: flex; flex-direction: column; padding: 20px 14px; background: var(--surface); border-right: 1px solid var(--line); }
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 7px 22px; }
.sidebar-brand div:last-child { display: grid; }
.sidebar-brand strong { font-size: 16px; }
.sidebar-brand span { color: var(--muted); font-size: 11px; }
.sidebar-nav { display: grid; gap: 5px; }
.nav-button { height: 44px; display: flex; align-items: center; gap: 11px; padding: 0 12px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font-weight: 700; text-align: left; }
.nav-button:hover { background: var(--canvas); color: var(--ink); }
.nav-button.active { color: var(--accent); background: var(--accent-soft); }
.sidebar-footer { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding: 13px 9px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 700; }

.main-shell { grid-column: 2; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 5; height: 74px; display: flex; align-items: center; justify-content: space-between; padding: 0 30px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.topbar h2 { margin: 0; font-size: 20px; }
.topbar span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.content-section { display: none; padding: 28px 30px 44px; }
.content-section.active { display: block; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(170px, 1fr)); gap: 14px; margin-bottom: 30px; }
.metric { min-height: 112px; display: flex; flex-direction: column; justify-content: space-between; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.metric span { color: var(--muted); font-size: 13px; font-weight: 700; }
.metric strong { font-size: 30px; }
.metric.health strong { color: var(--green); font-size: 23px; }
.section-heading { min-height: 54px; display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.section-heading.compact { min-height: 62px; }
.section-heading h3 { margin: 0; font-size: 17px; }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }

.table-wrap { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; }
th, td { height: 54px; padding: 0 16px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { height: 43px; color: var(--muted); background: #f8faf9; font-size: 11px; text-transform: uppercase; }
td { font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
.empty-row { height: 110px; color: var(--muted); text-align: center; }
.status { display: inline-flex; align-items: center; height: 25px; padding: 0 9px; border-radius: 999px; color: var(--green); background: var(--green-soft); font-size: 11px; font-weight: 800; }
.status.inactive { color: var(--danger); background: #fbe8e8; }

.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 15px; border: 1px solid transparent; border-radius: 6px; font-weight: 800; }
.button svg { width: 17px; height: 17px; }
.button.primary { color: #fff; background: var(--accent); box-shadow: 0 5px 13px rgba(224,83,60,.18); }
.button.primary:hover { background: var(--accent-dark); }
.button.secondary { color: var(--ink); background: #fff; border-color: var(--line); }
.button:disabled { opacity: .55; cursor: wait; }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 6px; color: var(--muted); background: transparent; }
.icon-button:hover { color: var(--ink); background: var(--canvas); }
.icon-button.bordered { background: #fff; border: 1px solid var(--line); }
.table-action { height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); background: #fff; font-size: 11px; font-weight: 800; }

.release-layout { display: grid; grid-template-columns: minmax(340px, 430px) minmax(0, 1fr); gap: 26px; align-items: start; }
.form-panel { display: grid; gap: 16px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.form-grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.toggle-row { grid-template-columns: auto auto 1fr; align-items: center; cursor: pointer; }
.toggle-row input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.toggle { width: 36px; height: 20px; padding: 2px; border-radius: 999px; background: #cbd3cf; transition: background .18s ease; }
.toggle::after { content: ""; display: block; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .18s ease; }
.toggle-row input:checked + .toggle { background: var(--accent); }
.toggle-row input:checked + .toggle::after { transform: translateX(16px); }
.file-picker { min-height: 90px; place-items: center; align-content: center; border: 1px dashed #b9c4bf; border-radius: 6px; background: #f8faf9; cursor: pointer; }
.file-picker:hover { border-color: var(--accent); color: var(--accent); }
.file-picker input { display: none; }
.upload-progress { height: 7px; overflow: hidden; border-radius: 999px; background: var(--line); }
.upload-progress span { display: block; width: 35%; height: 100%; background: var(--accent); animation: upload 1.1s ease-in-out infinite alternate; }
@keyframes upload { to { transform: translateX(185%); } }
.release-list { display: grid; gap: 10px; }
.release-item { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; align-items: center; gap: 14px; min-height: 78px; padding: 13px 15px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.release-version { color: var(--accent); font-size: 17px; font-weight: 900; }
.release-detail { min-width: 0; }
.release-detail strong { display: block; font-size: 13px; }
.release-detail span { display: block; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.release-meta { color: var(--muted); font-size: 11px; text-align: right; }
.required-badge { color: var(--danger); font-weight: 800; }
.release-controls { grid-column: 2 / -1; display: flex; gap: 18px; padding-top: 9px; border-top: 1px solid var(--line); }
.release-toggle { position: relative; display: flex; grid-template-columns: none; flex-direction: row; align-items: center; gap: 7px; cursor: pointer; }
.release-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.release-toggle .toggle { width: 32px; height: 18px; }
.release-toggle .toggle::after { width: 14px; height: 14px; }
.release-toggle input:checked + .toggle { background: var(--accent); }
.release-toggle input:checked + .toggle::after { transform: translateX(14px); }

.modal-backdrop { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(24,35,31,.35); backdrop-filter: blur(3px); }
.modal { width: min(440px, 100%); display: grid; gap: 16px; padding: 22px; background: #fff; border-radius: 8px; box-shadow: 0 24px 70px rgba(24,35,31,.24); }
.modal-header { display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { margin: 0; }
.modal-header .icon-button { font-size: 25px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 5px; }
.modal-context { margin: -4px 0; color: var(--muted); font-size: 13px; }

.toast-root { position: fixed; z-index: 50; top: 18px; right: 18px; display: grid; gap: 8px; }
.toast { min-width: 260px; max-width: 380px; padding: 12px 15px; color: #fff; background: var(--ink); border-radius: 6px; box-shadow: 0 12px 32px rgba(24,35,31,.18); font-size: 13px; font-weight: 700; animation: toast-in .18s ease-out; }
.toast.error { background: var(--danger); }
@keyframes toast-in { from { transform: translateY(-7px); opacity: 0; } }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .release-layout { grid-template-columns: 380px minmax(0, 1fr); }
}
