@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@500&display=swap');

:root {
  --ink: #1C2B2E;
  --ink-soft: #4B5B57;
  --surface: #F0F2F0;
  --accent: #2F6F5E;
  --accent-soft: #E4EEEA;
  --amber: #C97A2B;
  --amber-soft: #F6E7D6;
  --danger: #B23B3B;
  --border: #D8DCD6;
  --font-head: 'Space Grotesk', sans-serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

body {
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
}
h1, h2, h3, .sb-brand-font { font-family: var(--font-head); font-weight: 600; letter-spacing: -0.01em; }

/* Buttons: retint Bootstrap's primary to the accent colour */
.btn-primary {
  background-color: var(--accent);
  border-color: var(--accent);
}
.btn-primary:hover, .btn-primary:focus {
  background-color: #275c4e;
  border-color: #275c4e;
}
.btn-outline-light:hover { color: var(--ink); }

/* ---------- Shell ---------- */

.sb-shell { min-height: 100vh; }
.sb-sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--ink);
  color: #E7ECE9;
  min-height: 100vh;
}
/* Same dark palette as the desktop sidebar, but its own class — the
   offcanvas needs Bootstrap's own display/transform/width handling for
   the slide-in drawer to work, which a shared class with fixed
   width/min-height/flex-shrink would fight against. */
