/* ══════════════════════════════════════════════════════════════
   Galvaframe — new design system (light + dark, mint accent)
   Approved direction: airy, soft borderless cards, mint green,
   sentence-case labels, calm weights, subtle motion.
   ══════════════════════════════════════════════════════════════ */

:root {
  --accent:      #10b981;
  --accent-2:    #34d399;
  --accent-soft: rgba(16,185,129,0.12);
  --accent-ink:  #04120c;

  /* Light mode (default) */
  --bg:        #f7f8fa;
  --surface:   #ffffff;
  --surface-2: #f1f5f9;
  --border:    #eef0f3;
  --border-2:  #e2e8f0;
  --text:      #0f172a;
  --muted:     #64748b;
  --faint:     #94a3b8;

  --danger:  #dc2626;  --danger-soft:  #fee2e2;
  --warn:    #d97706;  --warn-soft:    #fef3c7;
  --info:    #1d4ed8;  --info-soft:    #dbeafe;
  --success: #047857;  --success-soft: #d1fae5;

  --shadow: 0 1px 2px rgba(15,23,42,0.04), 0 1px 3px rgba(15,23,42,0.03);
  --radius: 12px;
  --radius-lg: 16px;
  --sidebar-w: 248px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html[data-theme="dark"] {
  --bg:        #0d1017;
  --surface:   #161b26;
  --surface-2: #1c2233;
  --border:    #1c2233;
  --border-2:  #232a3d;
  --text:      #e6e9ef;
  --muted:     #8b93a7;
  --faint:     #6b7280;

  --danger-soft:  rgba(239,68,68,0.15);
  --warn-soft:    rgba(232,168,56,0.15);
  --info-soft:    rgba(74,168,255,0.16);
  --success-soft: rgba(16,185,129,0.15);
  --danger:  #f87171;  --warn: #f0c060;  --info: #60a5fa;  --success: #34d399;

  --shadow: none;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

/* ── Scrollbars ── one slim, rounded, theme-aware style for every scroll area
   (sidebar, content, dialogs, tables, the portals' page scroll) instead of the browser default. */
:root { --scroll-thumb: #cbd5e1; --scroll-thumb-hover: #94a3b8; }
html[data-theme="dark"] { --scroll-thumb: #2e3650; --scroll-thumb-hover: #46506e; }
* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 99px; }
*::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); }
*::-webkit-scrollbar-corner { background: transparent; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100vh;
  /* Phones/tablets: 100vh includes the area under the browser toolbar, which hides the bottom of the page. */
  height: 100dvh;
  overflow: hidden;
  display: flex;
  transition: background .25s, color .25s;
}

/* ── Load-in animation ── */
@keyframes gfRise { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }
.rise { opacity: 0; animation: gfRise .5s cubic-bezier(0.22,0.61,0.36,1) forwards; }

/* ── Sidebar ── */
.gf-sb-toggle { display: none; width: 28px; height: 34px; border-radius: 8px; border: none; background: transparent; color: var(--muted); cursor: pointer; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; padding: 0; transition: color .15s; }
.gf-sb-toggle:hover { color: var(--text); }
.brand .brand-link { min-width: 0; flex: 1 1 auto; }
@media (min-width: 1025px) {
  .gf-sb-toggle { display: flex; }
  #sidebar { transition: width .22s ease, background .25s; overflow-x: hidden; }
  .gf-sb-collapsed #sidebar { width: 72px; padding-left: 10px; padding-right: 10px; }
  .gf-sb-collapsed .brand { justify-content: center; padding: 4px 0 18px; }
  .gf-sb-collapsed .brand-link { display: none !important; }
  .gf-sb-collapsed .nav-item { font-size: 0; gap: 0; justify-content: center; padding: 11px 0; }
  .gf-sb-collapsed .nav-item i { font-size: 20px; }
  .gf-sb-collapsed .nav-label { font-size: 0; padding: 0; margin: 10px 10px 6px; border-top: 1px solid var(--border); }
}
#sidebar {
  width: var(--sidebar-w); background: var(--surface);
  display: flex; flex-direction: column; flex-shrink: 0;
  padding: 18px 12px; overflow-y: auto;
  transition: background .25s;
}
.brand { display: flex; align-items: center; gap: 6px; padding: 4px 2px 18px; }
.brand-logo {
  width: 32px; height: 32px; border-radius: 10px; background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-ink); font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.brand-name { font-weight: 600; font-size: 15px; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 13px; border-radius: 11px; margin-bottom: 2px;
  font-size: 13.5px; color: var(--muted); cursor: pointer;
  text-decoration: none; transition: background .15s, color .15s;
}
.nav-item i { font-size: 18px; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent); color: var(--accent-ink); font-weight: 500; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--faint); padding: 14px 13px 5px; }

