:root {
  color-scheme: light;
  --red: #c91427;
  --red-dark: #9f0e1f;
  --red-soft: #fff0f2;
  --ink: #171b24;
  --muted: #6f7480;
  --line: #e7e8ec;
  --surface: #ffffff;
  --canvas: #f5f6f8;
  --green: #19a463;
  --amber: #e58a12;
  --blue: #2468c9;
  --shadow: 0 18px 50px rgba(27, 32, 43, .08);
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 1.1fr) minmax(440px, .9fr);
  background: #090d16;
}

.login-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(48px, 8vw, 120px);
  color: white;
  background:
    radial-gradient(circle at 22% 25%, rgba(201, 20, 39, .33), transparent 29%),
    linear-gradient(135deg, #0b111e 0%, #121c2c 56%, #090d16 100%);
}

.login-brand::before, .login-brand::after {
  content: "";
  position: absolute;
  width: 520px;
  height: 520px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 40% 60% 63% 37%;
  transform: rotate(25deg);
}
.login-brand::before { right: -230px; top: -140px; }
.login-brand::after { left: -320px; bottom: -350px; border-color: rgba(201, 20, 39, .2); }

.brand-mark {
  width: 46px;
  height: 54px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--red);
  clip-path: polygon(50% 0, 92% 15%, 88% 68%, 72% 87%, 50% 100%, 28% 87%, 12% 68%, 8% 15%);
  font-weight: 900;
}
.brand-mark-large { width: 74px; height: 86px; margin-bottom: 34px; font-size: 24px; }
.login-brand h1 { max-width: 700px; margin: 10px 0 20px; font-size: clamp(40px, 5vw, 72px); line-height: 1.02; letter-spacing: -.045em; }
.login-lead { max-width: 610px; margin: 0; color: #bdc4d0; font-size: 19px; line-height: 1.6; }
.feature-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 34px; }
.feature-list span { padding: 10px 14px; border: 1px solid rgba(255,255,255,.12); border-radius: 999px; color: #d8dce4; background: rgba(255,255,255,.04); font-size: 13px; }

.login-panel { display: grid; place-items: center; padding: 40px; background: #fafafa; }
.login-card { width: min(100%, 450px); padding: 42px; border: 1px solid var(--line); border-radius: 28px; background: white; box-shadow: var(--shadow); }
.login-card h2 { margin: 8px 0 6px; font-size: 34px; letter-spacing: -.03em; }
.login-card label, .dialog-form label { display: block; margin: 20px 0 8px; font-size: 13px; font-weight: 750; }
.login-card input, .dialog-form input, .filter-bar input {
  width: 100%;
  min-height: 50px;
  padding: 0 15px;
  border: 1px solid #d7d9df;
  border-radius: 13px;
  color: var(--ink);
  background: white;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.login-card input:focus, .dialog-form input:focus, .filter-bar input:focus { border-color: var(--red); box-shadow: 0 0 0 4px rgba(201,20,39,.1); }
.password-field { position: relative; }
.password-field input { padding-right: 54px; }
.password-field .icon-button { position: absolute; right: 6px; top: 6px; }
.mobile-logo { display: none; align-items: center; gap: 12px; margin-bottom: 28px; color: var(--red); font-size: 22px; }
.secure-note { display: flex; align-items: center; gap: 9px; margin-top: 16px; color: var(--muted); font-size: 12px; }

.eyebrow { margin: 0; font-size: 11px; font-weight: 850; letter-spacing: .16em; }
.eyebrow.red { color: var(--red); }
.muted { color: var(--muted); }
.form-error { margin: 14px 0 0; padding: 11px 13px; color: #a30f20; background: var(--red-soft); border-radius: 10px; font-size: 13px; }

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 760;
  text-decoration: none;
  transition: transform .15s, background .2s, border-color .2s;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .55; transform: none; }
.button.primary { color: white; background: var(--red); box-shadow: 0 8px 20px rgba(201,20,39,.18); }
.button.primary:hover { background: var(--red-dark); }
.button.secondary { color: var(--ink); background: white; border-color: var(--line); }
.button.danger { color: var(--red); background: var(--red-soft); }
.button.small { min-height: 34px; padding: 0 11px; border-radius: 9px; font-size: 12px; }
.button.wide { width: 100%; margin-top: 22px; }
.icon-button { width: 40px; height: 40px; padding: 0; border: 0; border-radius: 11px; background: transparent; color: var(--ink); font-size: 19px; }
.icon-button:hover { background: #f0f1f3; }
.icon-button.light { color: white; }
.icon-button.light:hover { background: rgba(255,255,255,.1); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 270px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 26px 18px 18px; color: #d8dde7; background: #0f1724; z-index: 20; }
.sidebar-brand { display: flex; align-items: center; gap: 13px; padding: 0 10px 28px; color: white; text-decoration: none; }
.sidebar-brand strong { display: block; color: #f13045; font-size: 19px; letter-spacing: .06em; }
.sidebar-brand small { display: block; margin-top: 2px; color: #7f8999; font-size: 9px; letter-spacing: .17em; }
.navigation { display: grid; gap: 6px; }
.nav-item { width: 100%; min-height: 48px; display: flex; align-items: center; gap: 13px; padding: 0 14px; border: 0; border-radius: 13px; color: #9ca6b7; background: transparent; text-align: left; font-weight: 680; }
.nav-item span { width: 25px; color: #717c8e; font-size: 19px; text-align: center; }
.nav-item:hover { color: white; background: rgba(255,255,255,.05); }
.nav-item.active { color: white; background: linear-gradient(90deg, rgba(201,20,39,.26), rgba(201,20,39,.08)); }
.nav-item.active span { color: #ff4155; }
.sidebar-footer { margin-top: auto; display: grid; grid-template-columns: 38px minmax(0,1fr) 40px; align-items: center; gap: 10px; padding: 16px 8px 2px; border-top: 1px solid rgba(255,255,255,.08); }
.admin-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; color: white; background: var(--red); font-weight: 800; }
.admin-identity { min-width: 0; }
.admin-identity strong, .admin-identity small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-identity strong { color: white; font-size: 12px; }
.admin-identity small { margin-top: 2px; color: #778295; font-size: 10px; }

.workspace { min-width: 0; }
.topbar { height: 94px; display: flex; align-items: center; gap: 18px; padding: 0 34px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.93); backdrop-filter: blur(18px); }
.topbar h1 { margin: 2px 0 0; font-size: 25px; letter-spacing: -.025em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.menu-button { display: none; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border: 1px solid #dfe2e7; border-radius: 999px; color: var(--muted); background: white; font-size: 12px; font-weight: 700; }
.status-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(229,138,18,.12); }
.status-pill.online i { background: var(--green); box-shadow: 0 0 0 4px rgba(25,164,99,.12); }
.status-pill.offline i { background: var(--red); box-shadow: 0 0 0 4px rgba(201,20,39,.12); }

.content { padding: 30px 34px 50px; }
.view { display: none; animation: reveal .24s ease-out; }
.view.active { display: block; }
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.notice { margin: 18px 34px 0; padding: 13px 16px; border-radius: 12px; color: #0a7041; background: #eaf8f1; font-size: 13px; font-weight: 650; }
.notice.error { color: #9f0e1f; background: var(--red-soft); }

.welcome-banner { min-height: 210px; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; padding: 36px 42px; border-radius: 28px; color: white; background: linear-gradient(125deg, #111a28, #18283a 58%, #34131c); box-shadow: var(--shadow); }
.welcome-banner::after { content: ""; position: absolute; width: 380px; height: 380px; right: -160px; top: -170px; border: 70px solid rgba(201,20,39,.18); border-radius: 50%; }
.welcome-banner h2 { margin: 9px 0; font-size: clamp(27px, 3vw, 42px); letter-spacing: -.04em; }
.welcome-banner p:not(.eyebrow) { margin: 0; color: #b8c0cc; }
.welcome-orbit { position: relative; z-index: 1; width: 110px; height: 110px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; box-shadow: 0 0 0 22px rgba(255,255,255,.035), 0 0 0 44px rgba(255,255,255,.02); }
.welcome-orbit span { width: 52px; height: 60px; display: grid; place-items: center; background: var(--red); clip-path: polygon(50% 0, 92% 15%, 88% 68%, 72% 87%, 50% 100%, 28% 87%, 12% 68%, 8% 15%); font-weight: 900; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 20px 0; }
.metric-card { min-height: 132px; display: flex; flex-direction: column; justify-content: space-between; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 8px 24px rgba(27,32,43,.045); }
.metric-top { display: flex; align-items: center; justify-content: space-between; }
.metric-icon { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 12px; color: var(--red); background: var(--red-soft); font-weight: 900; }
.metric-card.green .metric-icon { color: var(--green); background: #eaf8f1; }
.metric-card.blue .metric-icon { color: var(--blue); background: #edf4ff; }
.metric-card.amber .metric-icon { color: var(--amber); background: #fff7e8; }
.metric-value { margin: 13px 0 2px; font-size: 29px; font-weight: 850; letter-spacing: -.04em; }
.metric-label { color: var(--muted); font-size: 12px; }
.loading-grid::before { content: "Se încarcă datele…"; color: var(--muted); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .55fr); gap: 20px; }
.panel { padding: 23px; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 8px 24px rgba(27,32,43,.04); }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel h3 { margin: 5px 0 0; font-size: 19px; }
.summary-list { display: grid; }
.summary-row { display: flex; align-items: center; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.summary-row:last-child { border-bottom: 0; }
.summary-dot { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 12px; background: var(--red-soft); color: var(--red); }
.summary-row strong, .summary-row small { display: block; }
.summary-row small { margin-top: 3px; color: var(--muted); }
.summary-number { margin-left: auto; font-weight: 850; }
.system-preview { display: grid; gap: 13px; }
.system-line { display: flex; justify-content: space-between; gap: 15px; padding-bottom: 13px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.system-line strong { color: var(--ink); text-align: right; }

.section-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.section-toolbar h2 { margin: 5px 0 4px; font-size: 29px; letter-spacing: -.035em; }
.section-toolbar p { margin-bottom: 0; }
.filter-bar { display: flex; align-items: center; gap: 15px; margin-bottom: 14px; }
.filter-bar input { max-width: 400px; min-height: 44px; }
.table-panel { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 16px 18px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); background: #fafbfc; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
td { font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fdfdfe; }
.align-right { text-align: right; }
.user-cell { display: flex; align-items: center; gap: 11px; }
.user-badge { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; color: var(--red); background: var(--red-soft); font-weight: 850; }
.user-cell strong, .user-cell small { display: block; }
.user-cell small { margin-top: 2px; color: var(--muted); }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 999px; color: #606673; background: #f0f1f3; font-size: 11px; font-weight: 750; }
.tag.premium { color: #996000; background: #fff4d5; }
.tag.success { color: #087343; background: #e7f7ef; }
.tag.admin { color: var(--red); background: var(--red-soft); }
.table-actions { display: flex; justify-content: flex-end; gap: 6px; }
.empty-state { padding: 44px 20px !important; color: var(--muted); text-align: center; }

.vehicle-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.vehicle-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 8px 24px rgba(27,32,43,.04); }
.vehicle-card-top { min-height: 118px; position: relative; padding: 20px; color: white; background: linear-gradient(135deg, #131e2d, #26394d); }
.vehicle-card-top::after { content: ""; position: absolute; width: 90px; height: 90px; right: -25px; top: -25px; border: 20px solid rgba(201,20,39,.25); border-radius: 50%; }
.vehicle-type { display: inline-flex; padding: 6px 9px; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; color: #c9cfda; font-size: 10px; text-transform: uppercase; }
.vehicle-card h3 { position: relative; z-index: 1; margin: 23px 0 0; font-size: 19px; }
.vehicle-card-body { padding: 18px 20px; }
.vehicle-owner { overflow: hidden; margin-bottom: 14px; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.vehicle-counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.vehicle-counts div { padding: 9px 3px; border-radius: 10px; background: #f7f8fa; text-align: center; }
.vehicle-counts strong, .vehicle-counts small { display: block; }
.vehicle-counts small { margin-top: 2px; color: var(--muted); font-size: 9px; }

.deployment-panel { display: flex; align-items: center; gap: 18px; }
.deployment-panel p { max-width: 720px; margin: 5px 0 0; color: var(--muted); line-height: 1.5; }
.deployment-panel .button { margin-left: auto; white-space: nowrap; }
.deployment-icon { width: 52px; height: 52px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 16px; color: white; background: var(--green); font-size: 24px; font-weight: 900; }

dialog { width: min(92vw, 520px); padding: 0; border: 0; border-radius: 24px; color: var(--ink); box-shadow: 0 30px 90px rgba(0,0,0,.24); }
dialog::backdrop { background: rgba(10,15,24,.62); backdrop-filter: blur(4px); }
.dialog-form { padding: 26px; }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; }
.dialog-header h2 { margin: 5px 0 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 26px; }
.quick-dates { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.quick-dates button { padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--muted); font-size: 12px; }
.quick-dates button:hover { color: var(--red); border-color: #efb7be; }

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

@media (max-width: 860px) {
  .login-shell { grid-template-columns: 1fr; background: #fafafa; }
  .login-brand { display: none; }
  .login-panel { min-height: 100vh; padding: 22px; }
  .mobile-logo { display: flex; }
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; width: 270px; transform: translateX(-105%); transition: transform .22s ease; box-shadow: 30px 0 70px rgba(0,0,0,.24); }
  .sidebar.open { transform: translateX(0); }
  .menu-button { display: block; }
  .topbar { padding: 0 20px; }
  .content { padding: 22px 20px 40px; }
  .notice { margin-left: 20px; margin-right: 20px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .vehicle-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .login-card { padding: 26px; border-radius: 22px; }
  .topbar { height: 82px; gap: 9px; }
  .topbar h1 { font-size: 19px; }
  .topbar-actions .button { width: 42px; padding: 0; font-size: 0; }
  .topbar-actions .button::first-letter { font-size: 18px; }
  .status-pill { display: none; }
  .content { padding: 18px 14px 36px; }
  .notice { margin: 12px 14px 0; }
  .welcome-banner { min-height: 175px; padding: 26px; }
  .welcome-orbit { display: none; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric-card { min-height: 120px; padding: 15px; }
  .section-toolbar { align-items: stretch; flex-direction: column; }
  .section-toolbar .button { width: 100%; }
  .filter-bar { align-items: stretch; flex-direction: column; }
  .panel { padding: 17px; }
  .deployment-panel { align-items: flex-start; flex-wrap: wrap; }
  .deployment-panel .button { width: 100%; margin-left: 0; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; }
}