.sb-mobile-nav {
  background: var(--ink);
  color: #E7ECE9;
  width: 260px;
}
.sb-mobile-nav .offcanvas-header { border-bottom: 1px solid rgba(255,255,255,0.14); }
.sb-mobile-topbar {
  background: var(--ink);
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.14);
}
.sb-mobile-topbar .sb-company-name { color: #fff; font-size: 15px; }
.sb-mobile-menu-btn { color: #fff; border: none; background: none; padding: 4px 8px; }
.sb-mobile-menu-btn:hover { background: rgba(255,255,255,0.08); border-radius: 6px; }
/* The always-on-top-of-content sidebar footer's language picker uses a
   light toggle button by default (see the .sb-login-card rule further
   down) — the mobile top bar sits on the same dark background as the
   sidebar, so its picker needs the dark styling instead, not the light
   one meant for white cards. */
.sb-mobile-topbar .sb-lang-toggle {
  border-color: rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08);
}
.sb-brand { font-family: var(--font-mono); font-size: 13px; color: #8FBBAC; }
.sb-company-name { font-family: var(--font-head); font-weight: 600; font-size: 17px; word-break: break-word; }
.sb-nav-link { color: #C7D2CC !important; border-radius: 6px; }
.sb-nav-link:hover { background: rgba(255,255,255,0.06); }
.sb-nav-link.active { background: rgba(255,255,255,0.12) !important; color: #fff !important; font-weight: 500; }
/* Menu group headings (Today / People / Setup) */
.sb-nav-group { list-style: none; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: rgba(199,210,204,.55); padding: 14px 12px 4px; }
.sb-nav-group:first-child { padding-top: 0; }
.sb-sidebar-footer { border-top: 1px solid rgba(255,255,255,0.14); font-size: 13px; }
.sb-user-name { color: #fff; }
.sb-role-badge { background: rgba(143,187,172,0.2); color: #8FBBAC; font-weight: 500; }
.sb-lang-select { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.25); color: #fff; }
.sb-main { max-width: 1100px; }

.sb-flag-row { display: flex; gap: 6px; flex-wrap: wrap; }
.sb-flag-link {
  display: inline-block;
  border-radius: 4px;
  padding: 2px;
  border: 2px solid transparent;
  line-height: 0;
  opacity: 0.6;
}
.sb-flag-link:hover { opacity: 0.85; }
.sb-flag-link.active { opacity: 1; border-color: var(--accent); }
.sb-flag-link img { display: block; border-radius: 2px; }

/* ---------- Custom country picker (real flag icons, not emoji) ---------- */

.sb-country-picker { position: relative; }
.sb-country-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.sb-country-toggle::after {
  content: "";
  display: inline-block;
  width: 0; height: 0;
  border-top: 5px solid currentColor;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  opacity: 0.6;
  margin-left: 8px;
  flex-shrink: 0;
}
.sb-country-toggle-content { display: inline-flex; align-items: center; gap: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-country-menu { max-height: 280px; overflow-y: auto; width: 100%; padding: 4px; }
.sb-country-item { display: flex; align-items: center; gap: 8px; border-radius: 4px; }
.sb-country-item .fi, .sb-country-toggle-content .fi { flex-shrink: 0; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,0.08); }

/* ---------- Compact language picker (flag only, name on hover via title=) ---------- */

.sb-lang-picker { display: inline-block; }
/* 23 languages no longer fit on screen as a plain dropdown — without a
   capped height and scroll, the menu can render taller than the
   viewport with no way to reach the languages further down the list. */
.sb-lang-picker .dropdown-menu {
  max-height: 320px;
  overflow-y: auto;
}
.sb-lang-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08);
  cursor: pointer;
}
.sb-lang-toggle .fi { border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,0.08); }
/* On light backgrounds (login/register cards) the dark sidebar styling doesn't fit */
.sb-login-card .sb-lang-toggle, .card .sb-lang-toggle, .home-nav .sb-lang-toggle {
  border-color: var(--border);
  background: #fff;
}

/* ---------- Google Places search boxes (locations page) ---------- */

#loc-address-search, #loc-city-search {
  color-scheme: light;
  min-height: 38px;
}
#loc-address-search gmp-place-autocomplete,
#loc-city-search gmp-place-autocomplete {
  --gmpx-color-surface: #FFFFFF;
  --gmpx-color-on-surface: #1C2B2E;
  --gmpx-color-on-surface-variant: #4B5B57;
  --gmpx-color-outline: #D8DCD6;
  width: 100%;
}

/* ---------- Login ---------- */

.sb-login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.sb-login-card { width: 360px; }
.sb-login-card .sb-brand { font-size: 13px; margin-bottom: 14px; display: block; }

/* ---------- Tables & data ---------- */

.table { background: #fff; }
.sb-mono { font-family: var(--font-mono); font-size: 13px; color: var(--ink-soft); }

.shift-chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 4px;
  color: #fff;
  border: none;
}
.shift-chip.empty {
  background: transparent;
  color: var(--ink-soft);
  border: 1px dashed var(--border);
}

/* Approved leave on the schedule grid — deliberately striped rather than
   a flat fill, so it reads as "a different kind of thing" from a shift at
   a glance, not just a shift that happens to be colored green or grey. */
.leave-chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  color: #fff;
  border: none;
  cursor: default;
}
.leave-chip.vacation {
  background: repeating-linear-gradient(135deg, var(--accent), var(--accent) 6px, #256352 6px, #256352 12px);
}
.leave-chip.unpaid {
  background: repeating-linear-gradient(135deg, var(--ink-soft), var(--ink-soft) 6px, #3a4846 6px, #3a4846 12px);
}
.leave-chip.sick {
  background: repeating-linear-gradient(135deg, #b5533c, #b5533c 6px, #8f3f2d 6px, #8f3f2d 12px);
}
.leave-chip.business_trip {
  background: repeating-linear-gradient(135deg, #3d6aa8, #3d6aa8 6px, #2f5487 6px, #2f5487 12px);
}
/* Doctor visit: a few hours inside a working day, shown next to the shift chip rather than instead of it. */
.doc-chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 6px;
  margin-left: 2px;
  border-radius: 10px;
  background: #e3f1f7;
  color: #1f5a73;
  cursor: help;
  white-space: nowrap;
}

.roster-group { margin-bottom: 24px; }
.roster-group h3 { font-size: 14px; color: var(--ink-soft); font-weight: 500; margin-bottom: 8px; }
.roster-table td, .roster-table th { text-align: center; vertical-align: middle; }
.roster-table td:first-child, .roster-table th:first-child { text-align: left; }

.sb-empty {
  color: var(--ink-soft);
  padding: 28px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: #fff;
}

/* ---------- Kiosk (registrar) ---------- */

.kiosk-shell { min-height: 100vh; background: var(--surface); }
.kiosk-header { background: #fff; border-bottom: 1px solid var(--border); }
.kiosk-row {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kiosk-row .name { font-weight: 600; font-size: 16px; }
.kiosk-row .shift-time { font-family: var(--font-mono); color: var(--ink-soft); font-size: 13px; }
.kiosk-row .status { font-size: 13px; color: var(--ink-soft); margin-right: 14px; }
.kiosk-row .status.in { color: var(--accent); }
.kiosk-row .status.out { color: var(--danger); }
.kiosk-row .btn { font-size: 15px; padding: 10px 18px; }

/* The small ✕ beside a kiosk photo in the attendance log: quiet until hovered. */
.sb-photo { margin-right: 10px; }
.sb-photo-x { font-size: 12px; line-height: 1; margin-left: 2px; vertical-align: super; color: var(--ink-soft) !important; text-decoration: none; opacity: .55; }
.sb-photo-x:hover, .sb-photo-x:focus { opacity: 1; color: #b3261e !important; }

/* Org chart — classic pure-CSS tree. The same two rules apply uniformly
   at every level, which is the point: each <li> draws its OWN vertical
   drop (the ::after border-left, full height) and a horizontal segment
   reaching toward its LEFT sibling (the ::before border-top) — so a row
   of siblings' bars join up into one continuous horizontal line with no
   separate "which level am I" logic anywhere. Each <ul> then draws one
   short vertical line from its parent <li> down to that row. */
.org-zoom-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.org-zoom-level {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
  min-width: 42px;
  text-align: center;
}
.org-zoom-hint {
  font-size: 12px;
  color: var(--ink-soft);
  margin-left: 8px;
}
/* A bounded, fixed-size window onto the chart — panzoom pans/zooms the
   .org-zoom-wrapper inside it via its own transform, so this needs a
   real height and hidden overflow rather than the page's natural flow
   (unlike a plain scrollbar, there's no "natural" height for content
   that can be dragged anywhere and zoomed arbitrarily large). Resizable
   so a tall hierarchy isn't stuck at one fixed window size either. */
.org-chart-viewport {
  position: relative;
  overflow: hidden;
  height: 70vh;
  min-height: 360px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: repeating-linear-gradient(45deg, #fff, #fff 20px, #fafbfa 20px, #fafbfa 40px);
  cursor: grab;
}
.org-chart-viewport:active {
  cursor: grabbing;
}
.org-zoom-wrapper {
  display: inline-block;
  padding: 24px;
}
.org-tree, .org-tree ul {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: center;
  position: relative; /* so a nested ul's own ::before anchors to IT, not to the parent li it escapes up to otherwise */
}
.org-tree {
  justify-content: center;
}
.org-tree li {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 10px 0 10px;
}
.org-tree li::before,
.org-tree li::after {
  content: '';
  position: absolute;
  top: 0;
  right: 50%;
  width: 50%;
  height: 24px;
  border-top: 2px solid var(--border);
}
.org-tree li::after {
  right: auto;
  left: 50%;
  border-left: 2px solid var(--border);
  border-top: 2px solid var(--border);
}
/* The outermost child in a row shouldn't reach further left/right than
   its own center — nothing out there to connect to. */
.org-tree li:first-child::before { border: none; }
.org-tree li:last-child::after { border-top: none; }
/* A single child has no siblings to draw a bar toward at all — just its
   own straight vertical drop. */
.org-tree li:only-child {
  padding-top: 24px;
}
.org-tree li:only-child::before,
.org-tree li:only-child::after {
  display: none;
}
/* One short vertical line from a node down to the horizontal bar above
   its row of children — same rule at every nesting depth. */
.org-tree li > ul::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  height: 24px;
  border-left: 2px solid var(--border);
}
/* Top-level roots have no incoming line from above to connect that first
   drop to, so their own row skips the connector lines entirely. */
.org-tree > li::before,
.org-tree > li::after {
  display: none;
}
.org-tree > li {
  padding-top: 0;
}

.org-box {
  position: relative;
  display: inline-block;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  min-width: 140px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.org-box.org-inactive {
  opacity: 0.55;
  border-style: dashed;
}
.org-box.org-box-manager {
  border-color: var(--accent);
  border-width: 2px;
  background: var(--accent-soft);
}
.org-name {
  font-weight: 600;
  font-size: 14px;
}
.org-meta {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 2px;
}

.sb-admin-card {
  color: var(--ink);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.sb-admin-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  border-color: var(--accent);
}

.sb-sidebar-avatar {
  display: block;
  margin: 0 auto 10px;
}
.sb-avatar-lg, .sb-avatar-md, .sb-avatar-sm {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.sb-avatar-lg { width: 72px; height: 72px; }
.sb-avatar-md { width: 56px; height: 56px; }
.sb-avatar-sm { width: 32px; height: 32px; font-size: 14px !important; }
.sb-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 28px;
  text-transform: uppercase;
}
.sb-avatar-md.sb-avatar-placeholder { font-size: 22px; }

/* Reorderable blocks (assets/js/sortable.js) */
.sb-grip-group { display: inline-flex; align-items: center; gap: 2px; opacity: .4; transition: opacity .15s; white-space: nowrap; }
[data-sort-id]:hover .sb-grip-group, .sb-grip-group:focus-within { opacity: 1; }
.sb-grip { cursor: grab; user-select: none; padding: 0 4px; font-size: 16px; line-height: 1; color: var(--ink-soft, #6c757d); }
.sb-grip:active { cursor: grabbing; }
.sb-move { border: 0; background: transparent; padding: 0 3px; font-size: 11px; line-height: 1; color: var(--ink-soft, #6c757d); cursor: pointer; }
.sb-move:hover { color: #000; }
.sb-dragging { opacity: .35; }

/* Holidays: highlighted day columns in the manager's roster */
.roster-table th.hol-day, .roster-table td.hol-day { background: #fff6e0 !important; }
.roster-table th.hol-day .hol-name { font-size: .65rem; font-weight: 500; color: #b7791f; line-height: 1.15; white-space: normal; }

/* Schedule: a shift placed by a repeating pattern */
.shift-chip-repeat { opacity: .8; font-size: .9em; }
.doc-chip[role="button"], .leave-chip[role="button"] { cursor: pointer; }

/* "Saved" note shown in the corner after saving a long page (assets/js/ui.js) */
.sb-toast { position: fixed; right: 16px; bottom: 16px; z-index: 1080; max-width: min(420px, calc(100vw - 32px)); margin: 0; transition: opacity .6s; }
.sb-toast-hide { opacity: 0; }
