/* =========================================================================
   Ingenieurbüro Hombruch — Dashboard UI · v3
   Aligned with marketing site (ingenieurbuero-hombruch.de):
   - Warm Paper / Anthracite / Refined Signal Red
   - Schibsted Grotesk · Hanken Grotesk · IBM Plex Mono
   - Editorial-Engineering Aesthetic (Apple/Linear/Stripe vibe + serious authority)
   TÜV-Blau bleibt erhalten — aber nur als semantische Farbe für HU/AU-Events.
   ALLE bestehenden Klassennamen bleiben kompatibel (PHP/JS unverändert).
   ========================================================================= */

/* ---------- Tokens ------------------------------------------------------- */
:root{
  /* Surfaces — warm, never pure white */
  --bg:           #f7f6f3;
  --bg-elev:      #ffffff;
  --bg-inset:     #f1efe9;
  --surface:      #ffffff;
  --surface-2:    #fbfaf8;

  /* Hairlines */
  --border:       #e8e5df;
  --border-strong:#dbd7cf;
  --border-dark:  #2c2f36;

  /* Ink / anthracite scale */
  --text:         #15171b;
  --text-2:       #1d2025;
  --text-3:       #2a2e35;
  --text-muted:   #565c66;
  --text-soft:    #878d97;

  /* Accent — refined signal red (matches site) */
  --accent:       #c8312a;
  --accent-ink:   #a51a13;
  --accent-soft:  #fbe9e7;
  --accent-glow:  rgba(200,49,42,.18);

  /* Brand = accent (primary CTAs, active sidebar state) */
  --brand:        var(--accent);
  --brand-500:    var(--accent);
  --brand-600:    var(--accent-ink);
  --brand-100:    var(--accent-soft);
  --brand-50:     #fdf4f3;

  /* Steel scale — cool secondary (charts, neutral chips) */
  --steel-50:     #eef2f7;
  --steel-100:    #dbe2ea;
  --steel-500:    #5d6a7d;
  --steel-700:    #2f3947;
  --steel-900:    #1a2230;

  /* Semantic */
  --ok:           #16a34a;
  --warn:         #f59e0b;
  --danger:       #dc2626;
  --info:         var(--steel-500);

  /* Event categories (Kalender) */
  --hu:           #1864c7;   /* TÜV-Blau für HU/AU bewahrt */
  --hu-soft:      #e3edfa;
  --nach:         #f59e0b;
  --sonst:        #6366f1;

  /* Radii */
  --radius-sm:    8px;
  --radius:       14px;
  --radius-lg:    20px;
  --radius-card:  18px;

  /* Shadows — soft, layered, premium */
  --shadow-sm:    0 1px 2px rgba(20,22,26,.04), 0 1px 3px rgba(20,22,26,.06);
  --shadow:       0 1px 2px rgba(20,22,26,.04), 0 10px 28px -14px rgba(20,22,26,.16);
  --shadow-lg:    0 2px 4px rgba(20,22,26,.05), 0 28px 56px -24px rgba(20,22,26,.28);
  --shadow-accent:0 10px 30px -12px rgba(200,49,42,.45);
  --shadow-hairline: inset 0 0 0 1px rgba(20,22,26,.05);

  /* Layout */
  --sidebar-w:    248px;
  --topbar-h:     64px;

  /* Easing */
  --ease-out:     cubic-bezier(.16,1,.3,1);

  /* Typography */
  --ff: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fd: "Schibsted Grotesk", "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --fm: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

[data-theme="dark"]{
  --bg:           #0e1014;
  --bg-elev:      #15171b;
  --bg-inset:     #1a1d23;
  --surface:      #15171b;
  --surface-2:    #1d2025;

  --border:       #2c2f36;
  --border-strong:#3a3e47;

  --text:         #ececea;
  --text-2:       #d6d6d3;
  --text-3:       #b8b8b5;
  --text-muted:   #8a8f98;
  --text-soft:    #6a6f78;

  --accent:       #dc4940;
  --accent-ink:   #b22018;
  --accent-soft:  #2a1413;
  --accent-glow:  rgba(220,73,64,.22);

  --brand:        var(--accent);
  --brand-500:    var(--accent);
  --brand-600:    var(--accent-ink);
  --brand-100:    #3a1916;
  --brand-50:     #2a1413;

  --steel-50:     #1a2230;
  --steel-100:    #243049;
  --steel-500:    #6f7d92;

  --hu:           #4c8bf0;
  --hu-soft:      #1c2a55;
  --nach:         #fbbf24;
  --sonst:        #818cf8;

  --shadow-sm:    0 1px 2px rgba(0,0,0,.5);
  --shadow:       0 2px 6px rgba(0,0,0,.55);
  --shadow-lg:    0 16px 40px -10px rgba(0,0,0,.65);
  --shadow-hairline: inset 0 0 0 1px rgba(255,255,255,.04);
}

/* ---------- Base --------------------------------------------------------- */
*{ box-sizing: border-box; }
html, body{ height: 100%; }
html{ scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body{
  margin: 0;
  font-family: var(--ff);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}
::selection{ background: var(--accent); color: #fff; }

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

h1, h2, h3, h4{
  font-family: var(--fd);
  font-weight: 700;
  letter-spacing: -.022em;
  color: var(--text);
  margin: 0 0 12px;
  text-wrap: balance;
}
h1{ font-size: 26px; letter-spacing: -.028em; }
h2{ font-size: 19px; }
h3{ font-size: 15px; }

p{ text-wrap: pretty; }
code, kbd{ font-family: var(--fm); font-size: 12px; }
kbd{ background: var(--bg-inset); border:1px solid var(--border); padding: 2px 6px; border-radius: 6px; color: var(--text-muted); }
hr{ border:0; border-top: 1px solid var(--border); margin: 16px 0; }

:focus-visible{ outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* Mono eyebrow — kleine technische Labels */
.eyebrow, .card-sub, .stat-label{
  font-family: var(--fm);
  letter-spacing: .14em;
  text-transform: uppercase;
}

/* Tabular numerals */
.tnum, .list-time, .stat-value, .table-num,
.cash-summary, .pdf-sum-grid .val{
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* ---------- Buttons ------------------------------------------------------ */
.btn{
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  font-family: var(--ff);
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer;
  background: var(--bg-elev);
  color: var(--text);
  transition: background .25s var(--ease-out), border-color .25s var(--ease-out),
              color .25s var(--ease-out), transform .15s var(--ease-out), box-shadow .25s var(--ease-out);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover{ background: var(--bg-inset); color: var(--text); text-decoration: none; }
.btn:active{ transform: translateY(1px); }
.btn-sm{ padding: 7px 12px; font-size: 12.5px; }
.btn-primary{
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover{
  background: var(--accent-ink); border-color: var(--accent-ink);
  color: #fff; transform: translateY(-1px);
}
.btn-ghost{ background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover{ background: var(--bg-inset); border-color: var(--text); }
.btn-danger{
  background: var(--danger); color: #fff; border-color: var(--danger);
}
.btn-danger:hover{ background: #b51d1d; border-color: #b51d1d; color: #fff; }
.btn-block{ width: 100%; }

.icon-btn{
  display:inline-flex; align-items:center; justify-content:center;
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .2s var(--ease-out);
}
.icon-btn:hover{ color: var(--text); background: var(--bg-inset); border-color: var(--border-strong); }
.icon-btn.icon-danger { color: var(--danger); border-color: var(--border); padding: 6px; }
.icon-btn.icon-danger:hover {
  background: var(--accent-soft); color: var(--danger); border-color: var(--accent);
}

/* ---------- Inputs ------------------------------------------------------- */
.input, select, textarea{
  width: 100%;
  padding: 11px 13px;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-family: var(--ff);
  outline: none;
  transition: border-color .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.input:focus, select:focus, textarea:focus{
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.field{ display:block; margin-bottom: 14px; }
.field-label{
  display:block; font-size: 11.5px; color: var(--text-muted);
  margin-bottom: 7px; font-weight: 600;
  font-family: var(--fm); letter-spacing: .12em; text-transform: uppercase;
}
.field-hint{ font-size: 11.5px; color: var(--text-muted); margin-top: 5px; }
.field-auto{ color: var(--accent); font-weight: 600; }

/* ---------- Auth (Login) ------------------------------------------------- */
.auth-body{
  background: var(--bg);
  min-height: 100vh; margin: 0;
}
.auth-shell{
  min-height: 100vh;
  display: grid; grid-template-columns: minmax(360px,520px) 1fr;
  align-items: stretch;
}
.auth-card{
  background: var(--bg);
  padding: 56px;
  display: flex; flex-direction: column; justify-content: center;
}
.auth-aside{
  position: relative; overflow: hidden;
  background: var(--text);
  color: #fff;
  padding: 56px;
  display: flex; flex-direction: column; justify-content: center;
}
/* Blueprint grid + halo (matches site dark hero) */
.auth-aside::before{
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: .7;
}
.auth-aside::after{
  content: "";
  position: absolute; inset: -10%;
  pointer-events: none;
  background:
    radial-gradient(closest-side at 12% 0%,  rgba(200,49,42,.20), transparent 60%),
    radial-gradient(closest-side at 100% 100%, rgba(47,57,71,.55), transparent 70%);
  filter: blur(20px);
}
.aside-shape{ display: none; }
.aside-content{ position: relative; max-width: 480px; z-index: 1; }
.aside-content h2{
  font-family: var(--fd);
  color:#fff; font-size: 36px; line-height: 1.1;
  letter-spacing: -.028em; margin: 18px 0 14px;
  font-weight: 700;
}
.aside-content p{ color: rgba(255,255,255,.7); font-size: 16px; line-height: 1.55; }
.aside-points{ margin: 22px 0 0; padding: 0; list-style: none; }
.aside-points li{
  padding: 10px 0; border-top: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.85);
}
.aside-points li:first-child{ border-top: 0; }

.badge{
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  padding: 5px 12px; border-radius: 999px;
  font-family: var(--fm); font-size: 11px;
  letter-spacing: .14em; text-transform: uppercase;
  color: rgba(255,255,255,.8);
}

.auth-brand{ display:flex; align-items: center; gap: 14px; margin-bottom: 40px; }
.brand-mark{
  position: relative;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--text);
  color: #fff;
  font-family: var(--fm);
  font-weight: 700; font-size: 14px;
  display: grid; place-items: center;
  letter-spacing: -.01em;
}
.brand-mark::after{
  content: "";
  position: absolute;
  bottom: 8px; left: 50%;
  transform: translateX(-50%);
  width: 18px; height: 2px;
  background: var(--accent);
  border-radius: 2px;
}
.brand-title{
  font-family: var(--fd); font-weight: 700; font-size: 15px;
  letter-spacing: -.01em;
}
.brand-sub{
  font-family: var(--fm); font-size: 10.5px;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--text-muted); margin-top: 2px;
}
.auth-h1{
  font-family: var(--fd);
  font-size: 32px; margin-bottom: 8px;
  letter-spacing: -.028em; font-weight: 700;
}
.auth-lead{
  color: var(--text-muted); margin: 0 0 26px;
  font-size: 15.5px;
}
.auth-form .btn{ margin-top: 8px; }
.auth-meta{
  margin-top: 28px; display: flex; justify-content: space-between; gap: 12px;
  font-size: 11.5px; color: var(--text-soft);
}

.alert{
  padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13.5px;
  margin: 0 0 14px; border: 1px solid;
}
.alert-error{ background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-info{  background: var(--brand-50); color: var(--accent-ink); border-color: var(--accent-soft); }
.alert-warn{  background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert-ok{    background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
[data-theme="dark"] .alert-error{ background:#3a1414; color:#fecaca; border-color:#5b1f1f; }
[data-theme="dark"] .alert-info{  background:#2a1413; color:#fde2df; border-color:#4a2622; }
[data-theme="dark"] .alert-warn{  background:#3a2a10; color:#fde68a; border-color:#5a4017; }
[data-theme="dark"] .alert-ok{    background:#10331f; color:#bbf7d0; border-color:#1f5a35; }

/* ---------- App shell ---------------------------------------------------- */
.app-shell{
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
}
.app-main{ display: flex; flex-direction: column; min-width: 0; }
.app-content{ padding: 28px 36px 64px; max-width: 1480px; width: 100%; }

/* ---------- Sidebar ------------------------------------------------------ */
.sidebar{
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  padding: 22px 14px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand{
  display: flex; align-items: center; gap: 12px;
  padding: 4px 6px 22px;
}
.sidebar .brand-mark{ width: 38px; height: 38px; border-radius: 10px; }
.sidebar .brand-mark::after{ bottom: 6px; width: 14px; }
.sidebar-brand .brand-text .brand-title{ font-size: 14px; line-height: 1.1; }
.sidebar-brand .brand-text .brand-sub{ font-size: 9.5px; }

.sidebar-nav{
  display: flex; flex-direction: column; gap: 2px; margin-top: 8px;
}
.nav-item{
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-muted);
  font-weight: 500; font-size: 13.5px;
  text-decoration: none;
  transition: color .2s var(--ease-out), background .2s var(--ease-out);
}
.nav-item:hover{
  background: var(--bg-inset); color: var(--text); text-decoration: none;
}
.nav-item.is-active{
  background: var(--accent-soft); color: var(--accent-ink);
  font-weight: 600;
}
.nav-item.is-active::before{
  content: "";
  position: absolute; left: -2px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 3px;
  background: var(--accent);
}
[data-theme="dark"] .nav-item.is-active{
  background: var(--accent-soft); color: #fde2df;
}
.nav-item svg{ flex-shrink: 0; }
.nav-badge{
  margin-left: auto;
  min-width: 18px; padding: 2px 6px;
  border-radius: 999px;
  background: var(--accent); color: #fff;
  font-size: 10.5px; font-weight: 700; line-height: 1.4;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.sidebar-footer{
  margin-top: auto;
  padding: 12px;
  display: flex; align-items: center; gap: 12px;
  border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-muted);
}
.status-dot{
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(22,163,74,.18);
}
.sidebar-foot-text{ display: flex; flex-direction: column; line-height: 1.25; }
.sidebar-foot-text strong{ color: var(--text); font-weight: 600; }

/* ---------- Topbar ------------------------------------------------------- */
.topbar{
  display: flex; align-items: center; gap: 14px;
  height: var(--topbar-h);
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
  position: sticky; top: 0; z-index: 30;
}
.topbar-burger{ display: none; }
.topbar-search{
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-inset);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 14px;
  height: 40px;
  flex: 1; max-width: 500px;
  color: var(--text-muted);
  transition: all .2s var(--ease-out);
}
.topbar-search:focus-within{
  background: var(--bg-elev); border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.topbar-search input{
  flex: 1; background: transparent; border: 0; outline: none;
  color: var(--text); font: inherit; font-family: var(--ff);
}
.topbar-search input::placeholder{ color: var(--text-soft); }
.topbar-actions{ margin-left: auto; display: flex; align-items: center; gap: 10px; }
.quick-actions{ display: flex; gap: 6px; }

.profile{ position: relative; }
.profile-btn{
  display: flex; align-items: center; gap: 9px;
  background: transparent; border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 12px 4px 4px;
  cursor: pointer; color: var(--text);
  transition: all .2s var(--ease-out);
}
.profile-btn:hover{ background: var(--bg-inset); border-color: var(--border-strong); }
.avatar{
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--text); color: #fff;
  font-family: var(--fm); font-weight: 700; font-size: 12px;
}
.profile-name{ font-size: 13px; font-weight: 600; }
.profile-pop{
  display: none;
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 250px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 50;
}
.profile.is-open .profile-pop{ display: block; }
.profile-pop a{
  display: block; padding: 9px 12px; border-radius: 8px;
  color: var(--text); font-size: 13px;
  transition: background .15s;
}
.profile-pop a:hover{ background: var(--bg-inset); text-decoration: none; color: var(--text); }
.profile-pop a.danger{ color: var(--danger); }
.profile-info{
  padding: 11px 12px 7px; display: flex; flex-direction: column;
  border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.profile-info strong{ font-size: 13.5px; font-weight: 600; }
.profile-info span{ font-size: 11.5px; color: var(--text-muted); }

/* "Zur Website" Link in Topbar */
.topbar-back-site{
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  transition: all .2s var(--ease-out);
}
.topbar-back-site:hover{
  color: var(--accent); border-color: var(--accent);
  background: var(--bg-elev); text-decoration: none;
}

/* ---------- Cards & layout ---------------------------------------------- */
.page-header{
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 24px;
}
.page-title{
  font-family: var(--fd);
  font-size: 28px; letter-spacing: -.028em; margin: 0;
  font-weight: 700;
}
.page-sub{
  color: var(--text-muted); margin: 6px 0 0;
  font-size: 14px;
}

.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  padding: 22px;
}
.card-head{
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.card-title{
  font-family: var(--fd);
  font-size: 15px; font-weight: 700; color: var(--text);
  letter-spacing: -.015em;
}
.card-sub{
  font-size: 10.5px; color: var(--text-muted);
  letter-spacing: .14em;
}

.grid{ display: grid; gap: 18px; }
.grid-stats{ grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-2{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3{ grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Stat cards */
.stat{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: all .25s var(--ease-out);
}
.stat .stat-label{
  font-family: var(--fm);
  font-size: 10.5px;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 500;
  display: flex; align-items: center; gap: 10px;
}
.stat .stat-value{
  font-family: var(--fd);
  font-size: 32px; font-weight: 700;
  margin-top: 10px; letter-spacing: -.022em;
  line-height: 1.05;
}
.stat .stat-trend{
  font-size: 12.5px; margin-top: 8px; color: var(--text-muted);
}
.stat .stat-icon{
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--brand-50); color: var(--accent);
}
[data-theme="dark"] .stat .stat-icon{ background: var(--brand-100); color: var(--accent); }

.stat-warning{
  border-color: #fde68a;
  background: linear-gradient(0deg, #fffbeb, var(--surface));
}
.stat-warning .stat-icon{ background:#fef3c7; color:#a16207; }
.stat-danger{
  border-color: var(--accent-soft);
  background: linear-gradient(0deg, var(--brand-50), var(--surface));
}
.stat-danger .stat-icon{ background: var(--accent-soft); color: var(--accent); }
.stat-ok{
  border-color:#bbf7d0;
  background: linear-gradient(0deg, #f0fdf4, var(--surface));
}
.stat-ok .stat-icon{ background:#dcfce7; color:#15803d; }
[data-theme="dark"] .stat-warning,
[data-theme="dark"] .stat-danger,
[data-theme="dark"] .stat-ok{ background: var(--surface); }

.stat.is-link{
  text-decoration: none; color: inherit;
  cursor: pointer; display: block;
}
.stat.is-link:hover{
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
.stat.is-link:focus-visible{
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ---------- Pills / tags ------------------------------------------------- */
.pill{
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--fm);
  font-size: 10.5px; font-weight: 500;
  letter-spacing: .08em;
  padding: 4px 10px; border-radius: 999px;
  background: var(--bg-inset); color: var(--text-muted);
  border: 1px solid var(--border);
  text-transform: uppercase;
}
.pill .dot{ width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-hu{
  color: var(--hu);
  background: rgba(24,100,199,.10);
  border-color: rgba(24,100,199,.18);
}
.pill-nach{
  color: #b45309;
  background: rgba(245,158,11,.12);
  border-color: rgba(245,158,11,.25);
}
.pill-sonst{
  color: #4f46e5;
  background: rgba(99,102,241,.10);
  border-color: rgba(99,102,241,.22);
}
.pill-ok{      color:#15803d; background:#dcfce7; border-color:#bbf7d0; }
.pill-warn{    color:#92400e; background:#fef3c7; border-color:#fde68a; }
.pill-danger{  color: var(--accent-ink); background: var(--accent-soft); border-color: var(--accent); }
.pill-info{    color: var(--steel-700); background: var(--steel-50); border-color: var(--steel-100); }
.pill.pill-ok       { background: rgba(22,163,74,.12);  color: var(--ok); }
.pill.pill-warn     { background: rgba(245,158,11,.12); color: var(--warn); }
.pill.pill-info     { background: var(--steel-50);  color: var(--steel-700); }
.pill.pill-danger   { background: var(--accent-soft); color: var(--accent-ink); }

.pill-vehicle-pkw       { background: rgba(24,100,199,.10); color: var(--hu); }
.pill-vehicle-anhaenger { background: rgba(245,158,11,.12); color: var(--warn); }
.pill-vehicle-motorrad  { background: rgba(99,102,241,.12); color: #6366f1; }
.pill-vehicle-sonstiges { background: var(--steel-50); color: var(--text-muted); }

/* Priority pills (use semantic colors, no token rename) */
.prio-niedrig{  color: var(--steel-700); background: var(--steel-50); }
.prio-mittel{   color: var(--hu);        background: var(--hu-soft); }
.prio-hoch{     color:#b45309;           background:#fef3c7; }
.prio-dringend{ color: var(--accent-ink); background: var(--accent-soft); }

/* ---------- Tables ------------------------------------------------------- */
.table{ width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th, .table td{
  text-align: left; padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.table thead th{
  font-family: var(--fm);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em;
  color: var(--text-muted); background: var(--bg-inset);
  font-weight: 500;
}
.table tbody tr{ transition: background .15s; }
.table tbody tr:hover{ background: var(--bg-inset); }
.table-num{ text-align: right; }

/* ---------- List rows ---------------------------------------------------- */
.list{ display: flex; flex-direction: column; }
.list-row{
  display: flex; align-items: center; gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.list-row:first-child{ border-top: 0; }
.list-time{
  font-family: var(--fm);
  font-weight: 600; color: var(--text);
  min-width: 56px;
}
.list-title{ font-weight: 600; }
.list-sub{ color: var(--text-muted); font-size: 12.5px; }
.list-right{ margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ---------- Modals ------------------------------------------------------- */
.modal-backdrop{
  position: fixed; inset: 0;
  background: rgba(20,22,26,.55);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100; padding: 16px;
}
.modal-backdrop.is-open{ display: flex; }
.modal{
  width: 100%; max-width: 580px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalIn .25s var(--ease-out);
}
@keyframes modalIn{
  from{ transform: translateY(12px) scale(.98); opacity: 0; }
  to  { transform: none; opacity: 1; }
}
.modal-head{
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h2, .modal-head h3{ margin: 0; font-family: var(--fd); }
.modal-body{ padding: 20px 22px; max-height: 72vh; overflow: auto; }
.modal-foot{
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
  background: var(--bg-inset);
}
.modal.modal-sm{ max-width: 480px; }
.del-info{
  background: var(--bg-inset); border-radius: 10px;
  padding: 14px; margin-top: 10px; font-size: 14px;
  border: 1px solid var(--border);
}

/* ---------- Calendar ---------------------------------------------------- */
.cal-toolbar{
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.cal-views{
  display: flex; gap: 4px;
  background: var(--bg-inset); padding: 4px;
  border-radius: 10px; border: 1px solid var(--border);
}
.cal-views button{
  background: transparent; border: 0; padding: 7px 14px;
  border-radius: 7px; color: var(--text-muted);
  font-weight: 600; cursor: pointer; font-size: 13px;
  font-family: var(--ff);
  transition: all .2s var(--ease-out);
}
.cal-views button.is-active{
  background: var(--bg-elev); color: var(--text);
  box-shadow: var(--shadow-sm);
}
.cal-nav{ display: flex; align-items: center; gap: 4px; }
.cal-title{
  font-family: var(--fd);
  font-weight: 700; font-size: 17px;
  min-width: 220px; text-align: center;
  letter-spacing: -.015em;
}
.cal-legend{
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-left: auto; font-size: 12px; color: var(--text-muted);
}
.cal-legend span{ display: inline-flex; align-items: center; gap: 7px; }
.cal-legend i{
  width: 10px; height: 10px; border-radius: 3px;
  display: inline-block;
}

/* Month view */
.cal-month{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.cal-month-head{
  display: grid; grid-template-columns: repeat(7, 1fr);
  background: var(--bg-inset);
  border-bottom: 1px solid var(--border);
  font-family: var(--fm);
  font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .14em; color: var(--text-muted);
  font-weight: 500;
}
.cal-month-head > div{ padding: 10px 12px; border-right: 1px solid var(--border); }
.cal-month-head > div:last-child{ border-right: 0; }
.cal-month-grid{ display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-day{
  min-height: 116px;
  padding: 7px 9px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: relative;
}
.cal-day:nth-child(7n){ border-right: 0; }
.cal-day.is-other{ background: var(--bg-inset); color: var(--text-soft); }
.cal-day .d-num{
  font-family: var(--fm);
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
}
.cal-day.is-today .d-num{
  display: inline-flex; width: 24px; height: 24px;
  align-items: center; justify-content: center;
  background: var(--accent); color: #fff;
  border-radius: 50%;
}
.cal-event{
  display: block;
  margin-top: 4px; padding: 4px 7px;
  border-radius: 6px;
  font-size: 11.5px; font-weight: 600;
  background: rgba(24,100,199,.10); color: var(--hu);
  border-left: 3px solid var(--hu);
  cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: filter .15s;
}
.cal-event.ev-nach{
  background: rgba(245,158,11,.14); color: #b45309;
  border-left-color: var(--nach);
}
.cal-event.ev-sonst{
  background: rgba(99,102,241,.12); color: #4f46e5;
  border-left-color: var(--sonst);
}
.cal-event:hover{ filter: brightness(.95); }

/* Week / day view */
.cal-week{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.cal-week-head{
  display: grid; grid-template-columns: 60px repeat(7, 1fr);
  background: var(--bg-inset);
  border-bottom: 1px solid var(--border);
}
.cal-week-head > div{
  padding: 10px; font-size: 12px;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
  text-align: center;
}
.cal-week-head .is-today{
  color: var(--accent); font-weight: 700;
}
.cal-week-body{
  display: grid; grid-template-columns: 60px repeat(7, 1fr);
  position: relative; max-height: 72vh; overflow: auto;
}
.cal-hours{ display: flex; flex-direction: column; }
.cal-hour-label{
  height: 50px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  font-family: var(--fm);
  font-size: 10.5px; color: var(--text-soft);
  padding: 3px 7px;
}
.cal-col{
  position: relative;
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.cal-col:last-child{ border-right: 0; }
.cal-col .hour{ height: 50px; border-bottom: 1px solid var(--border); }
.cal-col-today{ background: var(--brand-50); }

.cal-block{
  position: absolute; left: 4px; right: 4px;
  background: rgba(24,100,199,.10);
  border-left: 3px solid var(--hu);
  color: var(--hu);
  border-radius: 6px;
  padding: 5px 7px;
  font-size: 12px; font-weight: 600;
  cursor: pointer; overflow: hidden;
}
.cal-block .bl-time{
  font-family: var(--fm);
  font-size: 10.5px; font-weight: 700;
}
.cal-block .bl-title{ font-weight: 600; }
.cal-block .bl-status{
  font-family: var(--fm);
  font-size: 9.5px; font-weight: 600; opacity: .95;
  margin-top: 2px; text-transform: uppercase; letter-spacing: .08em;
  text-decoration: none;
}
.cal-block .bl-vehicle, .cal-event .bl-vehicle{
  font-family: var(--fm);
  font-size: 9.5px; opacity: .92; font-weight: 600;
  margin-top: 2px; letter-spacing: .04em;
}
.cal-block.ev-nach{
  background: rgba(245,158,11,.14); color: #b45309;
  border-left-color: var(--nach);
}
.cal-block.ev-sonst{
  background: rgba(99,102,241,.12); color: #4f46e5;
  border-left-color: var(--sonst);
}

/* Done / No-show overrides for cal blocks/events */
.cal-block.ev-done, .cal-event.ev-done{
  background: var(--ok) !important; color: #fff !important;
  border-left-color: #0f7d3a !important;
}
.cal-block.ev-no, .cal-event.ev-no{
  background: var(--danger) !important; color: #fff !important;
  border-left-color: #a51919 !important;
  text-decoration: line-through; text-decoration-thickness: 1px;
}

/* Day view single column */
.cal-day-body{
  display: grid; grid-template-columns: 60px 1fr;
  max-height: 72vh; overflow: auto;
}

/* ---------- Tasks board (Kanban) ---------------------------------------- */
.board{
  display: grid; gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.board-col{
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 14px;
  min-height: 220px;
}
.board-col-head{
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; padding: 2px 4px;
}
.board-col-head strong{
  font-family: var(--fd);
  font-size: 13.5px; font-weight: 700;
}
.board-col-head .count{
  font-family: var(--fm);
  font-size: 10.5px; padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-elev); border: 1px solid var(--border);
  color: var(--text-muted);
}
.board-list{ display: flex; flex-direction: column; gap: 10px; min-height: 40px; }
.task-card{
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  position: relative;
  transition: all .2s var(--ease-out);
}
.task-card:hover{
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
.task-card[draggable=true]:active{ cursor: grabbing; }
.task-card.is-dragging{ opacity: .4; }
.task-card .t-title{ font-weight: 600; line-height: 1.35; }
.task-card .t-meta{
  display: flex; gap: 8px; margin-top: 10px;
  flex-wrap: wrap; align-items: center;
}
.task-card .t-cat{ font-size: 11px; color: var(--text-muted); }
.task-card .t-due{ font-size: 11.5px; color: var(--text-muted); }
.task-card .t-due.is-overdue{ color: var(--danger); font-weight: 600; }
.task-card.status-erledigt .t-title{
  text-decoration: line-through; opacity: .65;
}
.task-card.t-flash{ animation: t-flash-anim .5s var(--ease-out); }
@keyframes t-flash-anim{
  0%   { background: var(--bg-elev); }
  50%  { background: rgba(22,163,74,.12); }
  100% { background: var(--bg-elev); }
}

.t-quick{
  position: absolute; top: 10px; right: 10px;
  display: flex; gap: 4px;
  opacity: .55; transition: opacity .15s;
  z-index: 2;
}
.task-card:hover .t-quick,
.task-card:focus-within .t-quick{ opacity: 1; }
.t-quick-btn{
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-elev);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer; padding: 0;
  transition: all .2s var(--ease-out);
}
.t-quick-btn:hover{ transform: translateY(-1px); }
.t-quick-btn:disabled, .t-quick-btn.is-loading{
  opacity: .55; cursor: wait;
}
.t-quick-done:hover{
  background: var(--ok); color: #fff; border-color: var(--ok);
}
.t-quick-prog:hover{
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.t-quick-reopen:hover{
  background: var(--warn); color: #fff; border-color: var(--warn);
}
@media (hover: none){ .t-quick{ opacity: 1; } }

.board-col.is-drop{
  outline: 2px dashed var(--accent); outline-offset: -6px;
}

/* ---------- Cash module ------------------------------------------------- */
.cash-form{
  display: grid; gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.cash-form .field-full{ grid-column: 1 / -1; }
.cash-summary{
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: grid; gap: 8px; grid-template-columns: repeat(2, 1fr);
}
.cash-summary .row{
  display: flex; justify-content: space-between;
  padding: 5px 6px;
}
.cash-summary .row strong{ font-weight: 700; }

/* ---------- Termin-Status-Buttons (im Modal) ---------------------------- */
.status-buttons{
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px;
}
.btn-status{
  flex: 1; min-width: 130px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 14px; font-size: 13px; font-weight: 600;
  background: var(--bg-elev); color: var(--text);
  border: 1.5px solid var(--border); border-radius: 12px;
  cursor: pointer; transition: all .2s var(--ease-out);
  font-family: var(--ff);
}
.btn-status:hover{
  background: var(--bg-inset); border-color: var(--text-muted);
}
.btn-status::before{
  content: "";
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor; opacity: .5;
}
.btn-status.btn-status-ok::before{ color: var(--ok); opacity: 1; }
.btn-status.btn-status-no::before{ color: var(--danger); opacity: 1; }
.btn-status.is-active{
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: var(--shadow-accent);
}
.btn-status.btn-status-ok.is-active{
  background: var(--ok); border-color: var(--ok);
  box-shadow: 0 4px 14px rgba(22,163,74,.28);
}
.btn-status.btn-status-no.is-active{
  background: var(--danger); border-color: var(--danger);
  box-shadow: 0 4px 14px rgba(220,38,38,.28);
}
.btn-status.is-active::before{ background: #fff; opacity: 1; }
.btn-status.is-saving{ opacity: .6; cursor: wait; }
.btn-status.pulse{ animation: pulse-anim .55s var(--ease-out); }
@keyframes pulse-anim{
  0%   { transform: scale(1); box-shadow: 0 0 0 0 rgba(22,163,74,.45); }
  50%  { transform: scale(1.04); box-shadow: 0 0 0 9px rgba(22,163,74,0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(22,163,74,0); }
}

/* ---------- Dashboard-Charts -------------------------------------------- */
.dash-charts{
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 18px;
}
.chart-card{ padding: 18px; }
.chart-wrap{
  position: relative; width: 100%; height: 230px; margin-top: 6px;
}
.chart-wrap-tall{ height: 250px; }
.chart-empty{
  display: flex; align-items: center; justify-content: center;
  height: 230px; color: var(--text-muted); font-size: 14px;
  background: var(--bg-inset); border-radius: 10px; margin-top: 8px;
  text-align: center; padding: 0 16px;
}
@media (max-width: 980px){
  .dash-charts{ grid-template-columns: 1fr; }
  .chart-wrap, .chart-wrap-tall, .chart-empty{ height: 220px; }
}

/* ---------- FAB --------------------------------------------------------- */
.fab{
  position: fixed; bottom: 24px; right: 24px;
  border-radius: 999px;
  padding: 13px 18px;
  background: var(--accent); color: #fff; font-weight: 700;
  box-shadow: var(--shadow-accent);
  border: 0; cursor: pointer;
  font-family: var(--ff);
  transition: transform .15s, box-shadow .2s;
}
.fab:hover{ transform: translateY(-2px); }

/* ---------- Activity ---------------------------------------------------- */
.activity-row{
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-top: 1px solid var(--border);
  font-size: 13.5px;
}
.activity-row:first-child{ border-top: 0; }
.activity-row .a-dot{
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0;
}
.activity-row .a-time{
  margin-left: auto;
  font-family: var(--fm);
  color: var(--text-muted); font-size: 11px;
}

/* ---------- Theme toggle icons ------------------------------------------ */
.theme-icon-dark{ display: none; }
[data-theme="dark"] .theme-icon-light{ display: none; }
[data-theme="dark"] .theme-icon-dark{ display: inline; }

/* ---------- Toast ------------------------------------------------------- */
.ibh-toast{
  position: fixed; bottom: 24px; right: 24px;
  display: inline-flex; align-items: center; gap: 11px;
  padding: 13px 19px; min-width: 220px; max-width: 400px;
  background: var(--ok); color: #fff;
  border-radius: 12px; font-size: 14px; font-weight: 500;
  box-shadow: 0 12px 30px rgba(20,22,26,.25);
  z-index: 10000;
  transform: translateY(80px); opacity: 0;
  transition: transform .28s var(--ease-out), opacity .28s var(--ease-out);
  pointer-events: none;
}
.ibh-toast.is-danger{ background: var(--danger); }
.ibh-toast.is-visible{ transform: translateY(0); opacity: 1; }
.ibh-toast-icon{
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255,255,255,.22);
  font-family: var(--fm);
  font-size: 12px; font-weight: 700;
}

/* ---------- Sidebar collapse (Desktop) ---------------------------------- */
.topbar-collapse{
  display: none; align-items: center; justify-content: center; margin-right: 4px;
}
@media (min-width: 901px){
  .topbar-collapse{ display: inline-flex; }
}
html.sidebar-collapsed .sidebar{ width: 72px; }
html.sidebar-collapsed .sidebar .brand-text,
html.sidebar-collapsed .sidebar .nav-item span,
html.sidebar-collapsed .sidebar .nav-badge,
html.sidebar-collapsed .sidebar .sidebar-foot-text,
html.sidebar-collapsed .sidebar .sidebar-brand .brand-mark + div{ display: none; }
html.sidebar-collapsed .sidebar-brand{
  justify-content: center; padding-left: 0; padding-right: 0;
}
html.sidebar-collapsed .sidebar-nav{ padding-left: 0; padding-right: 0; }
html.sidebar-collapsed .nav-item{
  justify-content: center; padding-left: 0; padding-right: 0;
  position: relative;
}
html.sidebar-collapsed .nav-item svg{ margin: 0; }
html.sidebar-collapsed .sidebar-footer{ justify-content: center; padding: 10px; }

/* Tooltip im collapsed-Modus */
html.sidebar-collapsed .nav-item::after{
  content: attr(data-label);
  position: absolute; left: calc(100% + 10px); top: 50%;
  transform: translateY(-50%);
  background: var(--text); color: #fff;
  padding: 5px 11px; border-radius: 7px;
  font-family: var(--ff); font-size: 12px; font-weight: 500;
  white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .18s; z-index: 100;
  box-shadow: var(--shadow);
}
html.sidebar-collapsed .nav-item:hover::after{ opacity: 1; }

.sidebar{ transition: width .22s var(--ease-out); }
.app-main{ transition: margin-left .22s var(--ease-out); }

/* ---------- PDF / Print ------------------------------------------------- */
@media print{
  body{ background: #fff !important; }
  .sidebar, .topbar, .modal-backdrop, .alert, .btn, button{ display: none !important; }
  .app-main{ margin: 0 !important; }
  .app-content{ padding: 0 !important; }
  .pdf-doc{
    background: #fff !important; color: #000 !important;
    font-family: system-ui, sans-serif; font-size: 12px;
  }
  .pdf-doc .card{ border: 1px solid #ccc; box-shadow: none; }
  .pdf-doc table{ border-collapse: collapse; width: 100%; }
  .pdf-doc table th, .pdf-doc table td{
    border-bottom: 1px solid #ccc; padding: 6px 8px; text-align: left;
  }
}

.pdf-doc{
  max-width: 820px; margin: 28px auto; padding: 28px;
  background: var(--bg-elev); border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.pdf-doc .pdf-head{
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 24px; padding-bottom: 16px;
  border-bottom: 2px solid var(--text);
}
.pdf-doc .pdf-head h1{
  margin: 0 0 4px; font-family: var(--fd);
  font-size: 22px; font-weight: 700;
}
.pdf-doc .pdf-head .pdf-sub{
  color: var(--text-muted); font-size: 13px;
}
.pdf-doc .pdf-sum-grid{
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin: 16px 0 22px;
}
.pdf-doc .pdf-sum{
  border: 1px solid var(--border); border-radius: 8px; padding: 12px;
  background: var(--bg-inset);
}
.pdf-doc .pdf-sum .lbl{
  font-family: var(--fm);
  color: var(--text-muted); font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .14em;
}
.pdf-doc .pdf-sum .val{
  font-family: var(--fd);
  font-size: 19px; font-weight: 700; margin-top: 4px;
}
.pdf-doc table{
  width: 100%; border-collapse: collapse;
  font-size: 12.5px; margin-top: 10px;
}
.pdf-doc th{
  background: var(--bg-inset); padding: 9px 10px;
  text-align: left; font-weight: 600;
  font-family: var(--fm); font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .12em;
}
.pdf-doc td{ padding: 9px 10px; border-bottom: 1px solid var(--border); }
.pdf-doc .num{ text-align: right; }
.pdf-doc .pdf-actions{
  display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 22px;
}

/* ---------- Responsive --------------------------------------------------- */
@media (max-width: 1100px){
  .board{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px){
  .topbar-collapse{ display: none !important; }
  .auth-shell{ grid-template-columns: 1fr; }
  .auth-aside{ display: none; }
  .auth-card{ padding: 36px 24px; }

  .app-shell{ grid-template-columns: 1fr; }
  .sidebar{
    position: fixed; top: 0; left: 0; bottom: 0;
    transform: translateX(-100%); transition: transform .25s var(--ease-out);
    z-index: 200; width: 280px;
    box-shadow: 4px 0 24px rgba(0,0,0,.20);
  }
  .sidebar.is-open{ transform: translateX(0); }
  .sidebar.is-open + .app-main::before{
    content: ""; position: fixed; inset: 0;
    background: rgba(20,22,26,.5);
    z-index: 150;
    animation: fade-in .18s ease;
  }
  @keyframes fade-in{ from{ opacity: 0; } to{ opacity: 1; } }
  .topbar-burger{ display: inline-flex !important; }
  .quick-actions{ display: none; }
  .profile-name{ display: none; }
  .topbar-back-site{ display: none; }
  .app-content{ padding: 20px 18px 60px; }

  .board{ grid-template-columns: 1fr; }
  .grid-2, .grid-3{ grid-template-columns: 1fr; }
  .cash-form{ grid-template-columns: 1fr; }
  .cal-day{ min-height: 82px; }
  .cal-week-head > div, .cal-hour-label{ font-size: 10.5px; }
}
@media (max-width: 760px){
  .cal-toolbar{ flex-wrap: wrap; gap: 8px; }
  .cal-views{ order: 3; width: 100%; justify-content: space-between; }
  .cal-legend{ display: none; }
  .cal-week, .cal-week-body{ font-size: 12px; }
  .cal-hours{ width: 38px; }
  .cal-hour-label{ font-size: 10px; padding-right: 4px; }
  .cal-week-head > div{ font-size: 11px; padding: 6px 2px; }
  .cal-block{ padding: 4px 6px; }
  .cal-block .bl-title{ font-size: 11px; line-height: 1.2; }
  .cal-block .bl-time{ font-size: 10px; }
  .cal-day{ min-height: 64px; padding: 5px; }
  .cal-day .d-num{ font-size: 11px; }
  .cal-event{
    font-size: 10px; padding: 2px 5px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .cal-month-head > div{ font-size: 10px; padding: 5px; }
}
@media (max-width: 520px){
  .topbar{ padding: 0 14px; }
  .page-title{ font-size: 21px; }
  .auth-card{ padding: 28px 20px; }
  .auth-h1{ font-size: 25px; }
}

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

/* Scrollbar polish -------------------------------------------------------- */
*::-webkit-scrollbar{ width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb{
  background: var(--border-strong); border-radius: 6px;
}
*::-webkit-scrollbar-thumb:hover{ background: var(--text-muted); }
*::-webkit-scrollbar-track{ background: transparent; }
