/* ═══════════════════════════════════════════════════
   Υποδιεύθυνση Τεχνικού — Stylesheet v3.0
   ═══════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
  --radius: 8px; --radius-lg: 12px; --radius-xl: 16px;
  --transition: 0.18s ease;
}

/* ── DARK THEME ────────────────────────────────── */
[data-theme="dark"] {
  --bg: #0d1117; --surface: #161b27; --surface2: #1c2235;
  --surface3: #222840; --border: #2a3354; --border2: #374270;
  --accent: #3d7fff; --accent-dim: #132052; --accent-h: #6699ff;
  --accent2: #00c896; --accent2-dim: #003d2a;
  --warn: #f59e0b; --warn-dim: #3d2800;
  --danger: #ef4444; --danger-dim: #3d0808;
  --purple: #8b5cf6; --purple-dim: #2d1a5e;
  --text: #e2e8f8; --text2: #8892b0; --text3: #4a5580;
  --shadow: 0 4px 20px rgba(0,0,0,0.5);
  --topbar-bg: #161b27; --sidebar-bg: #161b27; --input-bg: #1c2235;
}

/* ── LIGHT THEME ───────────────────────────────── */
[data-theme="light"] {
  --bg: #f0f4ff; --surface: #ffffff; --surface2: #f5f7ff;
  --surface3: #eef1fb; --border: #dde3f8; --border2: #c5cef0;
  --accent: #1a56db; --accent-dim: #dbeafe; --accent-h: #2563eb;
  --accent2: #059669; --accent2-dim: #d1fae5;
  --warn: #d97706; --warn-dim: #fef3c7;
  --danger: #dc2626; --danger-dim: #fee2e2;
  --purple: #7c3aed; --purple-dim: #ede9fe;
  --text: #1e2a4a; --text2: #4a5580; --text3: #9099c0;
  --shadow: 0 2px 12px rgba(30,42,74,0.08);
  --topbar-bg: #fff; --sidebar-bg: #fff; --input-bg: #f5f7ff;
}

/* ── RESET ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin:0; padding:0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans); font-size: 14px; line-height: 1.6;
  background: var(--bg); color: var(--text); min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── TOPBAR ─────────────────────────────────────  */
.topbar {
  height: 56px; background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 1.5rem; gap: 1rem;
  position: sticky; top: 0; z-index: 200;
  transition: background var(--transition);
}
.topbar-logo { font-size: 20px; }
.topbar-logo-img { width:36px; height:36px; object-fit:contain; border-radius:8px; background:#fff; padding:2px; }
.topbar-brand {
  font-family: var(--font-sans); font-size: 15px; font-weight: 700;
  color: var(--accent); text-decoration: none !important;
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
}
.topbar-sep { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.topbar-user-info { display: flex; flex-direction: column; }
.topbar-user-name { font-size: 13px; font-weight: 500; line-height: 1.3; }
.topbar-user-role { font-size: 11px; color: var(--text3); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; }

/* ── THEME TOGGLE ──────────────────────────────── */
.theme-toggle {
  width: 36px; height: 36px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface2);
  color: var(--text2); cursor: pointer; display: flex;
  align-items: center; justify-content: center; font-size: 16px;
  transition: all var(--transition);
}
.theme-toggle:hover { background: var(--surface3); color: var(--text); }
[data-theme="dark"]  .theme-icon-light { display:none; }
[data-theme="dark"]  .theme-icon-dark  { display:block; }
[data-theme="light"] .theme-icon-dark  { display:none; }
[data-theme="light"] .theme-icon-light { display:block; }

/* ── LAYOUT ─────────────────────────────────────  */
.app-wrap { display: flex; min-height: calc(100vh - 56px); }

.sidebar {
  width: 230px; background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0; flex-shrink: 0;
  transition: background var(--transition);
}
.sidebar-section { padding: 0 0.75rem; margin-bottom: 1.75rem; }
.sidebar-label {
  font-size: 10px; font-family: var(--font-mono);
  color: var(--text3); letter-spacing: 0.14em;
  text-transform: uppercase; padding: 0 0.5rem;
  margin-bottom: 6px; display: block;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius);
  color: var(--text2); font-size: 13px; font-weight: 400;
  text-decoration: none !important; transition: all var(--transition); margin-bottom: 2px;
}
.nav-item:hover { background: var(--surface3); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.nav-icon { font-size: 14px; width: 18px; text-align: center; }
.nav-count { margin-left: auto; font-family: var(--font-mono); font-size: 10px; background: var(--surface3); padding: 1px 7px; border-radius: 20px; color: var(--text3); }
.nav-item.active .nav-count { background: var(--accent); color: #fff; }

.content { flex: 1; padding: 2rem; overflow-y: auto; min-width: 0; }

/* ── PAGE HEADER ────────────────────────────────  */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1.75rem; gap: 1rem; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 700; }
.page-sub   { font-size: 13px; color: var(--text2); margin-top: 3px; }

/* ── STATS ──────────────────────────────────────  */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(140px,1fr)); gap: 12px; margin-bottom: 2rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem 1.5rem; transition: background var(--transition); }
.stat-label { font-size: 10px; font-family: var(--font-mono); color: var(--text3); text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 8px; }
.stat-value { font-size: 30px; font-weight: 700; font-family: var(--font-mono); line-height: 1; }
.stat-card.stat-open     .stat-value { color: var(--accent2); }
.stat-card.stat-assigned .stat-value { color: var(--accent); }
.stat-card.stat-closed   .stat-value { color: var(--text3); }
.stat-card.stat-total    .stat-value { color: var(--text); }
.stat-card.stat-high     .stat-value { color: var(--danger); }

