/* ============================================================
   Graafiku App — Demo Work Schedule Manager
   Professional blue-gray corporate palette
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ============================================================
   BASE RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ============================================================
   DESIGN TOKENS — LIGHT MODE
   ============================================================ */
:root, [data-theme="light"] {
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Type scale (compact for admin panel) */
  --text-xs: 0.6875rem;   /* 11px */
  --text-sm: 0.75rem;     /* 12px */
  --text-base: 0.8125rem; /* 13px */
  --text-lg: 0.9375rem;   /* 15px */
  --text-xl: 1.125rem;    /* 18px */

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;

  /* Blue-gray corporate palette */
  --color-bg: #f0f2f5;
  --color-surface: #ffffff;
  --color-surface-2: #f8f9fb;
  --color-surface-offset: #edf0f4;
  --color-divider: #dde1e7;
  --color-border: #cdd3db;

  /* Text */
  --color-text: #1a2332;
  --color-text-muted: #5f6b7a;
  --color-text-faint: #99a3b0;
  --color-text-inverse: #ffffff;

  /* Primary — corporate blue */
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-active: #1e40af;
  --color-primary-bg: #eff4ff;
  --color-primary-light: #dbeafe;

  /* Sidebar */
  --sidebar-bg: #1a2332;
  --sidebar-hover: #243044;
  --sidebar-active: #2d3d54;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  --sidebar-border: #2d3d54;
  --sidebar-width: 220px;

  /* Status */
  --color-success: #16a34a;
  --color-success-bg: #f0fdf4;
  --color-warning: #ea8e1a;
  --color-warning-bg: #fffbeb;
  --color-error: #dc2626;
  --color-error-bg: #fef2f2;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

  /* Transitions */
  --transition: 150ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Schedule cell */
  --cell-min-w: 38px;
  --cell-h: 32px;

  /* Weekend / Holiday highlights */
  --weekend-bg: rgba(99, 115, 140, 0.08);
  --holiday-bg: rgba(234, 88, 12, 0.10);

  /* Leave colors */
  --color-leave-vac: #3b82f6;
  --color-leave-sick: #ef4444;
}

/* ============================================================
   DARK MODE
   ============================================================ */
[data-theme="dark"] {
  --color-bg: #0f1419;
  --color-surface: #1a2332;
  --color-surface-2: #1f2b3d;
  --color-surface-offset: #162030;
  --color-divider: #2d3d54;
  --color-border: #374a63;

  --color-text: #e2e8f0;
  --color-text-muted: #8b99ad;
  --color-text-faint: #5a6a7e;
  --color-text-inverse: #0f1419;

  --color-primary: #5b8def;
  --color-primary-hover: #7ba3f7;
  --color-primary-active: #3a6fe0;
  --color-primary-bg: rgba(91,141,239,0.1);
  --color-primary-light: rgba(91,141,239,0.15);

  --sidebar-bg: #0b1120;
  --sidebar-hover: #162030;
  --sidebar-active: #1f2b3d;
  --sidebar-text: #6b7f99;
  --sidebar-text-active: #e2e8f0;
  --sidebar-border: #1f2b3d;

  --color-success: #4ade80;
  --color-success-bg: rgba(74,222,128,0.1);
  --color-warning: #fbbf24;
  --color-warning-bg: rgba(251,191,36,0.1);
  --color-error: #f87171;
  --color-error-bg: rgba(248,113,113,0.1);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);

  --color-leave-vac: #60a5fa;
  --color-leave-sick: #f87171;

  --weekend-bg: rgba(99, 115, 140, 0.1);
  --holiday-bg: rgba(234, 88, 12, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #0f1419;
    --color-surface: #1a2332;
    --color-surface-2: #1f2b3d;
    --color-surface-offset: #162030;
    --color-divider: #2d3d54;
    --color-border: #374a63;
    --color-text: #e2e8f0;
    --color-text-muted: #8b99ad;
    --color-text-faint: #5a6a7e;
    --color-text-inverse: #0f1419;
    --color-primary: #5b8def;
    --color-primary-hover: #7ba3f7;
    --color-primary-active: #3a6fe0;
    --color-primary-bg: rgba(91,141,239,0.1);
    --color-primary-light: rgba(91,141,239,0.15);
    --sidebar-bg: #0b1120;
    --sidebar-hover: #162030;
    --sidebar-active: #1f2b3d;
    --sidebar-text: #6b7f99;
    --sidebar-text-active: #e2e8f0;
    --sidebar-border: #1f2b3d;
    --color-success: #4ade80;
    --color-success-bg: rgba(74,222,128,0.1);
    --color-warning: #fbbf24;
    --color-warning-bg: rgba(251,191,36,0.1);
    --color-error: #f87171;
    --color-error-bg: rgba(248,113,113,0.1);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
    --weekend-bg: rgba(99, 115, 140, 0.1);
    --holiday-bg: rgba(234, 88, 12, 0.12);
  }
}

/* ============================================================
   BODY & APP SHELL
   ============================================================ */
html, body {
  height: 100%;
  overflow: hidden;
  margin: 0;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: 1fr;
  height: 100dvh;
  overflow: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  grid-row: 1 / -1;
  grid-column: 1;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: 1px solid var(--sidebar-border);
  z-index: 100;
  height: 100%;
}

