:root {
  /* Sidebar (dark) */
  --sb-bg:          #0A2036;
  --sb-active:      rgba(255,255,255,0.08);
  --sb-text:        #9FB1C6;
  --sb-text-active: #ffffff;
  --sb-border:      rgba(255,255,255,0.08);

  /* Content */
  --bg:         #EEF1F6;
  --surface:    #ffffff;
  --surface2:   #F7F9FB;
  --border:     #DCE3EA;
  --grid:       #DCE3EA;
  --text:       #10192B;
  --text2:      #5B6B82;
  --muted:      #8C9AAE;

  /* Accent / Brand */
  --accent:    #1E4E79;
  --accent-bg: #E4EDF4;
  --accent-h:  #0A2036;

  /* Status */
  --online:      #2F9E6E;
  --online-bg:   #E4F5EC;
  --offline:     #C64545;
  --offline-bg:  #FBE7E7;
  --warn:        #C9852A;
  --warn-bg:     #FBEEDD;
  --crit-bg:     #FBE7E7;
  --crit-bd:     #f5c6c6;

  --sidebar-w: 240px;
  --radius:    8px;
  --shadow:    0 1px 3px rgba(0,0,0,0.04), 0 2px 8px rgba(0,0,0,0.03);
}

*,*::before,*::after { box-sizing:border-box; margin:0; padding:0 }
[hidden] { display:none !important; }
body { font-family:'Inter',system-ui,-apple-system,sans-serif; font-size:14px; line-height:1.5; background:var(--bg); color:var(--text); min-height:100vh }
button { font-family:inherit; cursor:pointer }
input,select,textarea { font-family:inherit; font-size:14px }
a { color:var(--accent); text-decoration:none }
.mono { font-family:'JetBrains Mono',monospace }
.display { font-family:'Space Grotesk',sans-serif }