/* ── CARD ───────────────────────────────────────  */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); transition: background var(--transition); }
.card-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.card-title { font-size: 14px; font-weight: 600; }
.card-body  { padding: 1.25rem; }

/* ── TABLE ──────────────────────────────────────  */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { padding: 10px 14px; text-align: left; font-size: 10px; font-family: var(--font-mono); color: var(--text3); letter-spacing: 0.12em; text-transform: uppercase; background: var(--surface2); border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
tbody tr:hover { background: var(--surface2); }
tbody tr:last-child { border-bottom: none; }
td { padding: 11px 14px; font-size: 13px; vertical-align: middle; }
.td-mono  { font-family: var(--font-mono); font-size: 12px; color: var(--text3); }
.td-title { font-weight: 500; }
.td-muted { font-size: 12px; color: var(--text2); }

/* ── TOOLBAR ────────────────────────────────────  */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--border); }

/* ── FORMS ──────────────────────────────────────  */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 11px; font-family: var(--font-mono); color: var(--text2); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr;     gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="search"], input[type="date"], select, textarea {
  width: 100%; background: var(--input-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 9px 12px;
  color: var(--text); font-family: var(--font-sans); font-size: 14px;
  outline: none; transition: border-color var(--transition), background var(--transition); -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
select option { background: var(--surface2); color: var(--text); }
textarea { resize: vertical; min-height: 100px; }
.input-sm   { padding: 7px 10px; font-size: 13px; }
.input-hint { font-size: 11px; color: var(--text3); margin-top: 4px; }

/* ── BUTTONS ────────────────────────────────────  */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border: none; border-radius: var(--radius); font-family: var(--font-sans); font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none !important; transition: all var(--transition); white-space: nowrap; line-height: 1; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); }
.btn-success { background: var(--accent2); color: #fff; font-weight: 600; }
.btn-success:hover { opacity: 0.88; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.88; }
.btn-warn    { background: var(--warn); color: #fff; font-weight: 600; }
.btn-warn:hover { opacity: 0.88; }
.btn-purple  { background: var(--purple); color: #fff; }
.btn-ghost   { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface3); color: var(--text); border-color: var(--border2); }
.btn-block   { width: 100%; justify-content: center; }

/* ── BADGES ─────────────────────────────────────  */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-family: var(--font-mono); font-weight: 500; letter-spacing: 0.04em; white-space: nowrap; }

[data-theme="dark"] .badge-open       { background: #003d2a; color: #00c896; }
[data-theme="dark"] .badge-assigned   { background: #132052; color: #3d7fff; }
[data-theme="dark"] .badge-inprogress { background: #3d2800; color: #f59e0b; }
[data-theme="dark"] .badge-closed     { background: var(--surface3); color: var(--text3); }
[data-theme="dark"] .badge-low        { background: #003d2a; color: #00c896; }
[data-theme="dark"] .badge-medium     { background: #3d2800; color: #f59e0b; }
[data-theme="dark"] .badge-high       { background: #3d0808; color: #ef4444; }
[data-theme="dark"] .badge-critical   { background: #5a0000; color: #ff8080; }
[data-theme="dark"] .badge-admin      { background: var(--accent-dim); color: var(--accent); }
[data-theme="dark"] .badge-clinic     { background: var(--purple-dim); color: var(--purple); }
[data-theme="dark"] .badge-technician { background: var(--accent2-dim); color: var(--accent2); }

[data-theme="light"] .badge-open       { background: #d1fae5; color: #065f46; }
[data-theme="light"] .badge-assigned   { background: #dbeafe; color: #1e40af; }
[data-theme="light"] .badge-inprogress { background: #fef3c7; color: #92400e; }
[data-theme="light"] .badge-closed     { background: #f1f5f9; color: #64748b; }
[data-theme="light"] .badge-low        { background: #d1fae5; color: #065f46; }
[data-theme="light"] .badge-medium     { background: #fef3c7; color: #92400e; }
[data-theme="light"] .badge-high       { background: #fee2e2; color: #991b1b; }
[data-theme="light"] .badge-critical   { background: #ffc9c9; color: #7f1d1d; }
[data-theme="light"] .badge-admin      { background: var(--accent-dim); color: #1e40af; }
[data-theme="light"] .badge-clinic     { background: var(--purple-dim); color: #5b21b6; }
[data-theme="light"] .badge-technician { background: var(--accent2-dim); color: #065f46; }

/* ── AVATAR ─────────────────────────────────────  */
.avatar { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; font-family: var(--font-mono); letter-spacing: 0.05em; flex-shrink: 0; }
.av-lg   { width: 48px; height: 48px; font-size: 16px; }
[data-theme="dark"] .av-admin   { background: var(--accent-dim); color: var(--accent); }
[data-theme="dark"] .av-clinic  { background: var(--purple-dim); color: var(--purple); }
[data-theme="dark"] .av-tech    { background: var(--accent2-dim); color: var(--accent2); }
[data-theme="light"] .av-admin  { background: #dbeafe; color: #1e40af; }
[data-theme="light"] .av-clinic { background: #ede9fe; color: #5b21b6; }
[data-theme="light"] .av-tech   { background: #d1fae5; color: #065f46; }

/* ── ALERTS ─────────────────────────────────────  */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 1.25rem; font-size: 13px; position: relative; }
.alert-success { background: var(--accent2-dim); color: var(--accent2); border: 1px solid var(--accent2); }
.alert-error   { background: var(--danger-dim);  color: var(--danger);  border: 1px solid var(--danger); }
.alert-info    { background: var(--accent-dim);  color: var(--accent);  border: 1px solid var(--accent); }
.alert-warn    { background: var(--warn-dim);    color: var(--warn);    border: 1px solid var(--warn); }
[data-theme="light"] .alert-success { background: #d1fae5; color: #065f46; border-color: #059669; }
[data-theme="light"] .alert-error   { background: #fee2e2; color: #991b1b; border-color: #dc2626; }
[data-theme="light"] .alert-info    { background: #dbeafe; color: #1e40af; border-color: #1a56db; }
.alert-close { margin-left: auto; background: none; border: none; cursor: pointer; font-size: 18px; line-height: 1; color: inherit; opacity: 0.6; }
.alert-close:hover { opacity: 1; }

/* ── MODAL ──────────────────────────────────────  */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.65); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 1rem; }
.modal-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; padding: 1.75rem; transition: background var(--transition); }
.modal-title { font-size: 17px; font-weight: 600; margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }

/* ── TICKET DETAIL ──────────────────────────────  */
.ticket-detail-header { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; margin-bottom: 1rem; }
.ticket-meta { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 0.75rem; font-size: 12px; color: var(--text2); font-family: var(--font-mono); }
.ticket-body { background: var(--surface2); border-left: 3px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0; padding: 1rem 1.25rem; margin-top: 1rem; font-size: 13px; line-height: 1.8; white-space: pre-wrap; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.detail-field { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.detail-field:last-child { border-bottom: none; }
.detail-field-label { color: var(--text2); font-size: 12px; }

/* ── COMMENTS ───────────────────────────────────  */
.comment { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: none; }
.comment-meta { font-size: 11px; color: var(--text3); font-family: var(--font-mono); margin-bottom: 4px; }
.comment-text { font-size: 13px; line-height: 1.6; }

/* ── PHOTO GRID ─────────────────────────────────  */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 12px; margin-top: 12px; }
.photo-item { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--surface2); aspect-ratio: 4/3; }
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: pointer; transition: opacity var(--transition); }
.photo-item img:hover { opacity: 0.85; }
.photo-item-meta { font-size: 10px; color: var(--text3); padding: 4px 8px; font-family: var(--font-mono); background: var(--surface2); }
.photo-gdrive { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,0.6); color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 10px; }

/* ── UPLOAD ZONE ────────────────────────────────  */
.upload-zone { border: 2px dashed var(--border2); border-radius: var(--radius-lg); padding: 2rem; text-align: center; cursor: pointer; transition: all var(--transition); }
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--accent); background: var(--accent-dim); }
.upload-zone input[type="file"] { display: none; }
.upload-zone-icon { font-size: 36px; margin-bottom: 8px; }
.upload-zone-text { font-size: 13px; color: var(--text2); }

/* ── USERS / CLINICS GRID ───────────────────────  */
.users-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(270px,1fr)); gap: 12px; }
.user-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; display: flex; align-items: center; gap: 14px; transition: border-color var(--transition); }
.user-card:hover { border-color: var(--border2); }
.user-card-info { flex: 1; min-width: 0; }
.user-card-name { font-weight: 600; font-size: 14px; }
.user-card-sub  { font-size: 12px; color: var(--text2); margin-top: 2px; }
.user-card-actions { display: flex; gap: 6px; }

/* ── ACTIVITY LOG ───────────────────────────────  */
.activity-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text2); }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; margin-top: 4px; }

/* ── AUTH PAGE ──────────────────────────────────  */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-left { background: linear-gradient(145deg, #0d1b5e 0%, #1a237e 50%, #0d47a1 100%); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 3rem; color: #fff; }
.auth-logo-big { font-size: 80px; margin-bottom: 1rem; }
.auth-logo-img { width:180px; max-width:72%; height:auto; object-fit:contain; margin-bottom:1rem; border-radius:18px; background:#fff; padding:10px; box-shadow: var(--shadow-lg); }
.auth-brand-logo { width:24px; height:24px; object-fit:contain; vertical-align:middle; margin-right:6px; border-radius:5px; background:#fff; }
.auth-app-name { font-size: 26px; font-weight: 700; text-align: center; margin-bottom: 1rem; }
.auth-app-desc { font-size: 14px; opacity: 0.75; text-align: center; max-width: 320px; line-height: 1.7; }
.auth-badges { display: flex; gap: 10px; margin-top: 2rem; flex-wrap: wrap; justify-content: center; }
.auth-badge { background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.25); border-radius: 20px; padding: 5px 14px; font-size: 12px; }
.auth-right { background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 3rem; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 2.5rem 2.25rem; width: 100%; max-width: 400px; }
.auth-brand { font-size: 12px; color: var(--accent); letter-spacing: 0.15em; text-transform: uppercase; margin-bottom: 6px; font-family: var(--font-mono); }
.auth-title { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.auth-sub   { font-size: 13px; color: var(--text2); margin-bottom: 2rem; }

@media (max-width: 768px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-left { display: none; }
}

/* ── REPORT ─────────────────────────────────────  */
.report-filter-bar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1.5rem; display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }

/* ── SETTINGS GRID ──────────────────────────────  */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }

/* ── TOAST ──────────────────────────────────────  */
#toast-wrap { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--surface2); border: 1px solid var(--border2); border-radius: var(--radius); padding: 11px 16px; font-size: 13px; max-width: 320px; animation: toastIn 0.22s ease; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow); }
.toast-success { border-left: 3px solid var(--accent2); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-info    { border-left: 3px solid var(--accent); }
@keyframes toastIn { from { transform: translateX(20px); opacity:0; } to { transform: translateX(0); opacity:1; } }

/* ── MISC ───────────────────────────────────────  */
.empty-state { text-align: center; padding: 3rem; color: var(--text3); }
.empty-icon  { font-size: 36px; margin-bottom: 1rem; }
.divider     { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.section-title { font-size: 11px; font-family: var(--font-mono); color: var(--text3); text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 0.75rem; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text2); font-size: 13px; margin-bottom: 1rem; text-decoration: none !important; }
.back-link:hover { color: var(--text); }
code { font-family: var(--font-mono); font-size: 12px; background: var(--surface3); padding: 2px 6px; border-radius: 4px; color: var(--accent); }

/* ── IMAGE LIGHTBOX ─────────────────────────────  */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 9000; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.lightbox img { max-width: 90vw; max-height: 90vh; border-radius: var(--radius); box-shadow: 0 8px 40px rgba(0,0,0,0.8); }

/* ── PRINT ──────────────────────────────────────  */
@media print { .sidebar,.topbar,.btn,.toolbar,.report-filter-bar { display:none !important; } .content { padding: 0; } }

/* ── RESPONSIVE ─────────────────────────────────  */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .content { padding: 1rem; }
  .detail-grid,.form-row,.form-row-3,.settings-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ── MOBILE SIDEBAR / PWA FRIENDLY NAV ─────────── */
.mobile-menu-btn,
.mobile-menu-close,
.mobile-sidebar-title,
.mobile-sidebar-backdrop { display: none; }

@media (max-width: 768px) {
  .topbar { gap: 8px; }
  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface2);
    color: var(--text);
    font-size: 22px;
    cursor: pointer;
    flex-shrink: 0;
  }
  .topbar-brand span { max-width: 145px; overflow: hidden; text-overflow: ellipsis; }
  .topbar-user-info { display: none; }
  .topbar-user .btn { padding: 7px 9px; }

  .mobile-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 56px 0 0 0;
    background: rgba(0,0,0,0.45);
    z-index: 799;
  }
  body.sidebar-open .mobile-sidebar-backdrop { display: block; }

  .mobile-sidebar-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem 1rem;
    margin-bottom: 0.5rem;
    color: var(--text);
    font-weight: 700;
  }
  .mobile-menu-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface2);
    color: var(--text);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
  }

  .sidebar {
    display: block !important;
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: min(86vw, 310px);
    z-index: 800;
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform 0.22s ease, background var(--transition);
    box-shadow: 8px 0 28px rgba(0,0,0,0.28);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open { overflow: hidden; }
}

/* ── MOBILE FIXES + INSTALL PROMPT ────────────── */
@media (max-width: 768px) {
  .topbar { position: sticky; top: 0; z-index: 1200; padding: 0 0.75rem; }
  .mobile-menu-btn { position: relative; z-index: 1300; touch-action: manipulation; }
  .mobile-sidebar-backdrop { z-index: 1190; }
  .sidebar { z-index: 1210; padding-top: 1rem; will-change: transform; }
  body.sidebar-open .sidebar { transform: translate3d(0,0,0); }
}
.install-prompt-box {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 10000;
  max-width: 460px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 14px 40px rgba(0,0,0,0.28);
  border-radius: 16px;
  padding: 16px;
  color: var(--text);
}
.install-prompt-title { font-weight: 700; font-size: 16px; margin-bottom: 4px; padding-right: 28px; }
.install-prompt-text { color: var(--text2); font-size: 13px; margin-bottom: 12px; }
.install-prompt-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: 0;
  background: transparent;
  color: var(--text2);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.install-prompt-ios {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  font-size: 13px;
  color: var(--text2);
}


/* ── MOBILE SIDEBAR CLICK FIX v5 ───────────────── */
@media (max-width: 768px) {
  .mobile-sidebar-backdrop {
    top: 56px;
    z-index: 1200 !important;
    pointer-events: auto;
  }
  .sidebar {
    z-index: 1250 !important;
    pointer-events: auto !important;
    visibility: hidden;
  }
  body.sidebar-open .sidebar {
    visibility: visible;
  }
  .sidebar .nav-item,
  .sidebar a,
  .sidebar button {
    position: relative;
    z-index: 1260;
    pointer-events: auto !important;
    touch-action: manipulation;
  }
  .topbar { z-index: 1300 !important; }
  .mobile-menu-btn { z-index: 1310 !important; }
}
.install-prompt-action { margin-top: 12px; }


/* ── APP FOOTER ─────────────────────────────── */
.app-footer {
  margin-top: 2rem;
  padding: 1.25rem 0 0.25rem;
  border-top: 1px solid var(--border);
  color: var(--text2);
  font-size: 13px;
}
.app-footer-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.app-footer-copy { color: var(--text2); }
.app-footer-links {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.app-footer a {
  color: var(--text2);
  text-decoration: none;
}
.app-footer a:hover { color: var(--accent); }
.app-footer-powered {
  margin-top: 0.85rem;
  text-align: center;
  font-size: 12px;
  color: var(--text3);
}
.app-footer-powered a { font-weight: 700; color: var(--accent); }
@media (max-width: 768px) {
  .app-footer { margin-top: 1.25rem; padding-bottom: 1rem; }
  .app-footer-main { justify-content: center; text-align: center; }
  .app-footer-copy, .app-footer-links { width: 100%; justify-content: center; }
}
@media print { .app-footer { display:none !important; } }