.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.admin-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 11px; cursor: pointer; transition: background .15s; }
.admin-chip:hover { background: var(--surface-2); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent);
  color: var(--accent-ink); display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.admin-name { font-size: 12.5px; font-weight: 500; }
.admin-role { font-size: 11px; color: var(--faint); }
.logout {
  display: flex; align-items: center; gap: 9px; padding: 9px 8px; margin-top: 4px;
  color: var(--danger); font-size: 13px; text-decoration: none; border-radius: 9px;
  transition: background .15s;
}
.logout:hover { background: var(--danger-soft); }

/* ── Main ── */
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; min-height: 0; }
#topbar {
  display: flex; align-items: center; gap: 12px; padding: 14px 20px; flex-shrink: 0;
}
.search {
  flex: 1; max-width: 420px; display: flex; align-items: center; gap: 9px;
  background: var(--surface); border-radius: 11px; padding: 9px 14px;
  box-shadow: var(--shadow); color: var(--faint); font-size: 13px;
}
.search input { flex: 1; border: none; outline: none; background: none; color: var(--text); font-size: 13px; font-family: var(--font); }
.search input::placeholder { color: var(--faint); }
.kbd { font-size: 11px; color: var(--muted); background: var(--surface-2); padding: 3px 8px; border-radius: 6px; }
.spacer { flex: 1; }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.icon-btn {
  width: 38px; height: 38px; border-radius: 11px; background: var(--surface);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  color: var(--muted); box-shadow: var(--shadow); position: relative; border: none;
  transition: color .15s;
}
.icon-btn:hover { color: var(--text); }
.icon-btn i { font-size: 18px; }
.icon-btn .badge-dot { position: absolute; top: 9px; right: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }
/* Icon-only button with a label that appears only on hover/focus (e.g. the theme toggle). */
.icon-btn[data-tip]::after {
  content: attr(data-tip); position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;
  white-space: nowrap; background: var(--text); color: var(--surface); font-size: 11.5px; font-weight: 600;
  padding: 5px 9px; border-radius: 7px; box-shadow: var(--shadow); pointer-events: none;
  opacity: 0; transform: translateY(-3px); transition: opacity .15s, transform .15s;
}
.icon-btn[data-tip]:hover::after, .icon-btn[data-tip]:focus-visible::after { opacity: 1; transform: none; }

/* Number fields: the browser's stock spinner is a white box (even in dark mode) that can't be styled.
   It's hidden, and partials/num-stepper draws a slim themed up/down stepper on hover/focus instead.
   Typing, the arrow keys and the mouse wheel still step the value. */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.gf-step {
  position: fixed; z-index: 9990; display: none; flex-direction: column; width: 22px; padding: 2px;
  background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 8px; box-shadow: var(--shadow);
}
.gf-step.show { display: flex; }
.gf-step button {
  flex: 1; display: flex; align-items: center; justify-content: center; border: none; background: none;
  color: var(--muted); border-radius: 5px; cursor: pointer; padding: 0; min-height: 0; line-height: 1; transition: background .12s, color .12s;
}
.gf-step button:hover { background: var(--accent-soft); color: var(--accent); }
.gf-step button:active { background: var(--accent); color: var(--accent-ink); }
.gf-step svg { width: 10px; height: 6px; display: block; pointer-events: none; }
@media (pointer: coarse) { .gf-step { display: none !important; } }

