/* ============================================================
   Ηλεκτρονική Γραμματεία - CSS
   Mobile-first, CSS Variables, Modern UI
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --color-primary:       #78B97A;
  --color-primary-dark:  #315B3D;
  --color-primary-light: #EDF7EE;
  --color-secondary:     #A8CFA6;
  --color-success:       #6FAE72;
  --color-warning:       #C8A96B;
  --color-danger:        #B86B6B;
  --color-info:          #6E8F7A;

  --color-gray-50:  #EEF3F6;
  --color-gray-100: #FBFCFB;
  --color-gray-200: #DCE7DF;
  --color-gray-300: #C5D5CB;
  --color-gray-400: #92A89B;
  --color-gray-500: #6B7C72;
  --color-gray-600: #4E6057;
  --color-gray-700: #3D5040;
  --color-gray-800: #2F3E34;
  --color-gray-900: #253328;

  --sidebar-width:    260px;
  --header-height:    60px;
  --bottomnav-height: 60px;

  --font-sans: "Century Gothic", CenturyGothic, AppleGothic, Arial, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.1), 0 2px 6px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.12), 0 4px 10px rgba(0,0,0,.08);
  --transition: 150ms ease;
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--font-sans);
  background: var(--color-gray-50);
  color: var(--color-gray-800);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ── Typography ─────────────────────────────────────────────── */
h1 { font-size: 1.5rem;  font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1.1rem;  font-weight: 600; }
h4 { font-size: 1rem;    font-weight: 600; }

.text-sm  { font-size: .875rem; }
.text-xs  { font-size: .75rem;  }
.text-lg  { font-size: 1.125rem; }
.text-xl  { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }

.text-muted   { color: var(--color-gray-500); }
.text-success { color: var(--color-success); }
.text-danger  { color: var(--color-danger);  }
.text-warning { color: var(--color-warning); }
.text-primary { color: var(--color-primary); }
.font-bold    { font-weight: 700; }
.font-semibold{ font-weight: 600; }

/* ── Layout ─────────────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar (desktop) ──────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-gray-900);
  color: #fff;
  display: none; /* hidden on mobile */
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-brand .brand-icon {
  width: 36px; height: 36px;
  background: var(--color-primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.sidebar-brand .brand-name {
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
}
.sidebar-brand .brand-sub {
  font-size: .7rem;
  color: var(--color-gray-400);
}
.sidebar-brand .brand-logo {
  height: 36px;
  max-width: 140px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
}

.nav-section {
  padding: .25rem 0 .5rem;
}
.nav-section-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--color-gray-500);
  padding: .5rem 1.5rem .25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1.5rem;
  color: var(--color-gray-300);
  font-size: .875rem;
  font-weight: 500;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  text-decoration: none;
  position: relative;
}
.nav-item:hover {
  background: rgba(255,255,255,.07);
  color: #fff;
  text-decoration: none;
}
.nav-item.active {
  background: rgba(49, 91, 61, .28);
  color: #fff;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--color-primary);
  border-radius: 0 2px 2px 0;
}
.nav-item .nav-icon {
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: .95rem;
}
.nav-badge {
  margin-left: auto;
  background: var(--color-danger);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,.1);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.sidebar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: .875rem;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: .8rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: .7rem;
  color: var(--color-gray-400);
}

/* ── Main Content ───────────────────────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--bottomnav-height) + 1rem); /* space for bottom nav */
}

