/* TimeTrack Precision Chronograph Dark SaaS Stylesheet
   Zero external fonts/CDNs. Mobile-first responsive CSS Grid & Flexbox.
   Applies modern-web-guidance: dark-mode, dialog, responsive-table, :user-invalid, toast popovers. */

:root {
  color-scheme: dark;

  /* 5 Core Named Surface & Accent Tokens */
  --bg-canvas: #0d1117;
  --bg-surface: #141a22;
  --bg-raised: #1b232e;
  --border-subtle: #263140;
  --accent-primary: #2dd4bf;

  --accent-hover: #5eead4;
  --accent-ink: #062421;
  --accent-soft: rgba(45, 212, 191, 0.13);
  --accent-border: rgba(45, 212, 191, 0.35);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --status-working: #2dd4bf;
  --status-break: #f59e0b;
  --status-idle: #64748b;
  --status-positive: #34d399;
  --status-danger: #f87171;
  --status-danger-bg: rgba(248, 113, 113, 0.12);
  --status-warn-bg: rgba(245, 158, 11, 0.13);
  --status-ok-bg: rgba(52, 211, 153, 0.12);

  --radius-hero: 16px;
  --radius-card: 12px;
  --radius-control: 8px;
  --radius-pill: 999px;

  --font-sans: system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;

  --sidebar-w: 252px;
  --topbar-h: 60px;
  --tabbar-h: 64px;

  --scrollbar-track: #141a22;
  --scrollbar-thumb: #334155;

  accent-color: var(--accent-primary);
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

@supports not (scrollbar-color: auto) {
  * {
    scrollbar-width: auto;
  }
  ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }
  ::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
  }
  ::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 6px;
  }
}

*, *::before, *::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 999;
  background: var(--accent-primary);
  color: var(--accent-ink);
  padding: 10px 16px;
  border-radius: var(--radius-control);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  left: 12px;
}

:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Typography utilities */
.mono, .tabular {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.text-muted { color: var(--text-secondary); }
.text-positive { color: var(--status-positive); }
.text-danger { color: var(--status-danger); }
.text-warn { color: var(--status-break); }

/* Auth / Login Layout */
.auth-body {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 20px;
  background: radial-gradient(circle at 50% 0%, rgba(45, 212, 191, 0.08), transparent 48%), var(--bg-canvas);
}
.auth-shell { width: 100%; max-width: 420px; }
.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-hero);
  padding: 32px 28px;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.auth-brand h1 { margin: 0; font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; }
.auth-subtitle { margin: 2px 0 0; font-size: 0.9rem; color: var(--text-secondary); }

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent-primary);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

/* App Shell */
.app-shell {
  display: flex;
  min-height: 100dvh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 60;
  transform: translateX(-100%);
  transition: transform 200ms ease;
}
.sidebar.is-open {
  transform: translateX(0);
}

.sidebar-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 50;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 1.05rem; letter-spacing: -0.01em; }
.brand-text small { font-size: 0.78rem; color: var(--text-secondary); max-width: 145px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-control);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.93rem;
}
.nav-item:hover {
  background: var(--bg-raised);
  color: var(--text-primary);
}
.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent-primary);
  font-weight: 600;
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: var(--radius-pill);
  background: var(--bg-raised); border: 1px solid var(--border-subtle);
  display: grid; place-items: center; font-weight: 650; font-size: 0.84rem; color: var(--accent-primary);
  flex-shrink: 0;
}
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-meta strong { font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta span { font-size: 0.78rem; color: var(--text-secondary); }

.workspace {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 12px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  padding: 0 16px;
  background: rgba(13, 17, 23, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-title { margin: 0; font-size: 1.12rem; font-weight: 650; letter-spacing: -0.01em; }

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.sync-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--status-positive);
}
.sync-badge.is-offline .sync-dot { background: var(--status-break); }
.sync-badge.is-syncing .sync-dot { background: var(--accent-primary); }

.offline-banner {
  background: var(--status-warn-bg);
  border-bottom: 1px solid rgba(245, 158, 11, 0.35);
  color: #fde68a;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.88rem;
}

.main-content {
  width: 100%;
  max-width: 1260px;
  margin: 0 auto;
  padding: 18px 16px 36px;
}

/* Mobile Bottom Tab Bar */
.mobile-tabbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 40;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(20, 26, 34, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}
.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-secondary);
  text-decoration: none;
  background: transparent;
  border: 0;
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 2px;
}
.tab-item.is-active {
  color: var(--accent-primary);
}

@media (min-width: 1024px) {
  .sidebar {
    position: sticky;
    top: 0;
    height: 100dvh;
    transform: none;
  }
  .sidebar-close-btn, .mobile-menu-btn, .mobile-tabbar, .sidebar-scrim {
    display: none !important;
  }
  .workspace {
    padding-bottom: 0;
  }
  .topbar {
    padding: 0 28px;
  }
  .main-content {
    padding: 24px 28px 48px;
  }
}

