:root {
  --bg: #0f1220;
  --card: #151a2e;
  --text: #e8e8ff;
  --muted: #a9aacf;
  --primary: #8A2BE2;
  --frost: #63c6ff;
  --danger: #e05555;
  --chip: #2a2f4a;
  --radius: 16px;
  --sidebar-width: 80vw;
  --segmented-bg: #131732;
  --segmented-border: #2f3462;
  --segmented-divider: #262b4f;
  --segmented-fg: #dcdfff;
  --segmented-active-bg: #f4f2ff;
  --segmented-active-fg: #18133d;
  --segmented-focus: rgba(138, 43, 226, 0.55);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: ui-sans-serif, system-ui, Arial, sans-serif; }
a { color: var(--text); text-decoration: none; }
img { max-width: 100%; display: block; }
.sidebar-header { display:flex; flex-direction:column; align-items:flex-start; gap:16px; padding: 12px 10px 10px; }
.freeze-lockup { display:flex; align-items:center; gap:12px; }
.freeze-logo { width:46px; height:46px; object-fit:contain; filter: drop-shadow(0 0 10px rgba(80, 180, 255, 0.35)); }
.freeze-copy { gap:2px; }
.freeze-name { font-size:20px; font-weight:700; letter-spacing:0.6px; }
.freeze-caption { font-size:12px; letter-spacing:1px; text-transform:uppercase; color: var(--muted); }
.brand-identity { display:flex; flex-direction:column; gap:6px; }
.frostops-lockup { display:flex; align-items:center; gap:12px; }
.brand-logo-img { width:48px; height:48px; object-fit:contain; filter: drop-shadow(0 0 12px rgba(138, 43, 226, 0.35)); }
.frostops-logo { width:52px; height:52px; }
.brand-copy { display:flex; flex-direction:column; gap:4px; }
.brand-name { font-size:18px; font-weight:600; letter-spacing:0.4px; }
.frostops-name { font-size:20px; font-weight:700; letter-spacing:0.6px; }
.brand-caption { display:flex; align-items:center; gap:6px; color: var(--muted); font-size:13px; text-transform:uppercase; letter-spacing:1px; }
.brand-caption-logo { width:26px; height:26px; object-fit:contain; filter:none; opacity:0.9; }
.brand-caption-text { display:inline-flex; align-items:center; gap:4px; }
.brand-user { display:flex; flex-direction:column; align-items:flex-end; gap:4px; }
.user-name { font-size:14px; color: var(--muted); font-weight:500; }