/* The app draws its own eye toggle on password fields — hide the browser's built-in
   reveal/clear buttons (Edge) so only ONE eye ever shows. */
input[type="password"]::-ms-reveal, input[type="password"]::-ms-clear { display: none; }

/* min-height:0 lets the flex child shrink to the screen so it scrolls instead of growing past it. */
#content { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; padding: 6px 20px 24px; padding-bottom: max(24px, env(safe-area-inset-bottom)); }

.page-head { margin-bottom: 16px; }
.page-title { font-size: 18px; font-weight: 600; }
.page-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ── Cards ── */
.card { background: var(--surface); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title { font-size: 14px; font-weight: 600; }
.card-link { font-size: 12px; color: var(--accent); cursor: pointer; text-decoration: none; }
.pill-btn { font-size: 12px; color: var(--muted); background: var(--surface-2); padding: 5px 11px; border-radius: 8px; cursor: pointer; }

/* ── Stat cards ── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { background: var(--surface); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow); transition: transform .18s ease; }
.stat:hover { transform: translateY(-3px); }
.stat-top { display: flex; align-items: center; gap: 9px; }
.stat-chip { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.stat-chip i { font-size: 15px; }
.stat-label { font-size: 12.5px; color: var(--muted); }
.stat-value { font-size: 26px; font-weight: 600; margin-top: 12px; }
.stat-foot { font-size: 11px; color: var(--faint); margin-top: 2px; }

.chip-mint   { background: var(--success-soft); } .chip-mint i   { color: var(--success); }
.chip-red    { background: var(--danger-soft); }  .chip-red i    { color: var(--danger); }
.chip-amber  { background: var(--warn-soft); }    .chip-amber i  { color: var(--warn); }
.chip-indigo { background: var(--info-soft); }    .chip-indigo i { color: var(--info); }

/* ── Grid ── */
.grid-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* ── Table ── */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; color: var(--faint); font-weight: 500; padding: 9px 8px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 11px 8px; font-size: 13px; border-bottom: 1px solid var(--border); }
.tbl tr:last-child td { border-bottom: none; }
.tbl .sub { font-size: 11px; color: var(--faint); }
.row-avatar { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; }

/* ── Pills / tags ── */
.pill { display: inline-block; font-size: 11.5px; font-weight: 500; padding: 3px 11px; border-radius: 99px; }
.pill-open      { background: var(--info-soft); color: var(--info); }
.pill-completed { background: var(--success-soft); color: var(--success); }
.pill-pending   { background: var(--warn-soft); color: var(--warn); }
.pill-cancelled { background: var(--danger-soft); color: var(--danger); }

/* ── Progress ── */
.bar-track { height: 7px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; width: 0; transition: width .9s cubic-bezier(0.22,0.61,0.36,1); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 10px; font-size: 13px; font-weight: 500; font-family: var(--font); border: none; cursor: pointer; transition: filter .15s, background .15s; text-decoration: none; }
.btn i { font-size: 16px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
/* A disabled button must look (and act) unclickable — e.g. "Create booking" until the form is complete. */
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; filter: none; }

/* ── Browser autofill ──
   Chrome / Edge paint a field the browser filled in (saved username or password) with
   their own light-blue / white background and dark text, which looked like the field
   "turning white" after Tab or a click elsewhere. Keep our own colours instead, in light
   and dark mode, on every portal (sign-in, registration, forms). */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px var(--surface-2) inset !important;
  box-shadow: 0 0 0 1000px var(--surface-2) inset !important;
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text);
  transition: background-color 600000s 0s, color 600000s 0s;
}
input:autofill { background: var(--surface-2) !important; color: var(--text) !important; }