.sidebar-logo {
  padding: var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-logo .logo-icon {
  width: 32px;
  height: 32px;
  background: var(--color-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.sidebar-logo .logo-icon svg {
  width: 18px;
  height: 18px;
}

.sidebar-logo h1 {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--sidebar-text-active);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.sidebar-logo .logo-sub {
  font-size: var(--text-xs);
  color: var(--sidebar-text);
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-3) var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.sidebar-nav-label {
  font-size: var(--text-xs);
  color: var(--sidebar-text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  padding: var(--space-3) var(--space-3) var(--space-1);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-active);
}

.nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
}

.nav-item svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active svg {
  opacity: 1;
}

.nav-badge {
  margin-left: auto;
  background: var(--color-error);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: var(--space-3) var(--space-2);
  border-top: 1px solid var(--sidebar-border);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  grid-column: 2;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ============================================================
   TOP BAR
   ============================================================ */
.topbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-divider);
  padding: var(--space-3) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 48px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.topbar-left h2 {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.btn-menu {
  display: none !important;
  padding: var(--space-2);
  color: var(--color-text-muted);
}

/* ============================================================
   BUTTONS
   ============================================================ */
button {
  cursor: pointer;
  background: none;
  border: none;
  font: inherit;
  color: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
}

.btn-ghost {
  color: var(--color-text-muted);
}

.btn-ghost:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}

.btn-sm {
  padding: 4px 8px;
  font-size: var(--text-xs);
}

.btn-icon {
  padding: 6px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}

/* ============================================================
   MONTH SELECTOR
   ============================================================ */
.month-selector {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.month-selector .month-label {
  font-size: var(--text-base);
  font-weight: 600;
  min-width: 120px;
  text-align: center;
}

/* ============================================================
   CONTENT AREA (page views)
   ============================================================ */
.page-content {
  padding: var(--space-4) var(--space-5);
  flex: 1;
}

.view { display: none; }
.view.active { display: block; }

/* ============================================================
   SCHEDULE TABLE
   ============================================================ */
.schedule-wrapper {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-divider);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.schedule-scroll {
  overflow-x: scroll;
  overflow-y: auto;
  max-height: calc(100dvh - 140px);
  overscroll-behavior: contain;
  scrollbar-width: auto;
  scrollbar-color: var(--color-border) var(--color-bg);
}

.schedule-table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
  font-variant-numeric: tabular-nums lining-nums;
}

.schedule-table th,
.schedule-table td {
  padding: 3px 4px;
  text-align: center;
  font-size: var(--text-xs);
  border-bottom: 1px solid var(--color-divider);
  border-right: 1px solid var(--color-divider);
  white-space: nowrap;
  height: var(--cell-h);
  min-width: var(--cell-min-w);
}

/* Sticky header */
.schedule-table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-surface-2);
  font-weight: 600;
  font-size: 10px;
  color: var(--color-text-muted);
}

/* Sticky first column (employee names) */
.schedule-table .col-name {
  position: sticky;
  left: 0;
  z-index: 5;
  background: var(--color-surface);
  text-align: left;
  padding-left: var(--space-3);
  padding-right: var(--space-3);
  min-width: 150px;
  max-width: 150px;
  font-weight: 500;
  font-size: var(--text-xs);
  color: var(--color-text);
  border-right: 2px solid var(--color-divider);
}

.schedule-table thead .col-name {
  z-index: 20;
  background: var(--color-surface-2);
  border-right: 2px solid var(--color-divider);
}

/* Summary columns */
.schedule-table .col-summary {
  min-width: 52px;
  font-weight: 600;
  font-size: var(--text-xs);
  background: var(--color-surface-2);
}

.schedule-table thead .col-summary {
  background: var(--color-surface-offset);
}

/* Weekend columns */
.schedule-table .col-weekend {
  background-color: var(--weekend-bg);
}

.schedule-table thead .col-weekend {
  background: color-mix(in srgb, var(--color-surface-2) 80%, var(--weekend-bg));
}

/* Holiday columns */
.schedule-table .col-holiday {
  background-color: var(--holiday-bg);
}

.schedule-table thead .col-holiday {
  background: color-mix(in srgb, var(--color-surface-2) 75%, var(--holiday-bg));
}

/* Day header: date number */
.day-number {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.2;
}

.day-letter {
  display: block;
  font-size: 9px;
  font-weight: 500;
  color: var(--color-text-faint);
  text-transform: uppercase;
}

/* Store group header */
.store-group-header td {
  background: var(--color-surface-offset) !important;
  font-weight: 700;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
  padding-left: var(--space-3);
  color: var(--color-text-muted);
  height: 28px;
}

/* Schedule cells */
.cell-shift {
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
}

.cell-shift:hover {
  filter: brightness(0.95);
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
  z-index: 2;
}

.shift-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.4;
  min-width: 28px;
  letter-spacing: -0.01em;
}

.shift-hours {
  font-size: 9px;
  font-weight: 400;
  opacity: 0.8;
  margin-left: 1px;
}

/* Leave badges */
.leave-badge {
  display: inline-block;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.leave-puhkus {
  background: #dbeafe;
  color: #1e40af;
}

.leave-haigus {
  background: #fecaca;
  color: #991b1b;
}

.leave-soov {
  background: #fef3c7;
  color: #92400e;
}

[data-theme="dark"] .leave-puhkus {
  background: rgba(59,130,246,0.2);
  color: #93bbfd;
}

[data-theme="dark"] .leave-haigus {
  background: rgba(239,68,68,0.2);
  color: #fca5a5;
}

[data-theme="dark"] .leave-soov {
  background: rgba(245,158,11,0.2);
  color: #fcd34d;
}

/* ============================================================
   SCHEDULE TOOLBAR & WISH DAYS
   ============================================================ */
.schedule-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.btn-wish {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-divider);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-wish:hover {
  background: var(--color-surface-offset);
  border-color: #f59e0b;
  color: #b45309;
}

[data-theme="dark"] .btn-wish:hover {
  color: #fbbf24;
}

.btn-wish svg {
  color: #f59e0b;
}

.wish-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #f59e0b;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 0 5px;
}

.wish-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Wish Modal */
.wish-modal {
  max-width: 520px;
}

.wish-help {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.wish-example {
  background: var(--color-surface-offset);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-family: 'SF Mono', 'Consolas', monospace;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
  line-height: 1.6;
}

.wish-textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-family: inherit;
  background: var(--color-surface);
  color: var(--color-text);
  resize: vertical;
  line-height: 1.6;
}

.wish-textarea:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.15);
}

.wish-preview {
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  line-height: 1.6;
  max-height: 160px;
  overflow-y: auto;
}

.wish-preview div {
  padding: 2px 0;
}

/* Work Fund Bar */
.work-fund-bar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 8px var(--space-3);
  margin-bottom: var(--space-3);
  background: var(--color-surface-offset);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-divider);
  flex-wrap: wrap;
}

.fund-item {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.fund-value {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
}

.fund-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.fund-holidays {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: auto;
}

.fund-holiday-tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-error);
  white-space: nowrap;
}

[data-theme="dark"] .fund-holiday-tag {
  background: rgba(239, 68, 68, 0.15);
}

@media (max-width: 768px) {
  .fund-holidays {
    margin-left: 0;
    width: 100%;
  }
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* KOKKU (totals) row */
.row-totals td {
  background: var(--color-surface-offset) !important;
  font-weight: 600;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  border-bottom: 2px solid var(--color-divider);
}

.row-totals .col-name {
  background: var(--color-surface-offset) !important;
  color: var(--color-text-muted);
  font-style: italic;
}

/* Hours diff styling */
.hours-over { color: var(--color-error); }
.hours-under { color: var(--color-warning); }
.hours-ok { color: var(--color-success); }

/* ============================================================
   ALERTS VIEW
   ============================================================ */
.alerts-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.alert-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
}