/* Cards, Grids, Panels */
.stack { display: flex; flex-direction: column; gap: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

@media (min-width: 720px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 20px;
}
.card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}
.card-title { margin: 0; font-size: 1.05rem; font-weight: 650; }
.card-subtitle { margin: 2px 0 0; font-size: 0.86rem; color: var(--text-secondary); }

/* Hero Digital Stempeluhr Instrument */
.clock-hero {
  background: linear-gradient(180deg, #17202b 0%, var(--bg-surface) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-hero);
  padding: 24px 22px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
}
@media (min-width: 860px) {
  .clock-hero {
    grid-template-columns: 1.25fr 1fr;
    padding: 28px 30px;
    align-items: center;
  }
}
.clock-status-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  background: var(--bg-raised);
  margin-bottom: 12px;
}
.clock-status-bar[data-state="working"] {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent-primary);
}
.clock-status-bar[data-state="on_break"] {
  background: var(--status-warn-bg);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}
.status-indicator {
  width: 9px; height: 9px; border-radius: 50%; background: currentColor;
}

.clock-time {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.4rem, 7vw, 3.8rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}
.clock-date {
  margin-top: 6px;
  font-size: 0.98rem;
  color: var(--text-secondary);
}

.clock-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}
.clock-actions .btn {
  min-height: 48px;
  padding: 12px 22px;
  font-size: 0.98rem;
  flex: 1 1 180px;
  justify-content: center;
}

.clock-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.metric-box {
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 13px 14px;
}
.metric-label { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 4px; }
.metric-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.25rem;
  font-weight: 650;
  color: var(--text-primary);
}
.progress-track {
  grid-column: 1 / -1;
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  height: 10px;
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: var(--radius-pill);
  transition: width 300ms ease;
}

/* KPI Stat Cards */
.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 16px 18px;
}
.kpi-label { font-size: 0.82rem; color: var(--text-secondary); }
.kpi-val {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.45rem;
  font-weight: 700;
}
.kpi-sub { margin-top: 4px; font-size: 0.8rem; color: var(--text-muted); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-control);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  min-height: 40px;
  transition: background-color 140ms ease, border-color 140ms ease;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent-primary); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-raised); color: var(--text-primary); border-color: var(--border-subtle); }
.btn-secondary:hover:not(:disabled) { border-color: #3b4b60; background: #232d3b; }
.btn-warning { background: rgba(245, 158, 11, 0.16); color: #fcd34d; border-color: rgba(245, 158, 11, 0.4); }
.btn-warning:hover:not(:disabled) { background: rgba(245, 158, 11, 0.25); }
.btn-danger { background: rgba(248, 113, 113, 0.15); color: #fca5a5; border-color: rgba(248, 113, 113, 0.4); }
.btn-danger:hover:not(:disabled) { background: rgba(248, 113, 113, 0.25); }
.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--bg-raised); color: var(--text-primary); }
.btn-sm { padding: 6px 11px; min-height: 32px; font-size: 0.83rem; }
.btn-block { width: 100%; }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-control);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}
.icon-btn:hover { background: var(--bg-raised); }

/* Badges & Status Pills */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg-raised);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.badge-ok { background: var(--status-ok-bg); color: #6ee7b7; border-color: rgba(52, 211, 153, 0.35); }
.badge-warn { background: var(--status-warn-bg); color: #fcd34d; border-color: rgba(245, 158, 11, 0.35); }
.badge-danger { background: var(--status-danger-bg); color: #fca5a5; border-color: rgba(248, 113, 113, 0.35); }
.badge-accent { background: var(--accent-soft); color: var(--accent-primary); border-color: var(--accent-border); }

/* Forms & Accessible Post-Interaction Validation (:user-invalid) */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 5px;
}
.field-hint {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 5px;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-control);
  border: 1px solid var(--border-subtle);
  background: var(--bg-raised);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.94rem;
}
textarea { min-height: 78px; resize: vertical; }

.error-msg {
  display: none;
  margin-top: 5px;
  font-size: 0.82rem;
  color: #fca5a5;
}
:is(input, select, textarea):is(:user-invalid, .user-invalid-fallback) {
  border-color: var(--status-danger);
  background-color: rgba(248, 113, 113, 0.08);
}
:is(input, select, textarea):is(:user-invalid, .user-invalid-fallback) + .error-msg {
  display: block;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.inline-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}
.inline-controls .field { margin-bottom: 0; min-width: 150px; }

.alert {
  padding: 12px 15px;
  border-radius: var(--radius-control);
  border: 1px solid var(--border-subtle);
  font-size: 0.9rem;
  margin-bottom: 14px;
}
.alert-danger { background: var(--status-danger-bg); border-color: rgba(248, 113, 113, 0.35); color: #fecaca; }
.alert-ok { background: var(--status-ok-bg); border-color: rgba(52, 211, 153, 0.35); color: #a7f3d0; }
.alert-info { background: var(--accent-soft); border-color: var(--accent-border); color: #ccfbf1; }

/* Responsive Tables (modern-web-guidance: container queries + sticky headers) */
.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: min(560px, 72vh);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  container-type: inline-size;
}
.table-wrapper table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
}
.table-wrapper caption {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}
.table-wrapper thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
}
.table-wrapper th {
  text-align: left;
  padding: 10px 13px;
  background: var(--bg-raised);
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.table-wrapper td {
  padding: 10px 13px;
  border-bottom: 1px solid rgba(38, 49, 64, 0.6);
  vertical-align: middle;
}
.table-wrapper tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}
.table-wrapper tbody tr:last-child td { border-bottom: 0; }

@container (width < 580px) {
  .table-wrapper.stack-mobile table,
  .table-wrapper.stack-mobile thead,
  .table-wrapper.stack-mobile tbody,
  .table-wrapper.stack-mobile tr,
  .table-wrapper.stack-mobile th,
  .table-wrapper.stack-mobile td {
    display: block;
  }
  .table-wrapper.stack-mobile thead {
    display: none;
  }
  .table-wrapper.stack-mobile tbody tr {
    border-bottom: 1px solid var(--border-subtle);
    padding: 10px 12px;
  }
  .table-wrapper.stack-mobile tbody td {
    border: 0;
    padding: 4px 0;
    display: flex;
    justify-content: space-between;
    gap: 12px;
  }
  .table-wrapper.stack-mobile tbody td::before {
    content: attr(data-label);
    color: var(--text-secondary);
    font-weight: 500;
  }
}

/* Segmented Tabs */
.tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
}
.tab-btn {
  padding: 7px 14px;
  border-radius: 7px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}