/* ── Modern close (X) button — one look for every popup, dialog, tray and confirmation ─────
   A soft round button with a crisp icon; it turns red on hover (no rotation). Covers every
   close control in the admin, customer and crew portals plus the sign-in / sign-up pages. */
.gf-x, .inv-dialog-head .ctool, .card-max-head .ctool, .cp-x, .gfi-x, .rg-x, .lo-policy-x, .gfa-x, .pos-x, .dash-x {
  -webkit-appearance: none; appearance: none;
  width: 34px; height: 34px; min-width: 34px; border-radius: 50%; border: 0; padding: 0; margin: 0;
  background: var(--surface-2); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit; font-size: 18px; line-height: 1; cursor: pointer; flex-shrink: 0;
  transition: background .16s ease, color .16s ease;
}
.gf-x i, .ctool i, .cp-x i, .gfi-x i, .rg-x i, .lo-policy-x i, .gfa-x i { font-size: inherit; pointer-events: none; }
.gf-x:hover, .inv-dialog-head .ctool:hover, .card-max-head .ctool:hover, .cp-x:hover, .gfi-x:hover, .rg-x:hover, .lo-policy-x:hover, .gfa-x:hover, .pos-x:hover, .dash-x:hover {
  background: var(--danger-soft, rgba(220,38,38,.12)); color: var(--danger, #dc2626);
}
.gf-x:active, .cp-x:active, .gfi-x:active, .inv-dialog-head .ctool:active { transform: scale(.92); }
.gf-x:focus-visible, .cp-x:focus-visible, .gfi-x:focus-visible, .inv-dialog-head .ctool:focus-visible, .rg-x:focus-visible, .lo-policy-x:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gf-x-sm, .gfa-x { width: 26px; height: 26px; min-width: 26px; font-size: 14px; }
.gfa-x { margin-left: auto; }
/* ── Top-bar global search results ── */
.gf-gsearch{position:relative}
.gs-panel{position:absolute;left:0;right:0;top:calc(100% + 8px);z-index:1200;background:var(--surface);border:1px solid var(--border);border-radius:14px;box-shadow:0 18px 50px rgba(0,0,0,.28);max-height:min(70vh,520px);overflow-y:auto;padding:6px}
.gs-panel[hidden]{display:none}
.gs-group{display:flex;align-items:center;gap:7px;font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);padding:10px 10px 4px}
.gs-item{display:flex;flex-direction:column;gap:1px;padding:8px 10px;border-radius:9px;color:var(--text);text-decoration:none}
.gs-item:hover,.gs-item.hl{background:var(--surface-2)}
.gs-t{font-size:13.5px;font-weight:500}
.gs-s{font-size:12px;color:var(--muted)}
.gs-empty{padding:16px;color:var(--muted);font-size:13px;text-align:center}

/* ══ Readability pass (2026-10-15) ══
   Text colours that were too pale to read comfortably (light mode: grey #94a3b8 and mint #10b981 on white
   are only ~2.5:1; dark mode: grey #6b7280 on the dark cards ~3.5:1). The dark tones keep the design,
   they just reach a readable contrast. Accent *backgrounds* are unchanged. */