.alert-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.alert-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.alert-critical .alert-icon {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.alert-warning .alert-icon {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.alert-message {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: 500;
}

.alert-type-label {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-weight: 400;
}

.alert-badge {
  font-size: var(--text-xs);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.badge-critical {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.badge-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

/* Alert summary cards */
.alert-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.alert-summary-card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}

.alert-summary-card .count {
  font-size: var(--text-xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.alert-summary-card .label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ============================================================
   EMPLOYEE TABLE
   ============================================================ */
.emp-table-wrapper {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.emp-table {
  width: 100%;
  font-variant-numeric: tabular-nums lining-nums;
}

.emp-table th {
  background: var(--color-surface-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-align: left;
  border-bottom: 1px solid var(--color-divider);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.emp-table th:hover {
  color: var(--color-text);
}

.emp-table th .sort-icon {
  display: inline-block;
  margin-left: 4px;
  vertical-align: middle;
  opacity: 0.5;
}

.emp-table th.sort-active .sort-icon {
  opacity: 1;
  color: var(--color-primary);
}

.emp-table td {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-divider);
}

.emp-table tr:hover td {
  background: var(--color-primary-bg);
}

.emp-table tr {
  cursor: pointer;
}

.emp-name-cell {
  font-weight: 500;
}

.emp-store-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  color: white;
}

.fte-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
}

/* ============================================================
   EMPLOYEE VIEW (Müüja vaade)
   ============================================================ */
.employee-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
  gap: var(--space-3);
}

.employee-selector {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.employee-selector select {
  padding: 6px 32px 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
  font-weight: 500;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  min-width: 200px;
}

.emp-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.emp-summary-card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}

.emp-summary-card .value {
  font-size: var(--text-xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.emp-summary-card .label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.emp-day-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-2);
}

.emp-day-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  transition: all var(--transition);
}

.emp-day-card.day-off {
  opacity: 0.5;
}

.emp-day-card.day-leave {
  border-left: 3px solid var(--color-primary);
}

.emp-day-date {
  text-align: center;
  min-width: 40px;
}

.emp-day-date .date-num {
  font-size: var(--text-lg);
  font-weight: 700;
}

.emp-day-date .date-weekday {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  text-transform: uppercase;
}

.emp-day-info {
  flex: 1;
}

.emp-day-store {
  font-weight: 600;
  font-size: var(--text-sm);
}

.emp-day-hours {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ============================================================
   POE VAADE (STORE VIEW)
   ============================================================ */
.store-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
  gap: var(--space-3);
}

.store-selector {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.store-selector select {
  padding: 6px 32px 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
  font-weight: 500;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  min-width: 200px;
}

.store-day-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.store-day-card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  transition: all var(--transition);
  min-height: 80px;
}

.store-day-card.store-covered {
  border-left: 3px solid var(--color-success);
}

.store-day-card.store-uncovered {
  border-left: 3px solid var(--color-error);
  background: rgba(220, 38, 38, 0.04);
}

[data-theme="dark"] .store-day-card.store-uncovered {
  background: rgba(220, 38, 38, 0.08);
}

.store-day-card.store-closed {
  border-left: 3px solid var(--color-text-faint);
  opacity: 0.5;
}

.store-day-card.store-holiday {
  border-right: 3px solid var(--color-warning);
}

.store-day-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.store-day-num {
  font-size: var(--text-lg);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.store-day-letter {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  text-transform: uppercase;
  font-weight: 500;
}

.store-day-letter.weekend {
  color: var(--color-error);
}

.store-day-holiday {
  font-size: var(--text-xs);
  color: var(--color-warning);
  font-weight: 500;
  margin-left: auto;
}

.store-day-closed {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-style: italic;
  padding: var(--space-1) 0;
}

.store-day-empty {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-error);
  font-weight: 600;
  padding: var(--space-1) 0;
}

.store-day-employees {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.store-day-emp {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-offset);
  font-size: var(--text-xs);
}

.store-day-emp-guest {
  background: rgba(168, 85, 247, 0.08);
  border-left: 2px solid var(--color-purple, #a855f7);
}

[data-theme="dark"] .store-day-emp-guest {
  background: rgba(168, 85, 247, 0.12);
}

.store-day-emp-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.store-day-emp-hours {
  font-variant-numeric: tabular-nums;
  color: var(--color-text-muted);
  font-weight: 600;
  flex-shrink: 0;
}

.store-day-total {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-1);
  text-align: right;
  font-weight: 500;
}

.store-emp-summary {
  margin-top: var(--space-2);
}

.store-guest-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  color: #a855f7;
  background: rgba(168, 85, 247, 0.1);
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: middle;
}

[data-theme="dark"] .store-guest-badge {
  background: rgba(168, 85, 247, 0.2);
}

/* ============================================================
   WEEKLY CALENDAR GRID (Müüja vaade & Poe vaade)
   ============================================================ */
.week-calendar {
  margin-bottom: var(--space-5);
}

.week-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  margin-bottom: 1px;
}

.week-header-cell {
  text-align: center;
  font-size: var(--text-sm);
  font-weight: 700;
  padding: var(--space-2) 0;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.week-header-cell.weekend {
  color: var(--color-text-faint);
}

.week-body {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--color-divider);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.week-cell {
  background: var(--color-surface);
  padding: var(--space-2) var(--space-2);
  min-height: 80px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background var(--transition);
}

.week-cell:hover {
  background: var(--color-surface-offset);
}

.week-cell-empty {
  background: var(--color-bg);
  min-height: 80px;
}

.week-cell-empty:hover {
  background: var(--color-bg);
}

.week-cell-weekend {
  background: var(--color-surface-offset);
}

.week-cell-weekend:hover {
  background: var(--color-divider);
}

.week-cell-off {
  opacity: 0.55;
}

.week-cell-leave {
  border-left: 3px solid var(--color-primary);
}

.week-cell-covered {
  border-left: 3px solid var(--color-success);
}

.week-cell-uncovered {
  border-left: 3px solid var(--color-error);
  background: rgba(220, 38, 38, 0.04);
}

[data-theme="dark"] .week-cell-uncovered {
  background: rgba(220, 38, 38, 0.08);
}

.week-cell-closed {
  opacity: 0.45;
}

.week-cell-holiday {
  border-right: 3px solid var(--color-warning);
}

.week-cell-date {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 2px;
}

.week-cell-store {
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.2;
}

.week-cell-hours {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.week-cell-label {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.week-cell-holiday-label {
  font-size: 9px;
  color: var(--color-warning);
  font-weight: 500;
  line-height: 1.1;
  margin-top: auto;
}

.week-cell-emp {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-offset);
  font-size: 11px;
  font-weight: 500;
  gap: 2px;
}

.sv-emp-click {
  cursor: pointer;
  transition: background 0.15s;
}

.sv-emp-click:hover {
  background: var(--color-primary);
  color: #fff;
}

.sv-emp-click:hover .week-cell-hours {
  color: rgba(255,255,255,0.85);
}

.week-cell-emp-guest {
  background: rgba(168, 85, 247, 0.08);
  border-left: 2px solid #a855f7;
}

[data-theme="dark"] .week-cell-emp-guest {
  background: rgba(168, 85, 247, 0.12);
}

.week-cell-emp .week-cell-hours {
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
}

.week-cell-total {
  font-size: 10px;
  color: var(--color-text-faint);
  text-align: right;
  font-weight: 600;
  margin-top: auto;
}

@media (max-width: 640px) {
  .week-cell {
    min-height: 60px;
    padding: var(--space-1);
  }
  .week-cell-date {
    font-size: var(--text-xs);
  }
  .week-cell-store {
    font-size: 10px;
  }
  .week-cell-emp {
    font-size: 9px;
    padding: 1px 2px;
  }
}

/* ============================================================
   KOKKUVÕTE (SUMMARY DASHBOARD)
   ============================================================ */
/* Summary period toggle */
.summary-period-toggle {
  display: inline-flex;
  background: var(--color-surface-offset);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: var(--space-5);
  gap: 2px;
}

.period-btn {
  padding: 6px 20px;
  border: none;
  background: transparent;
  border-radius: calc(var(--radius-md) - 2px);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 150ms ease;
}

.period-btn:hover {
  color: var(--color-text);
  background: var(--color-surface);
}

.period-btn.active {
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.kpi-card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-sm);
}

.kpi-card .kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.kpi-card .kpi-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 4px;
  font-weight: 500;
}

.kpi-card .kpi-delta {
  font-size: var(--text-xs);
  font-weight: 600;
  margin-top: 2px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.dashboard-card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-sm);
}