/* ── Login ─────────────────────────────────────────────────────────────────── */
#vLogin {
  min-height:100vh; display:flex; align-items:stretch;
  background:#0A2036;
}
.login-left {
  flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center;
  padding:60px 48px; gap:24px;
}
.login-left-logo { max-width:340px; width:100%; }
.login-left-logo img { width:100%; height:auto; display:block; }
.login-left-tagline {
  font-family:'Space Grotesk',sans-serif;
  font-size:13px; font-weight:500; letter-spacing:0.12em; text-transform:uppercase;
  color:rgba(255,255,255,0.35);
}
.login-divider {
  width:1px; background:rgba(255,255,255,0.08); align-self:stretch; margin:40px 0;
}
.login-right {
  flex:1; display:flex; align-items:center; justify-content:center;
  padding:48px; background:rgba(255,255,255,0.03);
}
.login-card {
  background:#ffffff; border-radius:14px; padding:44px 40px;
  width:100%; max-width:360px; box-shadow:0 24px 64px rgba(0,0,0,0.4);
}
.login-card-head { margin-bottom:28px; }
.login-card-title {
  font-family:'Space Grotesk',sans-serif; font-size:20px; font-weight:700;
  color:#10192B; margin-bottom:4px;
}
.login-card-sub { font-size:13px; color:#8C9AAE; }
.login-sub { font-size:13px; color:var(--muted); margin-bottom:32px }
.field { margin-bottom:16px }
.field label { display:block; font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:.06em; color:#8C9AAE; margin-bottom:6px }
.field input,.field select {
  width:100%; border:1.5px solid #DCE3EA; border-radius:8px;
  background:#F7F9FB; color:#10192B; padding:10px 13px; outline:none;
  font-size:14px; transition:border-color .15s, box-shadow .15s;
}
.field input:focus,.field select:focus {
  border-color:#B8962E; box-shadow:0 0 0 3px rgba(184,150,46,0.12);
}
.btn-primary {
  width:100%; background:#0A2036; border:none; border-radius:8px;
  color:#fff; font-size:14px; font-weight:600; padding:11px 0; margin-top:8px;
  letter-spacing:0.02em; transition:background .15s, transform .1s;
}
.btn-primary:hover:not(:disabled) { background:#162e4a; }
.btn-primary:active:not(:disabled) { transform:scale(0.99); }
.btn-primary:disabled { opacity:.5; cursor:not-allowed }
.error-msg {
  background:#FBE7E7; border:1px solid #f5c6c6; border-radius:8px;
  color:#C64545; font-size:13px; padding:9px 13px; margin-top:12px; display:none;
}
@media (max-width: 720px) {
  #vLogin { flex-direction:column; }
  .login-left { padding:40px 32px 24px; }
  .login-left-logo { max-width:220px; }
  .login-divider { display:none; }
  .login-right { width:100%; padding:0 20px 40px; background:none; }
  .login-card { box-shadow:none; background:rgba(255,255,255,0.97); }
}

/* ── Shell layout ───────────────────────────────────────────────────────────── */
.shell { display:flex; min-height:100vh }

/* ── Sidebar ─────────────────────────────────────────────────────────────────── */
.sidebar {
  width:var(--sidebar-w); flex-shrink:0; background:var(--sb-bg);
  display:flex; flex-direction:column;
  position:fixed; top:0; left:0; height:100vh; z-index:20; overflow-y:auto;
}
.sidebar-logo {
  display:flex; align-items:center; justify-content:center;
  padding:20px 18px 18px; border-bottom:1px solid var(--sb-border);
}
.sidebar-nav { flex:1; padding:12px 10px }
.nav-section {
  font-size:10px; font-weight:600; text-transform:uppercase;
  letter-spacing:.08em; color:var(--sb-text); padding:10px 10px 5px; opacity:.6;
}
.nav-item {
  display:flex; align-items:center; gap:10px;
  padding:9px 12px; border-radius:6px;
  color:var(--sb-text); font-size:13px; font-weight:500;
  cursor:pointer; border:none; background:none;
  width:100%; text-align:left; transition:.12s;
  margin-bottom:2px;
}
.nav-item:hover { background:rgba(255,255,255,0.06); color:#c8d8e8 }
.nav-item.active { background:var(--sb-active); color:var(--sb-text-active); font-weight:600 }
.nav-icon { width:16px; height:16px; flex-shrink:0; opacity:.7 }
.nav-item.active .nav-icon { opacity:1 }

.sidebar-foot { padding:16px 18px; border-top:1px solid var(--sb-border) }
.sidebar-foot-user { display:flex; align-items:center; gap:10px; margin-bottom:12px }
.user-avatar {
  width:32px; height:32px; border-radius:50%; flex-shrink:0;
  background:#2C4A63;
  display:flex; align-items:center; justify-content:center;
  font-size:12px; font-weight:700; color:#fff; letter-spacing:.5px;
}
.sidebar-user { font-size:13px; font-weight:600; color:#fff }
.sidebar-company { font-size:11px; color:var(--sb-text); margin-top:1px }
.btn-logout {
  display:inline-flex; align-items:center; gap:7px;
  background:none; border:none; color:#e05a2b;
  font-size:13px; font-weight:500; padding:0;
  transition:opacity .12s;
}
.btn-logout:hover { opacity:.75 }

/* ── Main area ───────────────────────────────────────────────────────────────── */
.main-area { margin-left:var(--sidebar-w); flex:1; min-width:0; padding:32px }

/* ── Page header ─────────────────────────────────────────────────────────────── */
.page-hdr { display:flex; align-items:center; justify-content:space-between; margin-bottom:24px }
.page-hdr h1 { font-size:22px; font-weight:600; font-family:'Space Grotesk',sans-serif }
.page-hdr p { font-size:13px; color:var(--muted); margin-top:2px }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display:inline-flex; align-items:center; gap:6px;
  border-radius:var(--radius); font-size:13px; font-weight:600;
  padding:8px 16px; border:none; cursor:pointer; transition:.12s;
}
.btn-blue { background:var(--sb-bg); color:#fff }
.btn-blue:hover { background:#162e4a }
.btn-ghost { background:var(--surface); border:1px solid var(--grid); color:var(--text2) }
.btn-ghost:hover { border-color:var(--muted); color:var(--text) }
.btn-danger { background:none; border:1px solid var(--crit-bd); color:var(--offline) }
.btn-danger:hover { background:var(--crit-bg) }
.btn-sm { font-size:12px; padding:5px 11px }

/* ── Search bar ──────────────────────────────────────────────────────────────── */
.search-wrap { position:relative; margin-bottom:20px; max-width:460px }
.search-wrap svg {
  position:absolute; left:11px; top:50%; transform:translateY(-50%);
  width:14px; height:14px; color:var(--muted); pointer-events:none;
}
.search-input {
  width:100%; border:1px solid var(--grid); border-radius:var(--radius);
  background:var(--surface); color:var(--text); padding:9px 12px 9px 34px;
  font-size:13px; outline:none; transition:border-color .15s; box-shadow:var(--shadow);
}
.search-input:focus { border-color:var(--accent) }

/* ── KPI tiles ───────────────────────────────────────────────────────────────── */
.kpi-row { display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:12px; margin-bottom:24px }
.kpi-card { background:var(--surface); border-radius:12px; border:1px solid var(--grid); padding:18px 20px; box-shadow:var(--shadow) }
.kpi-lbl { font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); margin-bottom:6px }
.kpi-val { font-size:28px; font-weight:700; line-height:1 }
.kpi-val.green { color:var(--online) }
.kpi-val.red   { color:var(--offline) }
.kpi-val.blue  { color:var(--accent) }
.kpi-sub { font-size:11px; color:var(--muted); margin-top:3px }

/* ── Cards ───────────────────────────────────────────────────────────────────── */
.card { background:var(--surface); border-radius:12px; border:1px solid var(--grid); box-shadow:var(--shadow) }
.card-hdr {
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 20px; border-bottom:1px solid var(--grid);
}
.card-hdr h2 { font-size:14px; font-weight:600; font-family:'Space Grotesk',sans-serif }
.card-hdr p { font-size:12px; color:var(--muted); margin-top:1px }
.card-body { padding:20px }
.card-pad { padding:22px }
.section-label { font-family:'Space Grotesk',sans-serif; font-weight:600; font-size:14px; margin-bottom:16px; color:var(--text) }
.ac-kit-row { display:grid; grid-template-columns:1.5fr 1fr 1fr 1fr 1fr auto; gap:10px; align-items:end; padding:14px; background:var(--surface2); border-radius:10px; border:1px solid var(--grid); margin-bottom:10px }
.ac-user-row { display:grid; grid-template-columns:1fr 1fr 1fr auto; gap:10px; align-items:end; padding:14px; background:var(--surface2); border-radius:10px; border:1px solid var(--grid); margin-bottom:10px }
.btn-row-del { width:36px; height:36px; border-radius:8px; border:1px solid var(--grid); background:var(--surface); color:var(--red); display:flex; align-items:center; justify-content:center; cursor:pointer; font-size:16px; flex-shrink:0 }

/* ── Tables ──────────────────────────────────────────────────────────────────── */
.tbl-wrap { overflow-x:auto }
table { width:100%; border-collapse:collapse; font-variant-numeric:tabular-nums }
thead th {
  padding:10px 20px; text-align:left; font-size:11px; font-weight:600;
  text-transform:uppercase; letter-spacing:.05em; color:var(--muted);
  background:var(--surface2); white-space:nowrap;
}
tbody td {
  padding:14px 20px; font-size:13px; color:var(--text2);
  border-top:1px solid var(--grid); vertical-align:middle;
}
tbody tr:first-child td { border-top:none }
tbody tr.clickable { cursor:pointer; transition:background .1s }
tbody tr.clickable:hover td { background:#FAFBFC }
.empty-row td { text-align:center; color:var(--muted); padding:48px; font-size:13px; border-top:none }
.td-main { font-size:13px; font-weight:600; color:var(--text) }
.td-sub { font-size:11px; color:var(--muted); margin-top:2px; font-weight:400 }
.td-chevron { color:var(--muted); font-size:15px; text-align:right; padding-right:12px }

/* ── Pills ───────────────────────────────────────────────────────────────────── */
.pill {
  display:inline-flex; align-items:center; border-radius:20px;
  font-size:11px; font-weight:600; padding:3px 10px; white-space:nowrap;
}
.pill-green  { background:var(--online-bg);  color:var(--online) }
.pill-red    { background:var(--offline-bg); color:var(--offline) }
.pill-yellow { background:var(--warn-bg);    color:var(--warn) }
.pill-gray   { background:var(--surface2);   color:var(--muted) }
.pill-blue   { background:var(--accent-bg);  color:var(--accent) }

/* ── Signal bar ──────────────────────────────────────────────────────────────── */
.sig-wrap { display:flex; align-items:center; gap:7px }
.sig-track { width:56px; height:5px; background:var(--grid); border-radius:3px; overflow:hidden }
.sig-fill { height:100%; border-radius:3px; transition:width .3s }
.sig-green  { background:var(--online) }
.sig-yellow { background:var(--warn) }
.sig-red    { background:var(--offline) }

/* ── Vessel detail panel (fleet) ──────────────────────────────────────────────── */
.detail-panel { background:var(--surface); border-radius:var(--radius); margin-bottom:20px; display:none; box-shadow:var(--shadow) }
.detail-panel.open { display:block }
.detail-hdr { display:flex; align-items:flex-start; justify-content:space-between; padding:18px 22px; border-bottom:1px solid var(--grid) }
.detail-name { font-size:18px; font-weight:700 }
.detail-sub { font-size:12px; color:var(--muted); margin-top:2px }
.btn-close { background:none; border:none; color:var(--muted); font-size:18px; line-height:1; padding:2px 4px; cursor:pointer }
.btn-close:hover { color:var(--text) }
.stat-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); gap:10px; padding:18px 22px }
.stat-cell { background:var(--surface2); border-radius:6px; padding:12px 14px }
.stat-lbl { font-size:10px; font-weight:600; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); margin-bottom:4px }
.stat-val { font-size:17px; font-weight:700; font-variant-numeric:tabular-nums }

/* ── Meter ───────────────────────────────────────────────────────────────────── */
.meter-track { height:8px; background:var(--grid); border-radius:4px; overflow:hidden; margin:6px 0 4px }
.meter-fill { height:100%; border-radius:4px }
.meter-fill.green  { background:var(--online) }
.meter-fill.yellow { background:var(--warn) }
.meter-fill.red    { background:var(--offline) }

/* ── Circular usage ring ─────────────────────────────────────────────────────── */
.ring-cell { display:flex; align-items:center; gap:8px }
.ring-cell svg { display:block; flex-shrink:0 }

/* ── Forms ───────────────────────────────────────────────────────────────────── */
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px }
.form-section {
  font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.06em;
  color:var(--muted); margin:20px 0 10px; padding-top:16px; border-top:1px solid var(--grid);
}
.form-section:first-child { margin-top:0; padding-top:0; border-top:none }
.inline-list { display:flex; flex-direction:column; gap:10px; margin-top:8px }
.inline-item {
  background:var(--surface2); border:1px solid var(--grid); border-radius:6px;
  padding:10px 12px; display:grid; grid-template-columns:1fr 1fr auto; gap:10px; align-items:center;
}
.inline-item-3 { grid-template-columns:1fr 1fr 1fr auto }
.btn-remove { background:none; border:none; color:var(--muted); font-size:16px; line-height:1; cursor:pointer; padding:0 4px }
.btn-remove:hover { color:var(--offline) }
.btn-add-inline {
  display:inline-flex; align-items:center; gap:5px; background:none;
  border:1px dashed var(--grid); border-radius:6px; color:var(--muted);
  font-size:12px; font-weight:500; padding:7px 12px; margin-top:6px; width:100%;
  justify-content:center; transition:.12s;
}
.btn-add-inline:hover { border-color:var(--accent); color:var(--accent) }

/* ── Modal ───────────────────────────────────────────────────────────────────── */
.modal-bg {
  position:fixed; inset:0; background:rgba(0,0,0,0.45); z-index:100;
  display:flex; align-items:center; justify-content:center; padding:20px;
}
.modal {
  background:var(--surface); border-radius:12px;
  box-shadow:0 20px 60px rgba(0,0,0,0.2);
  width:100%; max-width:600px; max-height:90vh; display:flex; flex-direction:column;
}
.modal-hdr { padding:20px 24px; border-bottom:1px solid var(--grid); display:flex; align-items:center; justify-content:space-between; flex-shrink:0 }
.modal-hdr h2 { font-size:16px; font-weight:700 }
.modal-body { padding:22px 24px; overflow-y:auto; flex:1 }
.modal-foot { padding:16px 24px; border-top:1px solid var(--grid); display:flex; gap:8px; justify-content:flex-end; flex-shrink:0 }
.modal-error {
  background:var(--crit-bg); border:1px solid var(--crit-bd); border-radius:6px;
  color:var(--offline); font-size:12px; padding:9px 13px; margin-bottom:14px; display:none;
}

/* ── Charts ──────────────────────────────────────────────────────────────────── */
.chart-wrap { position:relative; margin-top:4px }
.chart-tt {
  position:absolute; background:var(--surface); border:1px solid var(--grid);
  border-radius:6px; padding:9px 13px; font-size:11px; pointer-events:none;
  box-shadow:var(--shadow); white-space:nowrap; display:none; z-index:10;
}
.tt-hd { font-weight:700; margin-bottom:3px; color:var(--text) }
.tt-row { display:flex; align-items:center; gap:6px; margin-top:3px }
.tt-dot { width:8px; height:8px; border-radius:50%; flex-shrink:0 }
.tt-val { margin-left:auto; padding-left:12px; font-weight:600 }
.legend { display:flex; gap:16px; flex-wrap:wrap; margin-bottom:12px }
.legend-item { display:flex; align-items:center; gap:5px; font-size:12px; color:var(--text2) }
.legend-dot { width:10px; height:10px; border-radius:50%; flex-shrink:0 }

/* ── Usage horizontal bars ───────────────────────────────────────────────────── */
.usage-bar-row { display:flex; align-items:center; gap:12px; margin:8px 0 }
.usage-bar-lbl { width:80px; font-size:12px; font-weight:500; color:var(--text2); flex-shrink:0; text-align:right }
.usage-bar-track { flex:1; height:14px; background:var(--surface2); border-radius:3px; overflow:hidden }
.usage-bar-fill { height:100%; border-radius:3px; min-width:2px; transition:width .4s }
.usage-bar-val { width:72px; font-size:12px; color:var(--text2); font-variant-numeric:tabular-nums }

/* ── Usage Reports: split layout ─────────────────────────────────────────────── */
.usage-split { display:flex; gap:16px; align-items:flex-start }
.usage-left {
  width:280px; flex-shrink:0; background:var(--surface);
  border-radius:12px; border:1px solid var(--grid); box-shadow:var(--shadow); overflow:hidden;
}
.usage-left-search {
  padding:12px; border-bottom:1px solid var(--grid); position:relative;
}
.usage-left-search svg {
  position:absolute; left:21px; top:50%; transform:translateY(-50%);
  width:13px; height:13px; color:var(--muted); pointer-events:none;
}
.usage-left-search input {
  width:100%; border:1px solid var(--grid); border-radius:6px;
  background:var(--surface2); padding:7px 10px 7px 30px;
  font-size:13px; outline:none; color:var(--text); transition:border-color .15s;
}
.usage-left-search input:focus { border-color:var(--accent) }
.usage-client-list { overflow-y:auto; max-height:calc(100vh - 240px) }
.usage-client-item {
  padding:12px 16px; cursor:pointer; border-bottom:1px solid var(--grid); transition:background .1s;
}
.usage-client-item:last-child { border-bottom:none }
.usage-client-item:hover { background:var(--surface2) }
.usage-client-item.active { background:var(--accent-bg) }
.usage-client-item.active .usage-client-name { color:var(--accent) }
.usage-client-name { font-size:13px; font-weight:600; color:var(--text) }
.usage-client-meta { font-size:11px; color:var(--muted); margin-top:2px }
.usage-right { flex:1; min-width:0; max-width:100%; display:flex; flex-direction:column; gap:16px; overflow:hidden; }
.usage-empty {
  background:var(--surface); border-radius:12px; border:1px solid var(--grid); box-shadow:var(--shadow);
  padding:64px; text-align:center; color:var(--muted); font-size:13px;
}

/* Usage detail header */
.usage-detail-hdr { padding:22px 24px; display:flex; align-items:flex-start; justify-content:space-between }
.usage-company-name { font-size:20px; font-weight:700; margin-bottom:6px }
.usage-company-meta {
  display:flex; align-items:center; gap:18px; font-size:12px; color:var(--muted);
}
.usage-company-meta span { display:flex; align-items:center; gap:5px }
.usage-total-block { text-align:right; flex-shrink:0; margin-left:20px }
.usage-total-lbl { font-size:11px; color:var(--muted); margin-bottom:4px }
.usage-total-num { font-size:28px; font-weight:700; font-variant-numeric:tabular-nums; color:var(--text); line-height:1 }
.usage-total-num small { font-size:14px; font-weight:400; color:var(--muted) }

/* ── Action dropdown ─────────────────────────────────────────────────────────── */
.actions { position:relative; display:inline-block }
.actions-menu {
  position:absolute; right:0; top:100%; margin-top:4px;
  background:var(--surface); border:1px solid var(--grid);
  border-radius:var(--radius); box-shadow:var(--shadow); z-index:30; min-width:150px; display:none;
}
.actions-menu.open { display:block }
.actions-menu button { display:block; width:100%; text-align:left; padding:8px 14px; background:none; border:none; font-size:13px; color:var(--text2); cursor:pointer }
.actions-menu button:hover { background:var(--surface2); color:var(--text) }
.actions-menu button.danger { color:var(--offline) }
.actions-menu button.danger:hover { background:var(--crit-bg) }

/* ── Spinner ─────────────────────────────────────────────────────────────────── */
@keyframes spin { to { transform:rotate(360deg) } }
.spinner { width:18px; height:18px; border:2px solid var(--grid); border-top-color:var(--accent); border-radius:50%; animation:spin .7s linear infinite; margin:0 auto 10px }
.loading-center { padding:48px; text-align:center; color:var(--muted) }

/* ── Back link ───────────────────────────────────────────────────────────────── */
.back-link { display:inline-flex; align-items:center; gap:5px; font-size:13px; color:var(--muted); cursor:pointer; margin-bottom:16px; border:none; background:none; padding:0 }
.back-link:hover { color:var(--accent) }

/* ── Confirm dialog ──────────────────────────────────────────────────────────── */
.confirm-modal { max-width:380px }
.confirm-body p { color:var(--text2); font-size:14px; line-height:1.6 }
.confirm-body strong { color:var(--text) }

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width:1100px) {
  .usage-split { flex-direction:column }
  .usage-left { width:100% }
  .usage-client-list { max-height:260px }
}
@media (max-width:768px) {
  .form-grid { grid-template-columns:1fr }
  .main-area { padding:16px }
  .kpi-row { grid-template-columns:repeat(2,1fr) }
}
@media (max-width:600px) {
  .sidebar { display:none }
  .main-area { margin-left:0 }
}
