:root {
  --navy-950: #071923;
  --navy-900: #0d2736;
  --navy-800: #173c50;
  --orange: #e96d19;
  --orange-light: #fff0e4;
  --blue: #2878cf;
  --green: #168568;
  --red: #cf4545;
  --amber: #a96806;
  --text: #263640;
  --muted: #71818a;
  --line: #dfe6e9;
  --soft: #f4f7f8;
  --white: #fff;
  --shadow: 0 8px 28px rgba(9, 31, 44, .08);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--soft);
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button, a { transition: .16s ease; }
button { cursor: pointer; }
a { color: var(--orange); }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; width: 250px; display: flex; flex-direction: column; color: #d9e5eb; background: linear-gradient(180deg, var(--navy-950), var(--navy-900)); box-shadow: 8px 0 30px rgba(4, 18, 28, .1); }
.brand { height: 86px; display: flex; align-items: center; gap: 12px; padding: 0 22px; border-bottom: 1px solid rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.brand > span, .logo { width: 41px; height: 41px; display: grid; place-items: center; border-radius: 10px; color: #fff; background: var(--orange); font-size: 13px; font-weight: 900; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: .2px; }
.brand small { margin-top: 2px; color: #78909d; font-size: 9px; letter-spacing: 1.3px; }
.sidebar nav { flex: 1; padding: 24px 13px; }
.sidebar nav a { min-height: 44px; display: flex; align-items: center; margin: 3px 0; padding: 0 15px; border-radius: 8px; color: #aabdc7; text-decoration: none; font-size: 12px; font-weight: 700; }
.sidebar nav a:hover { color: #fff; background: rgba(255,255,255,.06); }
.sidebar nav a.active { color: #fff; background: linear-gradient(90deg, rgba(233,109,25,.28), rgba(233,109,25,.06)); box-shadow: inset 3px 0 var(--orange); }
.sidebar-status { min-height: 75px; display: flex; align-items: center; gap: 10px; padding: 16px 22px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-status i { width: 9px; height: 9px; border-radius: 50%; background: #42c292; box-shadow: 0 0 0 4px rgba(66,194,146,.12); }
.sidebar-status span, .sidebar-status small { display: block; }
.sidebar-status span { font-size: 10px; font-weight: 800; }
.sidebar-status small { margin-top: 3px; color: #738b98; font-size: 8px; }

.main { min-height: 100vh; margin-left: 250px; }
.topbar { position: sticky; top: 0; z-index: 20; height: 86px; display: flex; align-items: center; gap: 15px; padding: 0 30px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.95); backdrop-filter: blur(10px); }
.topbar > div > small, .content-head small, .hero p, .panel header small { display: block; color: var(--orange); font-size: 9px; font-weight: 900; letter-spacing: 1.3px; }
.topbar h1 { margin: 3px 0 0; color: var(--navy-900); font-size: 22px; }
.topbar > button { display: none; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user > span { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 9px; color: var(--blue); background: #e8f2ff; font-size: 12px; font-weight: 900; }
.user strong, .user small { display: block; }
.user strong { font-size: 10px; }
.user small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.user form { margin: 0 0 0 8px; }
.user button { padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: #fff; font-size: 9px; font-weight: 800; }
.page { max-width: 1480px; margin: auto; padding: 28px 31px 50px; }

.flash { margin-bottom: 17px; padding: 12px 15px; border: 1px solid; border-radius: 9px; font-size: 11px; font-weight: 700; }
.flash.success { color: #116a4e; border-color: #bae8d9; background: #ebf9f4; }
.flash.error { color: #8a3333; border-color: #f0c7c7; background: #fff1f1; }
.content-head { display: flex; justify-content: space-between; margin-bottom: 18px; }
.content-head h2 { margin: 5px 0; color: var(--navy-900); font-size: 27px; letter-spacing: -.6px; }
.content-head p { margin: 0; color: var(--muted); font-size: 11px; }

.hero { min-height: 136px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 27px 30px; overflow: hidden; border-radius: 14px; color: #fff; background: linear-gradient(120deg, var(--navy-900), #174b65); box-shadow: var(--shadow); }
.hero p { margin: 0; color: #ffaf6f; }
.hero h2 { margin: 8px 0 5px; font-size: 25px; }
.hero span { color: #bad0dc; font-size: 11px; }
.hero a { padding: 10px 13px; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; color: #fff; background: rgba(255,255,255,.08); font-size: 9px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.metrics { display: grid; grid-template-columns: repeat(4,1fr); gap: 15px; margin: 17px 0; }
.metrics article { min-height: 108px; display: flex; align-items: center; gap: 14px; padding: 19px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.metrics article > span { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 10px; color: var(--orange); background: var(--orange-light); font-size: 10px; font-weight: 900; }
.metrics small, .metrics strong { display: block; }
.metrics small { color: var(--muted); font-size: 10px; }
.metrics strong { margin-top: 3px; color: var(--navy-900); font-size: 26px; }
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.panel, .form-panel, .table-panel { border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.panel { min-height: 240px; padding: 21px; }
.panel header, .form-panel > header, .table-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.panel h3, .form-panel h3, .table-panel h3 { margin: 3px 0; color: var(--navy-900); font-size: 16px; }
.big-stat { display: inline-grid; margin: 25px 35px 0 0; }
.big-stat strong { color: var(--blue); font-size: 42px; line-height: 1; }
.big-stat.light strong { color: var(--orange); }
.big-stat span { margin-top: 6px; color: var(--muted); font-size: 9px; }
.steps { margin: 18px 0 0; padding-left: 20px; color: #53656e; font-size: 11px; line-height: 2.4; }

.form-panel { margin-bottom: 18px; overflow: hidden; }
.form-panel > header { padding: 17px 21px; border-bottom: 1px solid var(--line); }
.form-panel > header a { font-size: 9px; font-weight: 800; text-decoration: none; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; padding: 20px 21px; }
.form-grid.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.form-grid .form-grid { padding: 0; }
.form-grid label > span, .auth-card label > span { display: block; margin-bottom: 6px; color: #52636c; font-size: 9px; font-weight: 800; }
.form-grid label small, .auth-card label small { display: block; margin-top: 5px; color: var(--muted); font-size: 8px; }
input, select, textarea { width: 100%; height: 39px; padding: 0 10px; border: 1px solid #cbd5d9; border-radius: 7px; outline: 0; color: var(--text); background: #fff; }
input:focus, select:focus, textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(233,109,25,.12); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.form-actions { display: flex; justify-content: flex-end; padding-top: 3px; }
.primary, .button { min-height: 41px; display: inline-flex; align-items: center; justify-content: center; padding: 0 17px; border: 0; border-radius: 8px; color: #fff; background: var(--orange); box-shadow: 0 6px 16px rgba(233,109,25,.2); font-size: 10px; font-weight: 900; text-decoration: none; }
.primary:hover, .button:hover { background: #d86212; transform: translateY(-1px); }
fieldset { margin: 0; padding: 16px; border: 1px solid #ead7c8; border-radius: 9px; background: #fffaf6; }
fieldset legend { padding: 0 7px; color: var(--orange); font-size: 9px; font-weight: 900; }
.light-fields[hidden] { display: none; }

.table-panel { overflow: hidden; }
.table-panel > header { padding: 16px 19px; border-bottom: 1px solid var(--line); }
.table-panel > header span { color: var(--muted); font-size: 9px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 15px; border-bottom: 1px solid #edf1f3; text-align: left; vertical-align: middle; }
th { color: var(--muted); background: #fafcfc; font-size: 8px; font-weight: 900; letter-spacing: .7px; text-transform: uppercase; white-space: nowrap; }
td { color: #4e5f68; font-size: 10px; }
td strong, td small { display: block; }
td strong { color: var(--navy-900); }
td small { margin-top: 4px; color: #88969d; font-size: 8px; }
tbody tr:hover { background: #fcfdfd; }
.code, .tag, .badge { display: inline-flex; align-items: center; padding: 5px 7px; border-radius: 6px; font-size: 8px; font-weight: 900; white-space: nowrap; }
.code { color: var(--navy-800); background: #edf2f4; letter-spacing: .5px; }
.code.large { color: var(--orange); background: var(--orange-light); font-size: 10px; }
.tag { color: var(--blue); background: #e8f2ff; text-transform: uppercase; }
.badge { color: #6c7b82; background: #edf1f2; }
.badge.ok, .badge.available { color: var(--green); background: #e4f6f0; }
.badge.operating { color: var(--blue); background: #e8f2ff; }
.badge.maintenance { color: var(--amber); background: #fff2d9; }
.actions { display: flex; align-items: center; gap: 5px; }
.actions form { margin: 0; }
.actions a, .actions button { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; color: #5f7078; background: #fff; font-size: 8px; font-weight: 800; text-decoration: none; }
.actions button:hover { color: var(--red); border-color: #efc4c4; }
.empty { padding: 35px; color: var(--muted); text-align: center; }

.guest-body { display: grid; min-height: 100vh; background: #eaf0f2; }
.guest-shell { min-height: 100vh; display: grid; place-items: center; padding: 25px; }
.auth-card { width: min(900px,100%); min-height: 570px; display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; border-radius: 16px; background: #fff; box-shadow: 0 25px 70px rgba(6,23,34,.2); }
.auth-copy { display: flex; flex-direction: column; justify-content: center; padding: 55px; color: #fff; background: linear-gradient(135deg, var(--navy-950), #12435e); }
.auth-copy p { margin: 35px 0 5px; color: #ffad6a; font-size: 9px; font-weight: 900; letter-spacing: 1.5px; }
.auth-copy h1 { margin: 5px 0 12px; font-size: 35px; line-height: 1.1; }
.auth-copy > span:last-child { color: #b5ccd8; font-size: 11px; line-height: 1.7; }
.auth-card > form { display: flex; flex-direction: column; justify-content: center; padding: 45px; }
.auth-card h2 { margin: 0 0 7px; color: var(--navy-900); font-size: 26px; }
.auth-card .muted { margin: 0 0 16px; color: var(--muted); font-size: 10px; }
.auth-card label { display: block; margin-top: 13px; }
.auth-card input { height: 43px; }
.auth-card .primary { width: 100%; margin-top: 22px; }
.password { display: flex; }
.password input { border-radius: 7px 0 0 7px; }
.password button { min-width: 62px; border: 1px solid #cbd5d9; border-left: 0; border-radius: 0 7px 7px 0; color: var(--blue); background: #f7fafb; font-size: 8px; font-weight: 900; }
.requirements-link { margin-top: 16px; color: var(--muted); font-size: 8px; text-align: center; text-decoration: none; }
.simple-card, .error-card { width: min(620px,calc(100% - 30px)); margin: auto; padding: 40px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); text-align: center; }
.error-card { margin-top: 80px; }
.error-card > strong { color: #dce5e8; font-size: 80px; }
.error-card h1, .simple-card h1 { color: var(--navy-900); }
.error-card p, .simple-card p { margin-bottom: 24px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.requirements { width: min(900px,calc(100% - 30px)); margin: 40px auto; padding: 30px; border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.requirements h1 { margin: 5px 0; color: var(--navy-900); }
.requirements > p { color: var(--muted); font-size: 11px; }
.requirements table { margin: 22px 0; border: 1px solid var(--line); }
.requirements .result { padding: 15px; border-radius: 8px; font-size: 11px; font-weight: 800; }
.requirements .result.ok { color: #12694f; background: #e9f8f2; }
.requirements .result.bad { color: #8a3333; background: #fff0f0; }
.requirements .buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.secondary { min-height: 41px; display: inline-flex; align-items: center; padding: 0 15px; border: 1px solid var(--line); border-radius: 8px; color: var(--navy-800); background: #fff; font-size: 9px; font-weight: 900; text-decoration: none; }
.overlay { display: none; }

@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(2,1fr); }
  .form-grid.three { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .span-3 { grid-column: span 2; }
}

@media (max-width: 850px) {
  .sidebar { transform: translateX(-100%); transition: .2s; }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .topbar > button { display: block; }
  .overlay.visible { position: fixed; inset: 0; z-index: 25; display: block; border: 0; background: rgba(6,23,34,.55); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .auth-card { grid-template-columns: 1fr; }
  .auth-copy { min-height: 220px; padding: 35px; }
  .auth-copy p { margin-top: 25px; }
}

@media (max-width: 650px) {
  .page { padding: 20px 12px 35px; }
  .topbar { height: 76px; padding: 0 13px; }
  .topbar h1 { font-size: 18px; }
  .user > div, .user > span { display: none; }
  .hero { align-items: flex-start; flex-direction: column; padding: 22px; }
  .hero h2 { font-size: 20px; }
  .metrics { grid-template-columns: 1fr; gap: 9px; }
  .metrics article { min-height: 90px; }
  .form-grid, .form-grid.three, .form-grid .form-grid { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: auto; }
  .form-actions .primary { width: 100%; }
  .auth-card > form, .auth-copy { padding: 27px; }
  .guest-shell { padding: 8px; }
}