.dashboard-card h3 {
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: var(--space-3);
}

/* Chart containers */
.chart-container {
  position: relative;
  width: 100%;
  height: 280px;
}

/* Coverage heatmap */
.heatmap-grid {
  display: grid;
  grid-template-columns: 100px repeat(7, 1fr);
  gap: 2px;
  font-size: var(--text-xs);
}

.heatmap-header {
  font-weight: 600;
  color: var(--color-text-muted);
  text-align: center;
  padding: var(--space-1);
}

.heatmap-label {
  font-weight: 500;
  padding: var(--space-1) var(--space-2);
  display: flex;
  align-items: center;
}

.heatmap-cell {
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-1);
  font-weight: 600;
  font-size: 10px;
  min-height: 28px;
}

/* Leave summary */
.leave-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.leave-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-divider);
  font-size: var(--text-sm);
}

.leave-item:last-child {
  border-bottom: none;
}

/* ============================================================
   PUHKUSED — LEAVES GANTT CHART
   ============================================================ */
.leaves-gantt {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-x: auto;
  min-width: 0;
}

.gantt-row {
  display: flex;
  align-items: stretch;
  min-height: 28px;
  gap: 0;
}

.gantt-header {
  min-height: 24px;
  margin-bottom: var(--space-1);
  border-bottom: 1px solid var(--color-divider);
  padding-bottom: var(--space-1);
}

