:root {
  color-scheme: light;
  --ink: #12313a;
  --ink-2: #284a53;
  --muted: #687e84;
  --blue: #578e9e;
  --blue-dark: #326b7b;
  --orange: #ff7b16;
  --orange-dark: #d95b00;
  --canvas: #f4f7f8;
  --paper: #ffffff;
  --line: #dce6e8;
  --soft: #edf3f4;
  --danger: #a13d3d;
  --success: #2e7661;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-width: 320px; min-height: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-size: 16px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.center-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--muted); }
.loading-mark, .brand-mark { width: 38px; height: 38px; border-radius: 50%; background: var(--ink); display: grid; place-items: center; position: relative; }
.loading-mark { animation: pulse 1.6s ease-in-out infinite; }
.loading-mark i, .brand-mark i { position: absolute; border: 2px solid white; border-block-color: transparent; border-radius: 50%; }
.loading-mark i:nth-child(1), .brand-mark i:nth-child(1) { width: 7px; height: 7px; border: 0; background: var(--orange); }
.loading-mark i:nth-child(2), .brand-mark i:nth-child(2) { width: 17px; height: 17px; }
.loading-mark i:nth-child(3), .brand-mark i:nth-child(3) { width: 27px; height: 27px; opacity: .7; }
@keyframes pulse { 50% { transform: scale(1.08); } }

.login-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, 540px) 1fr; }
.login-card { background: white; padding: clamp(36px, 7vw, 90px); display: flex; flex-direction: column; justify-content: center; gap: 34px; }
.login-brand, .sidebar-brand { display: flex; align-items: center; gap: 11px; font-size: 1.16rem; font-weight: 700; letter-spacing: -.02em; }
.login-brand strong, .sidebar-brand strong { color: var(--orange); }
.login-card h1 { margin: 5px 0 8px; font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -.045em; line-height: 1.05; }
.login-card p { margin: 0; color: var(--muted); }
.login-card > small { color: var(--muted); }
.eyebrow { color: var(--orange-dark) !important; font-size: .78rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.login-context { padding: clamp(48px, 9vw, 130px); display: flex; flex-direction: column; justify-content: center; overflow: hidden; position: relative; color: white; background: linear-gradient(135deg, #102f38 0%, #2e6b7a 100%); }
.login-context::after { content: ""; position: absolute; width: 450px; height: 450px; right: -240px; top: -170px; border: 60px solid rgba(255,255,255,.05); border-radius: 50%; box-shadow: 0 0 0 60px rgba(255,255,255,.025), 0 0 0 120px rgba(255,255,255,.015); }
.login-context h2 { max-width: 650px; margin: 15px 0; font-size: clamp(2.4rem, 5vw, 5.4rem); line-height: .98; letter-spacing: -.055em; }
.login-context > p:not(.live-label) { max-width: 570px; color: #c8dde1; font-size: 1.08rem; }
.live-label { font-size: .8rem; font-weight: 850; letter-spacing: .1em; }
.live-label span { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 5px rgba(255,123,22,.17); }
.signal-lines { height: 75px; margin-top: 60px; display: flex; align-items: center; gap: 10px; opacity: .7; }
.signal-lines i { display: block; width: 8px; border-radius: 8px; background: var(--orange); }
.signal-lines i:nth-child(1), .signal-lines i:nth-child(7) { height: 18px; }
.signal-lines i:nth-child(2), .signal-lines i:nth-child(6) { height: 38px; }
.signal-lines i:nth-child(3), .signal-lines i:nth-child(5) { height: 58px; }
.signal-lines i:nth-child(4) { height: 74px; }

.form-stack { display: grid; gap: 15px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-hint { margin: -7px 0 0; color: var(--muted); font-size: .82rem; }
label { display: grid; gap: 7px; color: var(--ink-2); font-size: .86rem; font-weight: 720; }
input, select, textarea { width: 100%; min-height: 46px; border: 1px solid #cfdcdf; border-radius: 10px; background: #fbfdfd; color: var(--ink); padding: 10px 12px; outline: none; }
textarea { min-height: 105px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(87,142,158,.13); }
.check-label { display: flex; align-items: center; gap: 9px; }
.check-label input { width: 18px; min-height: 18px; }
.form-error { border-left: 3px solid var(--danger); padding: 9px 11px; background: #fff4f4; color: var(--danger) !important; font-size: .88rem; }

.primary-button, .outline-button, .soft-button, .danger-button {
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 780;
  cursor: pointer;
}
.primary-button { background: var(--orange); color: #183037; }
.primary-button:hover { background: #ff9140; }
.outline-button { border-color: var(--line); background: white; color: var(--ink); }
.soft-button { border-color: #cedcdf; background: var(--soft); color: var(--ink); }
.danger-button { border-color: #ecd1d1; background: #fff6f6; color: var(--danger); }
button:disabled { opacity: .55; cursor: not-allowed; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 258px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 25px 17px 18px; display: flex; flex-direction: column; background: var(--ink); color: white; }
.sidebar-brand { padding: 0 10px 25px; }
.sidebar .brand-mark { background: white; }
.sidebar .brand-mark i { border-color: var(--ink); border-block-color: transparent; }
.sidebar .brand-mark i:first-child { border: 0; }
.station-identity { margin: 0 3px 19px; padding: 14px; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; background: rgba(255,255,255,.055); }
.station-identity strong, .station-identity small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.station-identity small { margin-top: 3px; color: #9fbbc1; font-size: .76rem; }
.sidebar nav { display: grid; gap: 4px; }
.nav-link { width: 100%; min-height: 43px; border: 0; border-radius: 9px; padding: 0 12px; background: transparent; color: #c6dadd; display: flex; align-items: center; gap: 11px; text-align: left; cursor: pointer; font-size: .9rem; font-weight: 650; }
.nav-link:hover { background: rgba(255,255,255,.06); color: white; }
.nav-link.active { background: white; color: var(--ink); }
.nav-icon { width: 23px; text-align: center; font-size: 1rem; }
.sidebar-footer { margin-top: auto; padding: 15px 7px 0; border-top: 1px solid rgba(255,255,255,.1); display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.sidebar-footer strong, .sidebar-footer small { display: block; max-width: 138px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer small { color: #9fbbc1; font-size: .74rem; }
.sidebar-footer button { border: 0; background: transparent; color: #c6dadd; cursor: pointer; }

.workspace { min-width: 0; }
.workspace-header { min-height: 92px; padding: 20px 32px; display: flex; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.88); backdrop-filter: blur(14px); }
.workspace-header > div { flex: 1; }
.workspace-header p { margin: 0; color: var(--muted); font-size: .78rem; font-weight: 750; text-transform: uppercase; letter-spacing: .07em; }
.workspace-header h1 { margin: 2px 0 0; font-size: 1.55rem; letter-spacing: -.03em; }
.menu-button { display: none; width: 42px; height: 42px; border: 1px solid var(--line); background: white; border-radius: 9px; }
.password-alert { margin: 20px 32px 0; padding: 13px 15px; border: 1px solid #f3c7a1; border-left: 4px solid var(--orange); border-radius: 10px; background: #fff8f1; color: #74441d; }
.password-alert button { border: 0; background: none; color: var(--orange-dark); text-decoration: underline; font-weight: 800; cursor: pointer; }
.view { padding: 30px 32px 70px; }

.page-intro { margin-bottom: 22px; display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.page-intro h2 { margin: 0 0 4px; font-size: 1.35rem; letter-spacing: -.025em; }
.page-intro p { margin: 0; color: var(--muted); }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.metric-card, .panel { border: 1px solid var(--line); border-radius: 14px; background: white; }
.metric-card { padding: 19px; }
.metric-card span { display: block; color: var(--muted); font-size: .82rem; font-weight: 680; }
.metric-card strong { display: block; margin-top: 8px; font-size: 1.85rem; letter-spacing: -.04em; }
.metric-card small { color: var(--muted); }
.metric-card.live strong { color: var(--orange-dark); }
.dashboard-grid { margin-top: 16px; display: grid; grid-template-columns: 1.15fr .85fr; gap: 16px; }
.panel { padding: 21px; overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.panel-header h2, .panel h2 { margin: 0; font-size: 1.08rem; letter-spacing: -.02em; }
.panel-header p { margin: 3px 0 0; color: var(--muted); font-size: .87rem; }
.progress { height: 9px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--orange)); }
.checklist { display: grid; gap: 8px; margin-top: 15px; }
.checklist div { display: flex; align-items: center; gap: 9px; color: var(--muted); }
.checklist div::before { content: "○"; color: var(--blue); font-weight: 800; }
.checklist div.done::before { content: "✓"; color: var(--success); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; background: white; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: #f8fbfb; color: var(--muted); font-size: .77rem; text-transform: uppercase; letter-spacing: .04em; }
td { font-size: .9rem; }
tbody tr:last-child td { border-bottom: 0; }
td strong, td small { display: block; }
td small { color: var(--muted); }
.inline-select { min-height: 36px; width: auto; min-width: 125px; padding: 5px 8px; }
.badge { display: inline-flex; align-items: center; min-height: 27px; padding: 3px 9px; border-radius: 999px; background: var(--soft); color: var(--ink-2); font-size: .73rem; font-weight: 800; }
.badge.active, .badge.won { background: #e4f3ec; color: #27634f; }
.badge.new { background: #fff0e3; color: #974b12; }
.badge.suspended, .badge.lost { background: #f9e9e9; color: #923c3c; }
.badge.proposal { background: #e9f0f7; color: #345d82; }
.empty-panel { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty-panel strong { display: block; color: var(--ink); margin-bottom: 5px; }
.actions-row { display: flex; flex-wrap: wrap; gap: 8px; }
.link-button { border: 0; background: none; color: var(--blue-dark); font-weight: 750; cursor: pointer; padding: 0; }

.modal { width: min(720px, calc(100% - 28px)); max-height: calc(100vh - 30px); border: 0; border-radius: 17px; padding: 0; box-shadow: 0 24px 80px rgba(18,49,58,.28); }
.modal::backdrop { background: rgba(12,35,41,.58); backdrop-filter: blur(3px); }
.modal-frame > header { height: 68px; padding: 0 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-frame > header h2 { margin: 0; font-size: 1.2rem; }
.modal-frame > header button { width: 38px; height: 38px; border: 0; border-radius: 9px; background: var(--soft); font-size: 1.4rem; cursor: pointer; }
#modal-body { padding: 22px; max-height: calc(100vh - 100px); overflow-y: auto; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; padding-top: 7px; }

.toast { position: fixed; z-index: 40; top: 18px; right: 18px; max-width: 390px; padding: 13px 16px; border-radius: 10px; background: var(--ink); color: white; box-shadow: 0 16px 45px rgba(18,49,58,.25); }
.toast.error { background: var(--danger); }

@media (max-width: 1080px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-context { display: none; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 30; width: 270px; left: 0; transform: translateX(-102%); transition: transform .2s ease; box-shadow: 20px 0 45px rgba(18,49,58,.22); }
  .sidebar.open { transform: translateX(0); }
  .menu-button { display: inline-grid; place-items: center; }
  .workspace-header { padding-inline: 18px; }
  .view { padding: 24px 18px 60px; }
  .password-alert { margin-inline: 18px; }
}

@media (max-width: 560px) {
  .login-card { padding: 32px 22px; }
  .workspace-header .outline-button { display: none; }
  .metric-grid, .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .page-intro { align-items: stretch; flex-direction: column; }
  .page-intro .primary-button { width: 100%; }
  .panel { padding: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