/* ── Top Header (mobile) ────────────────────────────────────── */
.top-header {
  height: var(--header-height);
  background: #fff;
  border-bottom: 1px solid var(--color-gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: .75rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 700;
  color: var(--color-gray-900);
  font-size: .95rem;
}
.header-brand .brand-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.page-content {
  padding: 1rem;
  flex: 1;
}

/* ── Page Header ────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-gray-900);
  line-height: 1.3;
}
.page-subtitle {
  font-size: .8rem;
  color: var(--color-gray-500);
  margin-top: .2rem;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-gray-200);
  overflow: hidden;
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.card-title {
  font-size: .95rem;
  font-weight: 600;
  color: var(--color-gray-800);
}
.card-body { padding: 1.25rem; }
.card-footer {
  padding: .75rem 1.25rem;
  border-top: 1px solid var(--color-gray-200);
  background: var(--color-gray-50);
}

/* ── Stat Cards ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 1rem;
  border: 1px solid var(--color-gray-200);
  box-shadow: var(--shadow-sm);
}
.stat-label {
  font-size: .75rem;
  color: var(--color-gray-500);
  font-weight: 500;
  margin-bottom: .3rem;
}
.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--color-gray-900);
  line-height: 1;
}
.stat-sub {
  font-size: .7rem;
  color: var(--color-gray-400);
  margin-top: .25rem;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

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

.btn-secondary {
  background: var(--color-gray-200);
  color: var(--color-gray-700);
}
.btn-secondary:hover { background: var(--color-gray-300); color: var(--color-gray-800); }

.btn-success {
  background: var(--color-success);
  color: #fff;
}
.btn-success:hover { background: #5A9A5C; color: #fff; }

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}
.btn-danger:hover { background: #A05050; color: #fff; }

.btn-warning {
  background: var(--color-warning);
  color: #fff;
}
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--color-gray-300);
  color: var(--color-gray-700);
}
.btn-outline:hover { border-color: var(--color-gray-500); background: var(--color-gray-50); }

.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }
.btn-icon { padding: .4rem; width: 34px; height: 34px; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  color: var(--color-gray-700);
  margin-bottom: .35rem;
}
.form-label .required {
  color: var(--color-danger);
  margin-left: 2px;
}
.form-control {
  width: 100%;
  padding: .55rem .85rem;
  border: 1.5px solid var(--color-gray-300);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  color: var(--color-gray-800);
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(120, 185, 122, .2);
}
.form-control.is-invalid {
  border-color: var(--color-danger);
}
.form-control::placeholder { color: var(--color-gray-400); }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-error {
  font-size: .8rem;
  color: var(--color-danger);
  margin-top: .25rem;
}
.form-hint {
  font-size: .78rem;
  color: var(--color-gray-500);
  margin-top: .25rem;
}
.form-row {
  display: grid;
  gap: .75rem;
}
.form-check {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
}
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.table th {
  background: var(--color-gray-50);
  color: var(--color-gray-500);
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .6rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-gray-200);
  white-space: nowrap;
}
.table td {
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--color-gray-100);
  vertical-align: middle;
  color: var(--color-gray-700);
}
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--color-gray-50); }

/* Mobile: card-style table rows */
.table-mobile-card { display: none; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}
.badge-success   { background: #DAF0DB; color: #315B3D; }
.badge-warning   { background: #F3E8CC; color: #7A5520; }
.badge-danger    { background: #F5DADA; color: #8A3535; }
.badge-info      { background: #EEF5EF; color: #3D5040; }
.badge-secondary { background: var(--color-gray-200); color: var(--color-gray-600); }
.badge-primary   { background: var(--color-primary-light); color: var(--color-primary-dark); }

/* ── Flash Messages ─────────────────────────────────────────── */
.flash-container {
  position: fixed;
  top: calc(var(--header-height) + .75rem);
  right: 1rem;
  left: 1rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}
.flash {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .85rem 1rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: flash-in .25s ease;
}
@keyframes flash-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.flash-success { background: #DAF0DB; border-left: 4px solid var(--color-success); color: #315B3D; }
.flash-error   { background: #F5DADA; border-left: 4px solid var(--color-danger);  color: #8A3535; }
.flash-warning { background: #F3E8CC; border-left: 4px solid var(--color-warning); color: #7A5520; }
.flash-info    { background: #EEF5EF; border-left: 4px solid var(--color-info);    color: #3D5040; }
.flash-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  opacity: .6;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
}

/* ── Alert ──────────────────────────────────────────────────── */
.alert {
  padding: .85rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: .875rem;
  border-left: 4px solid;
}
.alert-danger  { background: #F5DADA; border-color: var(--color-danger);  color: #8A3535; }
.alert-success { background: #DAF0DB; border-color: var(--color-success); color: #315B3D; }
.alert-warning { background: #F3E8CC; border-color: var(--color-warning); color: #7A5520; }
.alert-info    { background: #EEF5EF; border-color: var(--color-info);    color: #3D5040; }
.alert ul { padding-left: 1.25rem; margin-top: .35rem; }

/* ── Bottom Navigation (mobile) ─────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottomnav-height);
  background: #fff;
  border-top: 1px solid var(--color-gray-200);
  display: flex;
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0,0,0,.06);
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--color-gray-400);
  font-size: .6rem;
  font-weight: 600;
  text-decoration: none;
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.bottom-nav-item:hover { text-decoration: none; color: var(--color-gray-600); }
.bottom-nav-item.active { color: var(--color-primary); }
.bottom-nav-item .icon { font-size: 1.25rem; }
.bottom-nav-badge {
  position: absolute;
  top: 4px; right: calc(50% - 18px);
  background: var(--color-danger);
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ── Appointment Cards (mobile list view) ───────────────────── */
.apt-card {
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-gray-200);
  padding: .875rem 1rem;
  margin-bottom: .5rem;
  display: flex;
  gap: .875rem;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.apt-card:hover { box-shadow: var(--shadow-md); }
.apt-time-col {
  min-width: 48px;
  text-align: center;
}
.apt-time {
  font-size: .95rem;
  font-weight: 800;
  color: var(--color-gray-900);
  line-height: 1.2;
}
.apt-duration {
  font-size: .7rem;
  color: var(--color-gray-400);
}
.apt-color-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  margin: .2rem auto 0;
}
.apt-info { flex: 1; min-width: 0; }
.apt-client-name {
  font-weight: 700;
  font-size: .9rem;
  color: var(--color-gray-900);
}
.apt-meta {
  font-size: .78rem;
  color: var(--color-gray-500);
  margin-top: .15rem;
}
.apt-actions {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-left: auto;
}

/* ── Availability Slot ──────────────────────────────────────── */
.avail-slot {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .75rem;
  border-radius: var(--radius-sm);
  background: #EDF7EE;
  border: 1.5px dashed var(--color-success);
  color: var(--color-success);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.avail-slot:hover {
  background: #D1FAE5;
  text-decoration: none;
}
.blocked-slot {
  background: var(--color-gray-100);
  border: 1.5px dashed var(--color-gray-300);
  color: var(--color-gray-400);
  cursor: not-allowed;
  font-size: .8rem;
  padding: .4rem .75rem;
  border-radius: var(--radius-sm);
}

/* ── Calendar Week ──────────────────────────────────────────── */
.calendar-week {
  display: grid;
  grid-template-columns: 50px repeat(7, 1fr);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #fff;
}
.cal-header-cell {
  padding: .6rem .3rem;
  text-align: center;
  font-size: .75rem;
  font-weight: 700;
  background: var(--color-gray-50);
  border-bottom: 2px solid var(--color-gray-200);
  border-right: 1px solid var(--color-gray-200);
  color: var(--color-gray-600);
}
.cal-header-cell.today {
  background: var(--color-primary-light);
  color: var(--color-primary);
}
.cal-header-cell .day-num {
  display: block;
  font-size: 1rem;
  font-weight: 800;
}
.cal-time-col {
  font-size: .7rem;
  color: var(--color-gray-400);
  text-align: right;
  padding: .2rem .4rem 0 0;
  border-right: 1px solid var(--color-gray-200);
  line-height: 1;
  padding-top: 4px;
}
.cal-cell {
  border-right: 1px solid var(--color-gray-100);
  border-bottom: 1px solid var(--color-gray-100);
  min-height: 50px;
  position: relative;
  padding: 2px;
}
.cal-cell.today-col { background: rgba(120, 185, 122, .05); }
.cal-event {
  position: absolute;
  left: 2px; right: 2px;
  border-radius: 4px;
  padding: 2px 4px;
  font-size: .7rem;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  cursor: pointer;
  z-index: 2;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-event.blocked {
  background: var(--color-gray-300) !important;
  color: var(--color-gray-600);
  cursor: default;
}

/* ── Pagination ─────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}
.page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  color: var(--color-gray-600);
  border: 1px solid var(--color-gray-200);
  background: #fff;
  text-decoration: none;
  transition: all var(--transition);
}
.page-link:hover { border-color: var(--color-primary); color: var(--color-primary); text-decoration: none; }
.page-link.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.page-link.disabled { opacity: .4; pointer-events: none; }
.page-info { font-size: .8rem; color: var(--color-gray-500); padding: 0 .5rem; }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 300;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all .2s ease;
}
.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}
.modal {
  background: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform .2s ease;
}
.modal-overlay.open .modal {
  transform: translateY(0);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--color-gray-200);
}
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--color-gray-400);
  padding: .25rem;
  border-radius: var(--radius-sm);
}
.modal-close:hover { color: var(--color-gray-700); background: var(--color-gray-100); }
.modal-body { padding: 1.25rem 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--color-gray-200);
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
}

/* ── Search Box ─────────────────────────────────────────────── */
.search-box {
  position: relative;
  flex: 1;
}
.search-box .search-icon {
  position: absolute;
  left: .7rem; top: 50%;
  transform: translateY(-50%);
  color: var(--color-gray-400);
  pointer-events: none;
}
.search-box .form-control { padding-left: 2.2rem; }

/* ── Autocomplete ───────────────────────────────────────────── */
.autocomplete-wrapper { position: relative; }
.autocomplete-dropdown {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 50;
  max-height: 220px;
  overflow-y: auto;
}
.autocomplete-item {
  padding: .55rem .85rem;
  cursor: pointer;
  font-size: .875rem;
  color: var(--color-gray-700);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.autocomplete-item:hover, .autocomplete-item.selected {
  background: var(--color-primary-light);
  color: var(--color-primary);
}
.autocomplete-empty {
  padding: .75rem;
  color: var(--color-gray-400);
  font-size: .8rem;
  text-align: center;
}

/* ── Color Swatch ───────────────────────────────────────────── */
.color-swatch {
  width: 20px; height: 20px;
  border-radius: 50%;
  display: inline-block;
  border: 2px solid rgba(0,0,0,.1);
  vertical-align: middle;
}

/* ── Date Navigation ────────────────────────────────────────── */
.date-nav {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1rem;
}
.date-nav .current-date {
  font-weight: 700;
  font-size: .9rem;
  flex: 1;
  text-align: center;
}
.date-nav-btn {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-gray-200);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--color-gray-600);
  text-decoration: none;
  transition: all var(--transition);
}
.date-nav-btn:hover { border-color: var(--color-primary); color: var(--color-primary); text-decoration: none; }

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-gray-400);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: .75rem; opacity: .5; }
.empty-state .empty-title { font-size: .95rem; font-weight: 600; color: var(--color-gray-600); }
.empty-state .empty-sub { font-size: .8rem; margin-top: .25rem; }

/* ── Filters Bar ────────────────────────────────────────────── */
.filters-bar {
  background: #fff;
  border-radius: var(--radius-md);
  padding: .875rem;
  margin-bottom: 1rem;
  border: 1px solid var(--color-gray-200);
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

/* ── Utilities ──────────────────────────────────────────────── */
.flex       { display: flex; }
.flex-col   { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .25rem; }
.gap-2 { gap: .5rem;  }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem;   }
.w-full { width: 100%; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem;  }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem;   }
.mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem;  }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem;   }
.p-0  { padding: 0; }
.hidden { display: none !important; }
.d-flex { display: flex; }

/* Loading spinner */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--color-gray-200);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════════════════════════
   TABLET & DESKTOP (≥768px)
   ════════════════════════════════════════════════════════════ */
@media (min-width: 768px) {

  .sidebar { display: flex; }

  .bottom-nav { display: none; }

  .main-content {
    margin-left: var(--sidebar-width);
    padding-bottom: 0;
  }

  .top-header { display: none; }

  .page-content { padding: 1.5rem 2rem; }

  .stats-grid { grid-template-columns: repeat(4, 1fr); gap: 1rem; }

  .stat-value { font-size: 2rem; }

  .form-row { grid-template-columns: repeat(2, 1fr); }
  .form-row.cols-3 { grid-template-columns: repeat(3, 1fr); }

  .flash-container {
    left: calc(var(--sidebar-width) + 1rem);
    right: 1rem;
    max-width: 480px;
    margin: 0 auto;
  }

  .modal { border-radius: var(--radius-lg); }
  .modal-overlay { align-items: center; }

  .table-mobile-card { display: table-row-group; }

  .page-header { flex-wrap: nowrap; }
  .page-title { font-size: 1.5rem; }
}

@media (min-width: 1024px) {
  .page-content { padding: 2rem 2.5rem; }
}

/* ── Auth Layout ────────────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #EEF3F6 0%, #F7FAF8 55%, #EDF7EE 100%);
  padding: 1rem;
}
.auth-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.auth-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}
.auth-logo .logo-icon {
  width: 60px; height: 60px;
  background: var(--color-primary);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem;
  margin: 0 auto .75rem;
  color: #fff;
}
.auth-logo-img {
  max-height: 64px;
  max-width: 200px;
  object-fit: contain;
  margin: 0 auto .75rem;
  display: block;
  border-radius: var(--radius-sm);
}
.auth-logo h1 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--color-gray-900);
}
.auth-logo p {
  font-size: .8rem;
  color: var(--color-gray-500);
  margin-top: .2rem;
}