.gantt-header .gantt-month {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.gantt-name {
  flex: 0 0 170px;
  min-width: 170px;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding-right: var(--space-2);
  overflow: hidden;
}

.gantt-emp-name {
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gantt-month {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.gantt-month-cells {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-width: 0;
  border-left: 1px solid var(--color-divider);
}

.gantt-block {
  min-width: 0;
  min-height: 22px;
  border-radius: 0;
}

.gantt-block.gantt-vac {
  background: var(--color-leave-vac);
  opacity: 0.85;
  border-radius: 2px;
  margin: 3px 0;
}

.gantt-block.gantt-sick {
  background: var(--color-leave-sick);
  opacity: 0.85;
  border-radius: 2px;
  margin: 3px 0;
}

.gantt-block.gantt-empty {
  background: transparent;
}

/* Hover effect on gantt rows */
.gantt-row:not(.gantt-header):hover {
  background: var(--color-surface-offset);
  border-radius: var(--radius-sm);
}

/* Totals column */
.gantt-total {
  flex: 0 0 90px;
  min-width: 90px;
  font-size: var(--text-xs);
  text-align: right;
  padding-right: var(--space-2);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  color: var(--color-text-muted);
  border-left: 1px solid var(--color-divider);
}

.gantt-header .gantt-total {
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Gantt zebra rows */
.gantt-row-odd {
  background: rgba(0,0,0,0.018);
}

/* Gantt totals formatting */
.gantt-total-num {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--color-text);
}
.gantt-total-unit {
  font-weight: 500;
  color: var(--color-text-muted);
  margin-left: 1px;
}
.gtot-vac {
  color: var(--color-leave-vac);
  font-weight: 600;
  font-size: var(--text-xs);
}
.gtot-sick {
  color: var(--color-leave-sick);
  font-weight: 600;
  font-size: var(--text-xs);
  margin-left: 3px;
}

/* Leaves Gantt card */
.leaves-gantt-card {
  margin-bottom: var(--space-4);
  padding: 0 !important;
  overflow: hidden;
}

.leaves-gantt-title {
  padding: var(--space-4) var(--space-5) var(--space-3) var(--space-5);
  margin-bottom: 0 !important;
}

.leaves-gantt-card .leaves-gantt {
  padding: 0 var(--space-3) var(--space-2) var(--space-3);
}

/* Legend */
.leaves-legend {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-5) var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.leaves-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.leaves-legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

/* Leaves month overview card */
.leaves-month-card {
  padding: 0 !important;
  overflow: hidden;
}

.leaves-month-title {
  padding: var(--space-4) var(--space-5) var(--space-3) var(--space-5);
  margin-bottom: 0 !important;
}

/* Month grid rows */
.leaves-months-grid {
  display: flex;
  flex-direction: column;
}

.lm-row {
  display: grid;
  grid-template-columns: 100px 1fr 140px 1fr;
  align-items: center;
  padding: 10px var(--space-5);
  gap: var(--space-3);
  border-bottom: 1px solid var(--color-divider);
  transition: background 100ms ease;
}

.lm-row:last-child {
  border-bottom: none;
}

.lm-row:hover {
  background: rgba(37,99,235,0.03) !important;
}

.lm-odd {
  background: rgba(0,0,0,0.015);
}

.lm-empty {
  opacity: 0.5;
}

.lm-month-name {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-text);
}

/* Stats bar section */
.lm-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lm-bar-wrap {
  height: 6px;
  background: var(--color-surface-offset);
  border-radius: 3px;
  overflow: hidden;
}

.lm-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 300ms ease;
}

.lm-bar-vac {
  background: var(--color-leave-vac);
  opacity: 0.7;
}

.lm-nums {
  display: flex;
  gap: var(--space-2);
  font-size: var(--text-xs);
}

.lm-num-vac {
  font-weight: 600;
  color: var(--color-primary);
}

.lm-num-sick {
  font-weight: 600;
  color: var(--color-error);
}

/* People count */
.lm-people {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.lm-people-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  background: rgba(37,99,235,0.1);
  color: var(--color-primary);
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 0 6px;
}

.lm-people-sick {
  background: rgba(239,68,68,0.1);
  color: var(--color-error);
}

.lm-people-label {
  font-size: 10px;
  color: var(--color-text-muted);
  margin-right: 4px;
}

/* Name badges */
.lm-names {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.lm-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 500;
  white-space: nowrap;
}

.lm-badge-vac {
  background: rgba(59,130,246,0.1);
  color: #2563eb;
}

.lm-badge-sick {
  background: rgba(239,68,68,0.1);
  color: #dc2626;
}

/* Responsive: smaller name column on narrow screens */
@media (max-width: 768px) {
  .gantt-name {
    flex: 0 0 110px;
    min-width: 110px;
  }
  .gantt-emp-name {
    font-size: 10px;
  }
  .gantt-total {
    flex: 0 0 60px;
    min-width: 60px;
    font-size: 10px;
  }
  .lm-row {
    grid-template-columns: 80px 1fr;
    grid-template-rows: auto auto;
  }
  .lm-people, .lm-names {
    grid-column: 1 / -1;
  }
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 200ms ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 420px;
  padding: var(--space-5);
  transform: translateY(10px);
  transition: transform 200ms ease;
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.modal-header h3 {
  font-size: var(--text-lg);
  font-weight: 600;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.form-group label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-group select,
.form-group input {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
}

.form-group select:focus,
.form-group input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.form-hint {
  font-size: 11px;
  color: var(--color-text-faint);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

/* ============================================================
   CONTEXT MENU (for right-click leave marking)
   ============================================================ */
.context-menu {
  position: fixed;
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-1);
  z-index: 2000;
  min-width: 160px;
  display: none;
}

.context-menu.active {
  display: block;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.context-menu-item:hover {
  background: var(--color-primary-bg);
  color: var(--color-primary);
}

.context-menu-divider {
  height: 1px;
  background: var(--color-divider);
  margin: var(--space-1) 0;
}

/* ============================================================
   TOOLTIP
   ============================================================ */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-text);
  color: var(--color-text-inverse);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 150ms;
  z-index: 100;
}

[data-tooltip]:hover::after {
  opacity: 1;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .app {
    grid-template-columns: 56px 1fr;
  }
  .sidebar {
    width: 56px;
  }
  .sidebar-logo h1,
  .sidebar-logo .logo-sub,
  .nav-item span,
  .nav-badge,
  .sidebar-nav-label {
    display: none;
  }
  .nav-item {
    justify-content: center;
    padding: var(--space-2);
  }
  .sidebar-logo {
    justify-content: center;
    padding: var(--space-3);
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    bottom: 0;
    width: 260px;
    transition: left 250ms ease;
    z-index: 200;
  }

  .sidebar.open {
    left: 0;
  }

  .sidebar-logo h1,
  .sidebar-logo .logo-sub,
  .nav-item span,
  .nav-badge,
  .sidebar-nav-label {
    display: unset;
  }

  .nav-item {
    justify-content: flex-start;
    padding: var(--space-2) var(--space-3);
  }

  .sidebar-logo {
    justify-content: flex-start;
    padding: var(--space-5) var(--space-4);
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 199;
    display: none;
  }

  .sidebar-overlay.active {
    display: block;
  }

  .btn-menu {
    display: flex !important;
  }

  .page-content {
    padding: var(--space-3);
  }

  .topbar {
    padding: var(--space-3) var(--space-4);
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .emp-day-cards {
    grid-template-columns: 1fr;
  }

  .store-day-grid {
    grid-template-columns: 1fr;
  }

  .week-header-cell {
    font-size: var(--text-xs);
    padding: var(--space-1) 0;
  }

  .schedule-table .col-name {
    min-width: 120px;
    max-width: 120px;
  }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
.schedule-scroll::-webkit-scrollbar,
.main-content::-webkit-scrollbar {
  width: 10px;
  height: 12px;
}

.schedule-scroll::-webkit-scrollbar-track,
.main-content::-webkit-scrollbar-track {
  background: var(--color-bg);
  border-radius: 6px;
}

.schedule-scroll::-webkit-scrollbar-thumb,
.main-content::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 6px;
  border: 2px solid var(--color-bg);
}

.schedule-scroll::-webkit-scrollbar-thumb:hover,
.main-content::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-faint);
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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

/* ============================================================
   UTILITY
   ============================================================ */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border-width: 0;
}

.text-muted { color: var(--color-text-muted); }
.text-faint { color: var(--color-text-faint); }
.font-mono { font-variant-numeric: tabular-nums lining-nums; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* Footer */
.app-footer {
  padding: var(--space-4) var(--space-5);
  text-align: center;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  border-top: 1px solid var(--color-divider);
}

.app-footer a {
  color: var(--color-text-faint);
  text-decoration: none;
}

.app-footer a:hover {
  color: var(--color-text-muted);
  text-decoration: underline;
}

/* ============================================================
   EMPLOYEE MANAGEMENT
   ============================================================ */
.emp-actions-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  padding: 0 var(--space-1);
}

.emp-actions-bar .btn-sm {
  font-size: 0.8125rem;
  padding: 0.4rem 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.emp-count {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.th-actions {
  width: 80px;
  text-align: center;
  font-size: 0.75rem;
}

.td-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  justify-content: center;
}

.td-actions .btn-icon {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.td-actions .btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.td-actions .btn-del-emp:hover {
  color: var(--color-error);
  background: rgba(239, 68, 68, 0.08);
}

.btn-danger {
  background: var(--color-error);
  color: white;
  border: none;
  cursor: pointer;
}

.btn-danger:hover {
  opacity: 0.9;
}

/* ============================================================
   STORE MANAGEMENT (Poed)
   ============================================================ */
.store-modal {
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.store-modal .modal-body {
  overflow-y: auto;
  max-height: calc(90vh - 130px);
  padding-bottom: var(--space-4);
}

.store-schedule-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.store-schedule-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) 0;
  font-size: var(--text-sm);
}

.store-day-label {
  width: 90px;
  font-weight: 500;
  color: var(--color-text);
  font-size: var(--text-xs);
  flex-shrink: 0;
}

.store-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  cursor: pointer;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  flex-shrink: 0;
  width: 70px;
}

.store-toggle input[type="checkbox"] {
  accent-color: var(--color-primary);
}

.store-time-input {
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-xs);
  width: 100px;
  min-width: 100px;
  font-family: var(--font-body);
}