@media (max-width: 600px) {
  .sidebar-header { gap:14px; }
  .brand-user { align-items:flex-start; }
  .frostops-lockup { gap:10px; }
  .frostops-name { font-size:18px; }
  .brand-caption { font-size:12px; letter-spacing:0.8px; }
}
.nav-btn { padding: 12px 14px; border-radius: 10px; background: transparent; border: 1px solid #2b2f51; display:block; margin:8px 0; width:100%; text-align:left; color: var(--text); }
.nav-btn:hover { background:#1b1f36; }
.nav-btn.danger { border-color: rgba(224, 85, 85, 0.6); background: rgba(224, 85, 85, 0.16); color: #ff8c8c; }
.nav-btn.danger:hover { background: rgba(224, 85, 85, 0.26); }
.content { padding: 16px; }
.card { background: var(--card); border: 1px solid #222647; border-radius: var(--radius); padding: 16px; margin: 10px 0; max-width: 100%; }
.card.narrow { max-width: 420px; margin: 30px auto; }
.grid { display:grid; gap:12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.form { display: grid; gap: 10px; }
.form > * { min-width: 0; }
.form .label { overflow-wrap: anywhere; word-break: break-word; }
.label { font-size: 14px; color: var(--muted); }
.input {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #2a2e4f;
  background: #0f1430;
  color: var(--text);
}

.upload-form {
  gap: 18px;
}

.upload-group {
  border: 1px solid rgba(138, 43, 226, 0.7);
  border-radius: 18px;
  padding: 52px 22px 22px;
  margin: 0;
  background: linear-gradient(135deg, rgba(138, 43, 226, 0.52), rgba(99, 198, 255, 0.4));
  position: relative;
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: 0 28px 54px rgba(15, 20, 48, 0.42);
}

.upload-legend {
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px;
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  background: rgba(15, 20, 48, 0.92);
  border-radius: 999px;
  border: 1px solid rgba(118, 126, 204, 0.75);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.28);
}

.upload-legend__title {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.upload-legend__meta {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(138, 43, 226, 0.32), rgba(99, 198, 255, 0.24));
  border: 1px solid rgba(138, 43, 226, 0.5);
  box-shadow: 0 8px 20px rgba(15, 20, 48, 0.25);
  margin-top: 2px;
}

.upload-count {
  margin-top: 14px;
  font-size: 0.9rem;
  color: var(--muted);
}

.upload-group .input[type="file"] {
  border-style: dashed;
  border-color: rgba(138, 43, 226, 0.85);
  background: linear-gradient(135deg, rgba(138, 43, 226, 0.36), rgba(99, 198, 255, 0.28));
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(99, 198, 255, 0.45);
  cursor: pointer;
}

.upload-group .input[type="file"]::-webkit-file-upload-button {
  color: var(--text);
  background: linear-gradient(135deg, rgba(138, 43, 226, 0.6), rgba(99, 198, 255, 0.45));
  border: 1px solid rgba(138, 43, 226, 0.75);
  border-radius: 10px;
  padding: 8px 14px;
  margin-inline-end: 12px;
  cursor: pointer;
}

.upload-group .input[type="file"]::file-selector-button {
  color: var(--text);
  background: linear-gradient(135deg, rgba(138, 43, 226, 0.6), rgba(99, 198, 255, 0.45));
  border: 1px solid rgba(138, 43, 226, 0.75);
  border-radius: 10px;
  padding: 8px 14px;
  margin-inline-end: 12px;
  cursor: pointer;
}

.upload-group .muted {
  color: #dfe6ff;
}
.input[type="date"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  inline-size: 100%;
  min-inline-size: 0;
}

/* Flex/grid shrink helpers for date fields.
   Tailwind equivalents: min-w-0, break-words, truncate */
.fp-shrink,
.fp-date-wrap {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.fp-date {
  max-width: 100%;
  box-sizing: border-box;
  font-size: 16px;
  line-height: 1.25;
}

.fp-date--wrap {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.fp-date--cut {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.label,
.fp-label-wrap {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.input.readonly,
.input[readonly] {
  background: #111633;
  color: var(--muted);
  border-color: #1f2340;
  cursor: not-allowed;
}
.helper-text {
  font-size: 13px;
  color: var(--muted);
  margin: -4px 0 8px;
}
.btn { padding: 12px 16px; border-radius: 14px; border: 1px solid #2a2e4f; background:#161b34; color: var(--text); }
.btn.full-width { width: 100%; display: inline-flex; justify-content: center; margin-top: 16px; }
.btn.primary { background: var(--primary); border-color: #6d1ec2; }
.btn:active { transform: scale(0.98); }
.row { display:flex; gap:10px; align-items:center; }
.row-between { display:flex; justify-content:space-between; align-items:center; gap:10px; }
.row-end { display:flex; justify-content:flex-end; gap:10px; }
.card .row > *,
.table-row > *,
.grid-item {
  min-width: 0;
}

.segmented-field {
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.segmented-field legend {
  padding: 0;
  margin: 0;
}

.segmented-control {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-radius: 14px;
  overflow: hidden;
  background: var(--segmented-bg);
  border: 1px solid var(--segmented-border);
  min-width: 0;
}

.segmented-control input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control .segment {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 500;
  color: var(--segmented-fg);
  padding: 12px 10px;
  min-height: 48px;
  background: transparent;
  border-inline-end: 1px solid var(--segmented-divider);
  transition: background 0.2s ease, color 0.2s ease, font-weight 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  text-align: center;
  user-select: none;
  line-height: 1.2;
}

.segmented-control .segment:last-of-type {
  border-inline-end: none;
}

.segmented-control input[type="radio"]:checked + .segment {
  background: var(--segmented-active-bg);
  color: var(--segmented-active-fg);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--segmented-border);
}

.segmented-control input[type="radio"]:focus-visible + .segment {
  outline: 3px solid var(--segmented-focus);
  outline-offset: -3px;
}

.segmented-control .segment:hover {
  background: color-mix(in srgb, var(--segmented-active-bg) 12%, transparent);
}

.segmented-control input[type="radio"]:checked + .segment:hover {
  background: var(--segmented-active-bg);
}

.segmented-control .segment:active {
  transform: scale(0.98);
}

.segmented-control {
  touch-action: manipulation;
}

.list { list-style:none; padding:0; margin:10px 0 0; }
.list-row { display:flex; justify-content:space-between; align-items:center; padding: 12px 0; border-bottom: 1px solid #20243e; flex-wrap: wrap; }
.list-row > * { min-width: 0; }
.list-row strong,
.list-row .muted { overflow-wrap: anywhere; word-break: break-word; }
.col.right {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.pager { display:flex; gap:10px; align-items:center; justify-content:center; margin-top: 12px; }
.flash-wrap { margin: 8px 0; }
.flash { padding: 10px; border-radius: 10px; margin: 6px 0; }
.flash.success { background:#0e3a2c; border:1px solid #1f6b4e; }
.flash.error { background:#3a0e20; border:1px solid #6b1f36; }
.muted { color: var(--muted); }
.chip { display:inline-block; padding: 4px 8px; border-radius: 999px; background: var(--chip); color: #cfd1ff; font-size: 12px; margin-right: 6px; }
.thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid #2a2e4f; }

.page-wrap { max-width: 960px; margin: 0 auto; padding: 24px 8px 48px; display: flex; flex-direction: column; gap: 24px; }
.page-header { display: flex; flex-direction: column; gap: 8px; }
.page-title { font-size: clamp(1.6rem, 2.8vw, 2.2rem); font-weight: 700; margin: 0; }
.page-sub { margin: 0; color: var(--muted); font-size: 0.95rem; }
.card-grid { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.card-panel { background: var(--card); border: 1px solid #222647; border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 18px 40px rgba(5, 8, 24, 0.32); }
.card-head { display: flex; flex-direction: column; gap: 6px; }
.card-title { margin: 0; font-size: 1.2rem; font-weight: 600; }
.card-hint { margin: 0; font-size: 0.95rem; color: var(--muted); }
.card-body { display: flex; flex-direction: column; gap: 16px; }
.card-foot { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.card-foot.actions { justify-content: space-between; align-items: center; }
.card-foot.actions .btn { flex: 1 1 auto; text-align: center; }
.jobsite-equipment-section { display: flex; flex-direction: column; gap: 18px; }
.section-head { display: flex; align-items: center; justify-content: space-between; }
.card-grid.equipment-grid { grid-template-columns: minmax(0, 1fr); }
.equipment-card .card-body { gap: 12px; }
.warranty-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.equipment-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.equipment-actions .inline-form { display: inline-flex; gap: 10px; }
.empty-state { border: 1px dashed #2a2f4a; border-radius: var(--radius); padding: 28px 18px; display: flex; flex-direction: column; align-items: center; gap: 8px; background: rgba(21, 26, 46, 0.45); }
.empty-icon { font-size: 2rem; }
.empty-text { margin: 0; text-align: center; color: var(--muted); }

.card-panel .btn-row { margin-top: 12px; display: flex; gap: 10px; justify-content: flex-end; }

@media (min-width: 720px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-grid.equipment-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.sidebar { position: fixed; top:0; bottom:0; left:0; width: var(--sidebar-width); background:#0b0e1b; padding:20px 18px; transform:translateX(-100%); transition:transform .3s; display:flex; flex-direction:column; gap:24px; z-index:5; }
.sidebar.open { transform:translateX(0); }
.sidebar-toggle { display:inline-flex; align-items:center; justify-content:center; width:48px; height:48px; border-radius:999px; border:1px solid rgba(255,255,255,0.12); background:linear-gradient(145deg, rgba(255,255,255,0.08), rgba(255,255,255,0)); background-color:rgba(12,16,32,0.92); color: var(--text); box-shadow:0 16px 32px rgba(5,8,24,0.42); backdrop-filter:blur(18px); cursor:pointer; transition:transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease; }
.sidebar-toggle:hover { transform:translateY(-2px); box-shadow:0 18px 36px rgba(5,8,24,0.48); }
.sidebar-toggle:active { transform:scale(0.96); }
.sidebar-toggle-icon { width:22px; height:22px; }
.sidebar-toggle--floating { position:fixed; top:20px; left:20px; z-index:16; display:none; }
.sidebar.open + .sidebar-toggle--floating { left: calc(var(--sidebar-width) + 20px); }
.side-nav { display:flex; flex-direction:column; gap:8px; }
.side-nav .nav-btn { margin:0; }
.sidebar-footer { margin-top:auto; display:flex; flex-direction:column; gap:12px; }
.sidebar-actions { display:flex; align-items:center; gap:10px; justify-content:flex-start; }
.sidebar-actions .logout-form { margin:0; }
.nav-btn.compact { display:inline-flex; align-items:center; justify-content:center; width:auto; padding:10px 16px; }
.nav-btn.compact.lang-btn { font-size:18px; padding:10px 12px; }
.sidebar-footer form { margin:0; }
.sidebar-brand-footer { padding-top:14px; border-top:1px solid #20243e; display:flex; flex-direction:column; gap:10px; }
.sidebar-brand-footer .brand-identity { gap:8px; }
.lang-btn { display:flex; align-items:center; justify-content:center; font-size:20px; text-align:center; }

@media (min-width: 700px) { :root { --sidebar-width: 260px; } }

.quick-nav { position:fixed; left:50%; bottom:36px; transform:translate(-50%,0); z-index:15; display:none; align-items:flex-end; gap:12px; padding:14px 22px 20px; border-radius:26px; width:min(480px, calc(100% - 32px)); background:linear-gradient(165deg, rgba(120,196,255,0.78) 0%, rgba(92,168,232,0.62) 45%, rgba(18,33,64,0.88) 100%); box-shadow:0 26px 46px rgba(24,54,94,0.55); backdrop-filter:blur(26px); border:1px solid rgba(136,199,255,0.55); transition:transform 0.25s ease, opacity 0.25s ease, box-shadow 0.25s ease; color:#05224a; }
.quick-nav.quick-nav--hidden { opacity:0; transform:translate(-50%,110%); pointer-events:none; }
.quick-nav-item { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6px; padding:8px 10px; min-width:62px; border-radius:18px; background:transparent; color:inherit; text-decoration:none; font-size:0.75rem; font-weight:600; letter-spacing:0.01em; cursor:pointer; transition:transform 0.2s ease, background 0.2s ease, color 0.2s ease; text-align:center; line-height:1.1; }
.quick-nav-item svg { width:20px; height:20px; }
.quick-nav-icon { display:inline-flex; align-items:center; justify-content:center; }
.quick-nav-item:hover,
.quick-nav-item:focus-visible { background:rgba(255,255,255,0.32); color:#03233a; transform:translateY(-3px); box-shadow:0 14px 28px rgba(15,62,102,0.25); }
.quick-nav-item:active { transform:translateY(0); }
.quick-nav-center { min-width:62px; padding:10px 12px; border-radius:18px; border:none; background:var(--frost); color:#05224a; box-shadow:0 18px 32px rgba(99,198,255,0.42); transition:transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease; }
.quick-nav-center svg { width:20px; height:20px; }
.quick-nav-center:hover,
.quick-nav-center:focus-visible { background:#7fd3ff; color:#04101f; transform:translateY(-3px); box-shadow:0 22px 38px rgba(99,198,255,0.5); }
.quick-nav-label { color:#05224a; }
.quick-nav-logo { width:22px; height:22px; display:block; }
.quick-nav-item:hover .quick-nav-label,
.quick-nav-item:focus-visible .quick-nav-label { color:inherit; }
.quick-nav-hide { min-width:58px; }

.quick-nav-reopen { position:fixed; bottom:36px; right:24px; display:none; align-items:center; justify-content:center; width:48px; height:48px; border-radius:999px; border:1px solid rgba(255,255,255,0.12); background:linear-gradient(145deg, rgba(255,255,255,0.08), rgba(255,255,255,0)); background-color:rgba(12,16,32,0.92); color:var(--text); box-shadow:0 16px 32px rgba(5,8,24,0.42); backdrop-filter:blur(18px); cursor:pointer; transition:transform 0.2s ease, box-shadow 0.2s ease; z-index:15; }
.quick-nav-reopen svg { width:22px; height:22px; }
.quick-nav-reopen:hover,
.quick-nav-reopen:focus-visible { transform:translateY(-2px); box-shadow:0 18px 36px rgba(5,8,24,0.48); }
.quick-nav-reopen:active { transform:scale(0.96); }
.quick-nav-reopen.is-visible { display:inline-flex; }

@media (max-width: 64rem) {
.quick-nav { display:flex; gap:10px; padding:14px 22px 18px; }
  .quick-nav-item { min-width:58px; }
  .quick-nav-center { min-width:58px; padding:9px 11px; margin-bottom:0; }
  .sidebar-toggle--floating { display:none; }
  .content { padding-bottom:120px; }
}

@media (max-width: 40rem) {
  .quick-nav { bottom:28px; }
  .quick-nav-reopen { bottom:28px; right:18px; }
}

@media (min-width: 64rem) {
  .quick-nav,
  .quick-nav-reopen { display:none !important; }
  .sidebar-toggle--floating { display:inline-flex; }
}

.visually-hidden { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

.geo-box { margin-top: 10px; padding:12px; border-radius: 12px; background:#101533; border:1px solid #2a2e4f; }

/* RTL flip when <html dir="rtl"> */
html[dir="rtl"] .row-between { flex-direction: row-reverse; }
html[dir="rtl"] .col.right {
  text-align: left;
  align-items: flex-start;
}

/* Custom dropdown styling */
.ui-select {
  --ui-select-surface: #151a2e;
  --ui-select-text: #e8e8ff;
  --ui-select-muted: #a9aacf;
  --ui-select-border: #2a2e4f;
  --ui-select-brand: #F97316;
  --ui-select-hover-bg: rgba(249, 115, 22, 0.12);
  --ui-select-selected-bg: rgba(249, 115, 22, 0.18);
  position: relative;
  width: 100%;
}
@media (prefers-color-scheme: light) {
  .ui-select {
    --ui-select-surface: #fff;
    --ui-select-text: #111827;
    --ui-select-muted: #6B7280;
    --ui-select-border: #E5E7EB;
    --ui-select-hover-bg: #F3F4F6;
    --ui-select-selected-bg: #FFE9E1;
  }
}
.ui-select__button {
  width: 100%; height: 48px;
  border-radius: 14px;
  border: 1px solid var(--ui-select-border);
  background: var(--ui-select-surface);
  color: var(--ui-select-text);
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0 0.9rem;
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
  cursor: pointer;
  box-sizing: border-box;
}
.ui-select__button:focus { outline: none; box-shadow: 0 0 0 3px rgba(99,102,241,0.25); }
.ui-select__label { flex: 1 1 auto; font-weight: 600; }
.ui-select__chev { width: 18px; height: 18px; color: var(--ui-select-muted); transition: transform 0.2s ease; }
.ui-select.open .ui-select__chev { transform: rotate(180deg); }
.ui-select__menu {
  position: absolute; z-index: 40;
  top: calc(100% + 8px); left: 0;
  min-width: 260px; width: max(100%, 260px);
  background: var(--ui-select-surface);
  border: 1px solid var(--ui-select-border);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.14), 0 8px 20px rgba(0,0,0,0.10);
  padding: 8px;
  visibility: hidden; opacity: 0;
  transform: translateY(-6px);
  transition: visibility 0.2s, opacity 0.2s, transform 0.2s;
  max-height: 320px;
  overflow-y: auto;
}
.ui-select.open .ui-select__menu { visibility: visible; opacity: 1; transform: translateY(0); }
.ui-option {
  width: 100%; background: transparent;
  border: 0; cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--ui-select-text);
}
.ui-option:hover { background: var(--ui-select-hover-bg); }
.ui-option.is-selected { background: var(--ui-select-selected-bg); }
.ui-option.is-selected .opt__label { color: var(--ui-select-brand); font-weight: 700; }
.opt__label { flex: 1; }
.opt__check { opacity: 0; color: var(--ui-select-text); display: grid; place-items: center; }
.ui-option.is-selected .opt__check { opacity: 1; }
.ui-select__native { display: none; }

.stats-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 0.95rem; }
.table-wrap { width: 100%; overflow-x: auto; border-radius: 16px; border: 1px solid #222647; }
.data-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.data-table th,
.data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid rgba(34, 38, 71, 0.6); }
.data-table td { word-break: break-word; }
.data-table thead { background: rgba(21, 26, 46, 0.75); position: sticky; top: 0; z-index: 1; }
.data-table th { font-weight: 600; font-size: 0.85rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.data-table tbody tr:nth-child(even) { background: rgba(15, 19, 40, 0.55); }
.actions-col { white-space: nowrap; }
.form-inline { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.form-inline .input { max-width: 180px; }

.form-stack {
  display: grid;
  gap: 12px;
  align-items: start;
  margin-top: 8px;
}

.form-stack .row-end {
  justify-content: flex-end;
}

.is-hidden {
  display: none !important;
}
.inline-form summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.inline-form[open] summary { margin-bottom: 6px; }
.btn.small { padding: 8px 12px; border-radius: 10px; font-size: 0.85rem; }
.btn.danger { background: rgba(224, 85, 85, 0.16); border-color: rgba(224, 85, 85, 0.5); color: #ff8c8c; }
.btn.danger:hover { background: rgba(224, 85, 85, 0.26); }
.filters { display: flex; flex-direction: column; gap: 10px; }
.filters .ui-select { max-width: 240px; }

@media (min-width: 1024px) {
  .page-wrap {
    max-width: 1800px;
    padding: 48px 32px 72px;
  }

  .page-header {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
  }

  .page-sub {
    max-width: 520px;
    font-size: 1.05rem;
  }

  .card-grid:has(.roster-card) {
    grid-template-columns: 1fr;
    max-width: 100%;
  }

  .card-panel.roster-card {
    padding: 36px;
    display: grid;
    grid-template-columns: minmax(0, 200px) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "roster-filter roster-table"
      "roster-actions roster-table";
    gap: 36px;
    align-items: start;
    max-width: 100%;
    width: 100%;
  }

  .card-panel.roster-card .card-head {
    grid-area: roster-filter;
    position: sticky;
    top: 48px;
    align-self: start;
    background: rgba(12, 16, 34, 0.9);
    border: 1px solid rgba(52, 58, 92, 0.7);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 24px 45px rgba(5, 8, 24, 0.45);
  }

  .card-panel.roster-card .card-head .label {
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .card-panel.roster-card .filters {
    gap: 18px;
  }

  .card-panel.roster-card .filters .ui-select {
    max-width: none;
  }

  .card-panel.roster-card .card-body {
    grid-area: roster-table;
    padding: 0;
    min-width: 0;
    width: 100%;
  }

  .card-panel.roster-card .table-wrap {
    max-height: clamp(420px, 60vh, 720px);
    overflow-y: auto;
    overflow-x: visible;
    border-radius: 20px;
    border: 0;
    box-shadow: inset 0 0 0 1px rgba(32, 36, 62, 0.85);
    width: 100%;
    min-width: 0;
  }

  .card-panel.roster-card .data-table {
    width: 100%;
    min-width: 1000px;
    table-layout: auto;
  }

  .card-panel.roster-card .data-table th:nth-child(1),
  .card-panel.roster-card .data-table td:nth-child(1) {
    min-width: 160px;
    width: auto;
  }

  .card-panel.roster-card .data-table th:nth-child(2),
  .card-panel.roster-card .data-table td:nth-child(2) {
    min-width: 250px;
    width: auto;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .card-panel.roster-card .data-table th:nth-child(3),
  .card-panel.roster-card .data-table td:nth-child(3) {
    min-width: 120px;
    width: auto;
    white-space: nowrap;
  }

  .card-panel.roster-card .data-table th:nth-child(4),
  .card-panel.roster-card .data-table td:nth-child(4) {
    min-width: 130px;
    width: auto;
    white-space: nowrap;
  }

  .card-panel.roster-card .data-table th:nth-child(5),
  .card-panel.roster-card .data-table td:nth-child(5) {
    min-width: 130px;
    width: auto;
    white-space: nowrap;
  }

  .card-panel.roster-card .data-table th:nth-child(6),
  .card-panel.roster-card .data-table td:nth-child(6) {
    min-width: 280px;
    width: auto;
  }

  .card-panel.roster-card .data-table th {
    white-space: nowrap;
  }

  .card-panel.roster-card .data-table th:nth-child(2) {
    white-space: normal;
  }

  .card-panel.roster-card .actions-col {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    white-space: nowrap;
    align-items: center;
  }

  .card-panel.roster-card .actions-col .form-inline {
    margin-top: 0;
  }

  .card-panel.roster-card .data-table th,
  .card-panel.roster-card .data-table td {
    padding: 16px 20px;
  }

  .card-panel.roster-card .card-foot {
    grid-area: roster-actions;
    justify-content: flex-start;
    padding: 0;
    gap: 18px;
    align-self: end;
  }

.card-panel.roster-card .card-foot .btn {
  flex: 0 0 auto;
  min-width: 180px;
}
}

@media (min-width: 1400px) {
  .page-wrap {
    max-width: 2000px;
  }

  .card-panel.roster-card {
    grid-template-columns: minmax(0, 180px) minmax(0, 1fr);
    gap: 40px;
  }
}

.page-loader {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 16, 28, 0.55);
  backdrop-filter: blur(8px);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.page-loader.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.page-loader__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 28px 32px;
  background: rgba(28, 36, 58, 0.9);
  border-radius: 20px;
  box-shadow: 0 18px 40px rgba(8, 12, 24, 0.45);
}

.page-loader__anim {
  width: 120px;
  height: 120px;
}

.page-loader__label {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--frost-50, #f7fbff);
}

.empty { margin: 0; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* --- Attendance UI --- */

.attendance-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#attendance-app {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.attendance-admin-links {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.attendance-status {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
}

.attendance-status__main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 260px;
}

.attendance-status__aside {
  display: grid;
  gap: 10px;
  flex: 1 1 220px;
}

.attendance-hello {
  font-size: 1.1rem;
  font-weight: 600;
}

.attendance-label {
  font-size: 0.9rem;
  color: var(--muted);
}

.attendance-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #2a2e4f;
  background: #0f1430;
  color: var(--text);
}

.attendance-status__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #2a2e4f;
  background: rgba(99, 198, 255, 0.08);
  color: var(--muted);
  font-size: 0.82rem;
  width: fit-content;
}

.pill.good {
  background: rgba(76, 201, 240, 0.16);
  color: #6ddcff;
  border-color: rgba(109, 220, 255, 0.4);
}

.pill.bad {
  background: rgba(224, 85, 85, 0.16);
  color: #ff8c8c;
  border-color: rgba(224, 85, 85, 0.35);
}

.pill.muted {
  background: rgba(21, 26, 46, 0.6);
}

.attendance-jobsite {
  font-size: 0.85rem;
  min-height: 1.2rem;
}

.btn.ghost {
  background: rgba(99, 198, 255, 0.12);
  border-color: rgba(99, 198, 255, 0.32);
  color: var(--text);
}

.btn.ghost:hover {
  background: rgba(99, 198, 255, 0.2);
}

.attendance-clock {
  display: grid;
  gap: 14px;
}

.attendance-clock__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.attendance-clock__buttons .btn {
  flex: 1 1 160px;
}

.big-time {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-align: center;
}

.attendance-result {
  min-height: 1.2rem;
}

.attendance-spoke {
  display: grid;
  gap: 8px;
}

.current-shift,
#last-shift {
  font-size: 0.9rem;
  line-height: 1.5;
}

.shift-note {
  display: grid;
  gap: 8px;
}

.shift-note__row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.shift-note__row input {
  flex: 1;
}

.shift-note__status {
  min-height: 1.2rem;
}

.roster-grid {
  display: grid;
  gap: 12px;
}

.roster-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(26, 32, 56, 0.6);
  border: 1px solid rgba(42, 46, 79, 0.8);
}

.roster-item--today {
  border-color: rgba(138, 43, 226, 0.6);
  background: rgba(138, 43, 226, 0.16);
}

.roster-item__badge {
  margin-left: 8px;
  font-size: 0.75rem;
  color: var(--muted);
}

.attendance-hint {
  text-align: center;
  font-size: 0.85rem;
}

.roster-admin-card {
  margin-bottom: 16px;
}

.roster-admin-card .roster-grid {
  display: grid;
  gap: 10px;
}

.roster-admin-card .roster-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 10px;
  align-items: center;
}

.roster-admin-card .roster-row__field input {
  width: 100%;
}

.roster-rate {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.roster-rate__input {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.roster-rate__prefix {
  color: var(--muted);
}

.roster-switches {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 8px 0 12px;
}

.approval-meta p {
  margin-bottom: 4px;
}

.approval-actions {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.approval-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 640px) {
  .attendance-clock__buttons .btn {
    flex: 1 1 120px;
  }
  .attendance-status {
    flex-direction: column;
  }
  .attendance-status__aside {
    width: 100%;
  }
  .roster-admin-card .roster-row {
    grid-template-columns: 1fr;
  }
  .approval-buttons {
    flex-direction: column;
    align-items: stretch;
  }
}