:root { --faint: #667085; --accent-text: #047857; --warn-text: #b45309; }
html[data-theme="dark"] { --faint: #8a93a6; --muted: #a3abbd; --accent-text: var(--accent); --warn-text: #f0c060; }

/* mint / amber used as TEXT (inline styles and the classes that do it) */
html:not([data-theme="dark"]) [style^="color:var(--accent)"],
html:not([data-theme="dark"]) [style*=";color:var(--accent)"],
html:not([data-theme="dark"]) [style*="; color:var(--accent)"] { color: var(--accent-text) !important; }
html:not([data-theme="dark"]) [style^="color:var(--warn)"],
html:not([data-theme="dark"]) [style*=";color:var(--warn)"],
html:not([data-theme="dark"]) [style*="; color:var(--warn)"] { color: var(--warn-text) !important; }
html:not([data-theme="dark"]) .pill-pending { color: var(--warn-text); }
html:not([data-theme="dark"]) :is(.pcatlbl, .pc, .bk-sec, .card-link, .gf-conv-av, .go, .gnc-tabs button.on, .stat-value.accent, .pos-total span:last-child, .pay-due span:last-child, .gfi-linkbtn, .pay-keytoggle) { color: var(--accent-text); }
.sp-chips button.on { color: var(--accent-ink) !important; }

/* sidebar brand: the logo + name + tagline always fit next to the menu button (never cropped) */
#sidebar .brand .bl-sm .bl-mark { height: 28px; }
#sidebar .brand .bl-sm .bl-name { font-size: 17px; }
#sidebar .brand .bl-sm .bl-sub { font-size: 7.5px; letter-spacing: .09em; }

/* ── the system date & time chip (admin top bar) ── */
.gf-clockchip{display:inline-flex;align-items:center;gap:7px;height:38px;padding:0 12px;border-radius:12px;background:var(--surface);color:var(--text);box-shadow:var(--shadow);font-size:12.5px;font-weight:600;text-decoration:none;white-space:nowrap;border:1px solid var(--border)}
.gf-clockchip:hover{border-color:var(--accent)}
.gf-clockchip i{color:var(--accent);font-size:16px}
.gf-clockchip b{font-size:10px;text-transform:uppercase;letter-spacing:.04em;background:var(--warn,#d97706);color:#fff;border-radius:99px;padding:2px 7px}
.gf-clockchip.sim{border-color:var(--warn,#d97706)}
@media(max-width:900px){.gf-clockchip span{display:none}.gf-clockchip{padding:0 10px}}

/* ── a task that is locked until its scheduled date + time ── */
.gf-lockbanner{display:flex;gap:11px;align-items:flex-start;background:var(--warn-soft,rgba(217,119,6,.13));border:1px solid var(--warn,#d97706);color:var(--text);border-radius:12px;padding:11px 13px;margin:0 0 14px;font-size:13px}
.gf-lockbanner i{color:var(--warn,#d97706);font-size:20px;flex:none;margin-top:1px}
.gf-lockbanner b{display:block;font-size:13.5px}.gf-lockbanner span{display:block;color:var(--muted);font-size:12px;margin-top:2px;line-height:1.45}

/* Installation locked for missing materials (admin + crew popups) */
.gf-matshort{border:1px solid var(--warn,#d97706);background:color-mix(in srgb,var(--warn,#d97706) 10%,transparent);border-radius:12px;padding:10px 12px;margin-bottom:8px;font-size:12.5px;color:var(--text,inherit)}
.gf-matshort-h{font-weight:700;color:var(--warn,#d97706);display:flex;align-items:center;gap:6px;margin-bottom:4px}
.gf-matshort ul{margin:0;padding-left:18px}
.gf-matshort li{margin:2px 0}

/* Sidebar number indicators (Inventory, Crew Management) */
.nav-item{position:relative}
.nav-badge{margin-left:auto;min-width:20px;height:20px;padding:0 6px;border-radius:10px;background:var(--danger,#dc2626);color:#fff;font-size:11px;font-weight:700;line-height:20px;text-align:center;box-sizing:border-box;flex:none}
.nav-badge[hidden]{display:none}
.gf-sb-collapsed .nav-badge{position:absolute;top:3px;right:6px;min-width:17px;height:17px;line-height:17px;font-size:10px;padding:0 4px}

/* small avatar beside a name in a table */
.gf-avsm{width:26px;height:26px;border-radius:50%;overflow:hidden;flex:none;display:inline-flex;align-items:center;justify-content:center;font-size:10px;font-weight:700;background:var(--accent-soft,rgba(16,185,129,.15));color:var(--accent)}