.tab-btn.is-active {
  background: var(--bg-raised);
  color: var(--accent-primary);
}

/* Month Calendar Grid */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.cal-weekday {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-secondary);
  padding: 6px 0;
  font-weight: 600;
}
.cal-cell {
  min-height: 78px;
  padding: 8px;
  border-radius: 9px;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  text-align: left;
  color: var(--text-primary);
}
.cal-cell:hover { border-color: var(--accent-border); }
.cal-cell.is-today { border-color: var(--accent-primary); box-shadow: inset 0 0 0 1px var(--accent-primary); }
.cal-cell.is-empty { background: transparent; border-color: transparent; cursor: default; }
.cal-cell.is-holiday { background: rgba(45, 212, 191, 0.08); }
.cal-cell.is-absence { background: rgba(245, 158, 11, 0.1); }
.cal-day-num { font-size: 0.82rem; font-weight: 650; color: var(--text-secondary); }
.cal-hours { font-family: var(--font-mono); font-size: 0.86rem; font-weight: 650; }
.cal-tag { font-size: 0.7rem; color: var(--accent-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Import Dropzone & Stepper */
.stepper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}
.step-pill {
  padding: 9px 12px;
  border-radius: 9px;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  font-size: 0.82rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.step-pill.is-active { border-color: var(--accent-primary); color: var(--accent-primary); background: var(--accent-soft); font-weight: 600; }
.step-pill.is-done { border-color: rgba(52, 211, 153, 0.4); color: var(--status-positive); }

.dropzone {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 36px 20px;
  text-align: center;
  background: var(--bg-canvas);
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}
.dropzone.is-dragover, .dropzone:hover {
  border-color: var(--accent-primary);
  background: rgba(45, 212, 191, 0.05);
}

/* Native Modal Dialog (modern-web-guidance compliant) */
dialog {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-hero);
  background: var(--bg-surface);
  color: var(--text-primary);
  padding: 0;
  width: min(620px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
}
dialog[open] {
  display: flex;
  flex-direction: column;
}
dialog:modal {
  overscroll-behavior: contain;
}
dialog::backdrop {
  background: rgba(5, 8, 13, 0.72);
  backdrop-filter: blur(4px);
  overflow: hidden;
  overscroll-behavior: contain;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.modal-header h1 { margin: 0; font-size: 1.1rem; font-weight: 650; }
.modal-body {
  padding: 20px;
  overflow-y: auto;
}

/* Accessible Toast Notifications (popover="manual" + graceful positioning) */
.toast-region {
  position: fixed;
  inset: auto 16px calc(var(--tabbar-h) + 14px) auto;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
@media (min-width: 1024px) {
  .toast-region { inset: auto 24px 24px auto; }
}
.toast-item {
  pointer-events: auto;
  position: static;
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}
.toast-item[data-tone="ok"] { border-color: rgba(52, 211, 153, 0.45); }
.toast-item[data-tone="danger"] { border-color: rgba(248, 113, 113, 0.5); }
.toast-item[data-tone="warn"] { border-color: rgba(245, 158, 11, 0.45); }

.loading-state, .empty-state {
  padding: 36px 20px;
  text-align: center;
  color: var(--text-secondary);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