.store-time-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-light);
}

.store-time-input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.store-period-card {
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-bottom: var(--space-2);
  background: var(--color-surface-2);
}

.store-period-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-divider);
}

.store-closure-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.store-closure-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-1) var(--space-2);
  background: var(--color-surface-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}

.store-closure-item span {
  color: var(--color-text);
}

.td-actions .btn-del-store:hover {
  color: var(--color-error);
  background: rgba(239, 68, 68, 0.08);
}

/* ============================================================
   PERIOD VIEW — REDESIGNED
   ============================================================ */

/* Fund strip: 4 horizontal cards */
.period-fund-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.period-fund-card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.pfc-header {
  padding: var(--space-2) var(--space-3);
  border-top: 3px solid var(--color-primary);
  background: var(--color-surface-2);
}

.pfc-month {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pfc-body {
  padding: var(--space-3);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.pfc-metric {
  display: flex;
  flex-direction: column;
}

.pfc-value {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.pfc-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 500;
}

.pfc-holidays {
  width: 100%;
  font-size: 10px;
  color: var(--color-text-faint);
  line-height: 1.4;
  padding-top: var(--space-1);
  border-top: 1px solid var(--color-divider);
}

/* Employee period card */
.period-emp-card {
  padding: 0 !important;
  overflow: hidden;
}

.period-emp-title {
  padding: var(--space-4) var(--space-5) var(--space-3) var(--space-5);
  margin-bottom: 0 !important;
}

/* Period table */
.period-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.period-table thead {
  position: sticky;
  top: 0;
  z-index: 3;
}

/* Group header row */
.ptr-group th {
  padding: 8px 6px 4px;
  text-align: center;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text);
  background: var(--color-surface);
  border-bottom: none;
}

.pt-month-group {
  letter-spacing: 0.02em;
}

.pt-total-group {
  background: var(--color-surface-offset) !important;
  font-size: var(--text-xs) !important;
  font-weight: 700 !important;
  color: var(--color-text) !important;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-left: 2px solid var(--color-divider) !important;
}

/* Sub header row */
.ptr-sub th {
  padding: 2px 6px 6px;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-divider);
}

.pt-total-sub {
  background: var(--color-surface-offset) !important;
  border-left: 2px solid var(--color-divider) !important;
}

.pt-total-sub:last-child {
  border-left: none !important;
}

/* Sticky name column */
.pt-sticky {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--color-surface) !important;
}

.pt-name {
  text-align: left;
  min-width: 160px;
  font-weight: 600;
  border-right: 1px solid var(--color-divider);
}

.pt-name-cell {
  white-space: nowrap;
  padding: 7px 10px;
  border-right: 1px solid var(--color-divider);
}

.pt-emp-name {
  font-weight: 500;
  color: var(--color-text);
}

.pt-store-badge {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
  margin-left: 4px;
}

/* Value cells */
.pt-val {
  text-align: center;
  padding: 7px 4px;
  font-size: var(--text-xs);
  color: var(--color-text);
  min-width: 42px;
}

.pt-empty {
  color: var(--color-text-faint) !important;
}

/* Diff color classes */
.pt-over {
  color: var(--color-error) !important;
  font-weight: 600;
}

.pt-under {
  color: var(--color-warning) !important;
  font-weight: 600;
}

.pt-ok {
  color: var(--color-success) !important;
}

/* Total columns */
.pt-total-val {
  text-align: center;
  padding: 7px 6px;
  font-size: var(--text-xs);
  font-weight: 600;
  border-left: 2px solid var(--color-divider);
  background: var(--color-surface-offset);
}

/* Zebra striping */
.ptr-even td { }
.ptr-odd td {
  background-color: rgba(0,0,0,0.018);
}
.ptr-odd .pt-sticky {
  background: #fafbfc !important;
}
.ptr-odd .pt-total-val {
  background: #eef1f5;
}

/* Override tinted backgrounds on odd rows with slight darkening */
.ptr-odd .pt-val[style*="background"] {
  filter: brightness(0.985);
}

/* Footer totals */
.ptr-footer td {
  border-top: 2px solid var(--color-divider);
  background: var(--color-surface-2) !important;
  padding: 8px 4px;
  font-size: var(--text-xs);
}

.ptr-footer .pt-sticky {
  background: var(--color-surface-2) !important;
}

.ptr-footer .pt-total-val {
  background: var(--color-surface-offset) !important;
}

/* Hover row */
.period-table tbody tr:not(.ptr-footer):hover td {
  background-color: rgba(37,99,235,0.04) !important;
}
.period-table tbody tr:not(.ptr-footer):hover .pt-sticky {
  background: #eef2ff !important;
}

/* ---- Estimated / Prognoos styling ---- */

/* Badge in month group header */
.pt-est-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(139,92,246,0.12);
  color: #7c3aed;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 5px;
  vertical-align: middle;
}

/* Estimated cells in table body */
.pt-estimated {
  font-style: italic;
  color: #7c3aed !important;
  opacity: 0.85;
}
.pt-est-zero {
  color: #a78bfa !important;
  font-size: 0.72rem;
}

/* Totals that include estimated data */
.pt-total-has-est {
  font-style: italic;
}

/* Fund card prognoos styling */
.pfc-estimated {
  border: 1.5px dashed rgba(139,92,246,0.35);
  background: rgba(139,92,246,0.03);
}
.pfc-est-tag {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(139,92,246,0.12);
  color: #7c3aed;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 8px;
}

/* Responsive: stack fund cards on mobile */
@media (max-width: 768px) {
  .period-fund-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Alerts Strip ── */
.alerts-strip {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2);
  margin-bottom: var(--space-3);
  overflow: hidden;
}
.alerts-strip-summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  user-select: none;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
}
.alerts-strip-summary:hover {
  background: var(--color-hover);
}
.alerts-strip-arrow {
  transition: transform 0.15s ease;
  color: var(--color-text-muted);
}
.alerts-strip-arrow.expanded {
  transform: rotate(90deg);
}
.alerts-strip-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
}
.alerts-strip-badge.critical {
  background: var(--color-error);
}
.alerts-strip-badge.warning {
  background: var(--color-warning);
}
.alerts-strip-ok {
  color: var(--color-success);
  font-weight: 600;
}
.alerts-strip-details {
  display: none;
  padding: 0 var(--space-3) var(--space-3);
}
.alerts-strip-details.open {
  display: block;
}
.alerts-strip-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-1) 0;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border-light);
}
.alerts-strip-item:last-child {
  border-bottom: none;
}
.alerts-strip-item .dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
}
.alerts-strip-item .dot.critical {
  background: var(--color-error);
}
.alerts-strip-item .dot.warning {
  background: var(--color-warning);
}

/* ── Save Toast ── */
.save-toast {
  position: fixed;
  bottom: var(--space-4);
  right: var(--space-4);
  background: var(--color-success);
  color: #fff;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-2);
  font-size: var(--text-sm);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 9999;
}
.save-toast.show,
.save-toast.active {
  opacity: 1;
  transform: translateY(0);
}

/* ── View Mode Toggle (Kuu / Nädal) ── */
.view-mode-toggle {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2);
  overflow: hidden;
  font-size: var(--text-sm);
}
.view-mode-toggle button {
  padding: var(--space-1) var(--space-3);
  border: none;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: inherit;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.view-mode-toggle button:not(:last-child) {
  border-right: 1px solid var(--color-border);
}
.view-mode-toggle button:hover {
  background: var(--color-hover);
}
.view-mode-toggle button.active {
  background: var(--color-primary);
  color: #fff;
}

/* ── Week Navigation ── */
.week-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
}
.week-nav-label {
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
}

/* ── Coverage Bar (Store View) ── */
.coverage-bar-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.coverage-bar {
  flex: 1;
  height: 8px;
  background: var(--color-border);
  border-radius: 4px;
  overflow: hidden;
  max-width: 300px;
}
.coverage-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}
.coverage-bar-label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  white-space: nowrap;
  font-weight: 500;
}

/* ── Change Log Modal ── */
.log-modal {
  max-width: 560px;
  max-height: 80vh;
}
.log-modal .modal-body {
  max-height: 60vh;
  overflow-y: auto;
}
.log-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.log-item {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-sm);
  border-radius: var(--radius-1);
  background: var(--color-surface);
}
.log-item:nth-child(even) {
  background: var(--color-hover);
}
.log-item-delete {
  background: rgba(239, 68, 68, 0.06) !important;
}
.log-item-bulk {
  background: rgba(59, 130, 246, 0.06) !important;
}
.log-ts {
  color: var(--color-text-faint);
  font-size: 0.75rem;
  min-width: 72px;
  flex-shrink: 0;
  font-family: monospace;
}
.log-action {
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  min-width: 56px;
  flex-shrink: 0;
  color: var(--color-text-muted);
}
.log-emp {
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
}
.log-day {
  color: var(--color-text-secondary);
  white-space: nowrap;
}
.log-details {
  color: var(--color-text-secondary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Print / PDF Export ── */
@media print {
  body > *:not(#print-container) {
    display: none !important;
  }
  #print-container {
    display: block !important;
    position: static !important;
    width: 100% !important;
  }
  #print-container table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9pt;
    page-break-inside: auto;
  }
  #print-container th,
  #print-container td {
    border: 1px solid #999;
    padding: 3px 5px;
    text-align: center;
  }
  #print-container th {
    background: #eee !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  #print-container td[style*="background"] {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  #print-container h2 {
    font-size: 14pt;
    margin-bottom: 8px;
  }
  @page {
    size: landscape;
    margin: 10mm;
  }
}

/* ============================================================
   DAY OVERRIDE MODAL & VISUAL INDICATORS
   ============================================================ */

/* Day override modal */
.dayoverride-holiday-banner { background: #fef3c7; border: 1px solid #f59e0b; border-radius: 8px; padding: 8px 12px; margin: 0 0 12px; font-size: 13px; color: #92400e; }
.dayoverride-store-list { padding-bottom: 4px; max-height: 400px; overflow-y: auto; }
.dayoverride-store-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--color-border); flex-wrap: wrap; }
.dayoverride-store-name { min-width: 140px; font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.dayoverride-store-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dayoverride-options { display: flex; gap: 4px; }
.dayoverride-opt { padding: 4px 10px; border-radius: 6px; border: 1px solid var(--color-border); background: var(--color-bg); font-size: 12px; cursor: pointer; transition: all 0.15s; }
.dayoverride-opt:hover { border-color: var(--color-primary); }
.dayoverride-opt.active { background: #e0f2fe; border-color: var(--color-primary); color: var(--color-primary); }
.dayoverride-opt[data-opt="closed"].active { background: #fee2e2; border-color: #ef4444; color: #991b1b; }
.dayoverride-opt[data-opt="shortened"].active { background: #fef3c7; border-color: #f59e0b; color: #92400e; }
.dayoverride-opt[data-opt="normal"].active { background: #dcfce7; border-color: #22c55e; color: #166534; }
.dayoverride-hours-input { width: 110px; padding: 4px 8px; border: 1px solid var(--color-border); border-radius: 6px; font-size: 12px; margin-left: 6px; }
.dayoverride-short-input { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--color-text-muted); }
.dayoverride-modal { max-width: 600px; }

/* Clickable day headers */
.th-clickable { cursor: pointer; position: relative; user-select: none; }
.th-clickable:hover { background: var(--color-surface-offset) !important; }

/* Holiday dot */
.holiday-dot { display: inline-block; width: 6px; height: 6px; background: #ef4444; border-radius: 50%; margin-left: 2px; vertical-align: top; margin-top: 1px; }

/* Closed day cell */
.day-closed-cell { background: repeating-linear-gradient(45deg, transparent, transparent 3px, rgba(156,163,175,0.12) 3px, rgba(156,163,175,0.12) 6px) !important; }
.day-closed-badge { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 20px; color: var(--color-text-faint); font-size: 14px; font-weight: 300; }

/* Shortened day cell */
.day-shortened-cell { background: rgba(245,158,11,0.06) !important; }

/* Outside-month days in week view */
.col-outside { opacity: 0.35; background: var(--color-bg) !important; }
.col-outside .day-number { color: var(--color-text-faint); }
.col-outside .day-letter { color: var(--color-text-faint); }
td.col-outside { background: var(--color-bg) !important; cursor: default; }

/* ============================================================
   REGION SELECTOR
   ============================================================ */
.region-selector {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
}
.region-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-faint);
  margin-bottom: var(--space-2);
}
.region-btns {
  display: flex;
  gap: var(--space-1);
  background: var(--color-surface-sunken);
  border-radius: var(--radius-md);
  padding: 2px;
}
.region-btn {
  flex: 1;
  padding: var(--space-1) var(--space-2);
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  background: transparent;
  color: var(--color-text-muted);
  transition: all 0.15s ease;
}
.region-btn:hover {
  color: var(--color-text);
}
.region-btn.active {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* Read-only banner for cross-region viewing */
.readonly-banner {
  background: var(--color-warning-bg, #fef3c7);
  color: var(--color-warning-text, #92400e);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
  text-align: center;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}
[data-theme="dark"] .readonly-banner {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
#login-screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--color-bg);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-container {
  width: 100%;
  max-width: 400px;
}

.login-card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  justify-content: center;
}

.login-logo .logo-icon {
  width: 40px;
  height: 40px;
  background: #1a2332;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.login-logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
}

.login-logo .logo-sub {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 600;
  letter-spacing: 0.1em;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-field label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text);
}

.form-field input[type="email"],
.form-field input[type="password"] {
  font-family: var(--font-body);
  font-size: 0.875rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 150ms, box-shadow 150ms;
  color: var(--color-text);
  background: var(--color-surface);
  width: 100%;
}

.form-field input[type="email"]:focus,
.form-field input[type="password"]:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.login-btn {
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.75rem 1rem;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 150ms;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.login-btn:hover { background: var(--color-primary-hover); }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.login-error {
  background: var(--color-error-bg);
  color: var(--color-error);
  font-size: 0.8125rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-md);
  display: none;
}
.login-error.visible { display: block; }

.login-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}
.login-footer a { color: var(--color-text-muted); text-decoration: none; }

.login-btn .spinner {
  display: none;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: loginspin 0.6s linear infinite;
}
.login-btn.loading .spinner { display: inline-block; }
@keyframes loginspin { to { transform: rotate(360deg); } }

/* User menu in sidebar */
.sidebar-user {
  padding: var(--space-3);
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--sidebar-text);
}

.sidebar-user .user-name {
  font-weight: 500;
  color: var(--sidebar-text-active);
  font-size: var(--text-sm);
}

.sidebar-user .user-role {
  font-size: var(--text-xs);
  color: var(--sidebar-text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-logout {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--sidebar-text);
  background: none;
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  cursor: pointer;
  margin-left: auto;
  transition: color 150ms, border-color 150ms;
}
.btn-logout:hover {
  color: var(--color-error);
  border-color: var(--color-error);
}

/* Read-only banner */
.readonly-banner {
  background: var(--color-warning-bg, #fef3cd);
  color: var(--color-warning-text, #856404);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  border-bottom: 1px solid var(--color-warning-border, #ffc107);
}
[data-theme="dark"] .readonly-banner {
  background: rgba(255, 193, 7, 0.15);
  color: #ffc107;
  border-color: rgba(255, 193, 7, 0.3);
}

/* Wish day calendar selection */
.wish-day-cell {
  cursor: pointer;
  transition: background 150ms, box-shadow 150ms;
  user-select: none;
}
.wish-day-cell:hover {
  background: var(--color-primary-bg, rgba(0, 150, 136, 0.08));
}
.wish-day-selected {
  background: var(--color-primary-bg, rgba(0, 150, 136, 0.15)) !important;
  box-shadow: inset 0 0 0 2px var(--color-primary, #009688);
  border-radius: 6px;
}
.wish-day-selected .week-cell-date {
  color: var(--color-primary, #009688);
  font-weight: 700;
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}
.badge-warning {
  background: rgba(255, 193, 7, 0.15);
  color: #b8860b;
}
.badge-success {
  background: rgba(76, 175, 80, 0.15);
  color: #2e7d32;
}
.badge-error {
  background: rgba(244, 67, 54, 0.15);
  color: #c62828;
}
[data-theme="dark"] .badge-warning { color: #ffc107; }
[data-theme="dark"] .badge-success { color: #66bb6a; }
[data-theme="dark"] .badge-error { color: #ef5350; }

/* Button variants */
.btn-success {
  background: #4caf50;
  color: white;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}
.btn-success:hover { background: #43a047; }
.btn-danger {
  background: #f44336;
  color: white;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}
.btn-danger:hover { background: #e53935; }

/* Password button in sidebar */
.btn-password {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 4px 6px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: border-color 150ms;
}
.btn-password:hover {
  border-color: var(--color-primary);
}

/* Loading text */
.loading-text {
  color: var(--color-text-secondary);
  font-size: 13px;
  padding: var(--space-2) 0;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--color-text-secondary);
}

/* E-pood: green highlight when 2+ workers */
.week-cell-epood-good {
  background: #dcfce7 !important;
  border-color: #86efac !important;
}
.week-cell-epood-good .week-cell-date {
  color: #166534;
}

/* Haigus: preserved work hours display */
.haigus-prev-hours {
  display: block;
  font-size: 9px;
  color: var(--color-text-faint);
  text-decoration: line-through;
  line-height: 1;
  margin-top: 1px;
}

/* Public holiday hours column */
.hours-holiday {
  color: #dc2626;
  font-weight: 600;
}

/* Leave hours column */
.hours-leave {
  color: #2563eb;
  font-weight: 600;
}

/* Sick hours column */
.hours-sick {
  color: #d97706;
  font-weight: 600;
}
