/* ═══════════════════════════════════════════════════════════════════════════
   ADMIN KALENDER (A12) — Founder's planning floor
   prefix: .akl-*
   Aesthetic: same editorial discipline as A1-A11 · month-grid with breathing
              cells · staggered fade-in (matches A11 pattern, 60ms steps) ·
              source-coded pills · "I dag" subtle orange glow ·
              heart-beat pulse on "next event" indicator.

   Inheritance:
     - Tokens via tokens.css (--ink/--bg/--orange/--surface/--sp-N/--font-mono)
     - Theme: [data-theme="light"|"dark"] bridged from html.dark
     - Italic Fraunces for event-titles in modal (lazy-loaded · taste-skill)
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,wght@1,400;1,500&display=swap');

:root {
  /* Source-coded palette (4 sources). */
  --akl-source-custom:    var(--orange);     /* user-created · editable */
  --akl-source-briefing:  #6366F1;            /* APScheduler · briefings */
  --akl-source-milestone: #FF6A00;            /* hardcoded milestones (orange-strong) */
  --akl-source-deadline:  #DC2626;            /* known-issues deadlines */

  /* Subtle backgrounds for each source pill */
  --akl-source-custom-bg:    rgba(255, 80, 0, 0.10);
  --akl-source-briefing-bg:  rgba(99, 102, 241, 0.10);
  --akl-source-milestone-bg: rgba(255, 106, 0, 0.10);
  --akl-source-deadline-bg:  rgba(220, 38, 38, 0.10);

  --akl-source-custom-border:    rgba(255, 80, 0, 0.28);
  --akl-source-briefing-border:  rgba(99, 102, 241, 0.30);
  --akl-source-milestone-border: rgba(255, 106, 0, 0.32);
  --akl-source-deadline-border:  rgba(220, 38, 38, 0.32);

  /* "I dag" wash — soft orange halo on today's cell */
  --akl-today-bg:   rgba(255, 80, 0, 0.06);
  --akl-today-ring: rgba(255, 80, 0, 0.32);

  /* Calendar grid */
  --akl-grid-line: var(--rule-faint);
  --akl-cell-bg:   var(--surface);
  --akl-cell-bg-off: var(--surface-alt);
  --akl-cell-hover:  rgba(255, 80, 0, 0.035);
  --akl-drag-over:   rgba(255, 80, 0, 0.10);

  /* Lock-icon tint (read-only events) */
  --akl-lock-tint: rgba(139, 139, 134, 0.55);
}

:root[data-theme="dark"] {
  --akl-source-custom:    #FF7733;
  --akl-source-briefing:  #818CF8;
  --akl-source-milestone: #FF8633;
  --akl-source-deadline:  #F87171;

  --akl-source-custom-bg:    rgba(255, 119, 51, 0.12);
  --akl-source-briefing-bg:  rgba(129, 140, 248, 0.14);
  --akl-source-milestone-bg: rgba(255, 134, 51, 0.14);
  --akl-source-deadline-bg:  rgba(248, 113, 113, 0.14);

  --akl-source-custom-border:    rgba(255, 119, 51, 0.36);
  --akl-source-briefing-border:  rgba(129, 140, 248, 0.40);
  --akl-source-milestone-border: rgba(255, 134, 51, 0.40);
  --akl-source-deadline-border:  rgba(248, 113, 113, 0.40);

  --akl-today-bg:   rgba(255, 110, 40, 0.10);
  --akl-today-ring: rgba(255, 110, 40, 0.45);

  --akl-grid-line: var(--rule-mid);
  --akl-cell-bg:   var(--surface);
  --akl-cell-bg-off: var(--surface-alt);
  --akl-cell-hover:  rgba(255, 110, 40, 0.06);
  --akl-drag-over:   rgba(255, 110, 40, 0.14);

  --akl-lock-tint: rgba(168, 168, 163, 0.55);
}

/* ─── Page scaffold ───────────────────────────────────────────────────────── */
.akl-page {
  padding: var(--sp-5) var(--sp-6) var(--sp-12);
  max-width: var(--content-max);
  margin: 0 auto;
  font-family: var(--font-sans);
  color: var(--ink);
}
@media (min-width: 768px) {
  .akl-page { padding: var(--sp-6) var(--sp-8) var(--sp-16); }
}

/* ─── Header ──────────────────────────────────────────────────────────────── */
.akl-head {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
@media (min-width: 640px) {
  .akl-head { flex-direction: row; align-items: center; justify-content: space-between; }
}

.akl-head-title {
  font-size: var(--t-h1);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: var(--ls-tight);
  margin: 0;
}
.akl-head-sub {
  font-size: var(--t-small);
  color: var(--ink-soft);
  margin-top: 2px;
}

.akl-head-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.akl-viewswitch {
  display: inline-flex;
  border: 1px solid var(--rule-mid);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
}
.akl-viewswitch-btn {
  padding: 6px 12px;
  font-size: var(--t-small);
  font-weight: 500;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.akl-viewswitch-btn:hover { background: var(--surface-alt); color: var(--ink); }
.akl-viewswitch-btn.is-active {
  background: var(--orange);
  color: #FFFFFF;
}

.akl-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: var(--t-small);
  font-weight: 500;
  color: #FFFFFF;
  background: var(--orange);
  border: 0;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), transform var(--dur-instant) var(--ease-out);
}
.akl-btn-primary:hover { background: var(--orange-hover); }
.akl-btn-primary:active { transform: scale(0.98); }

/* ─── Source filter chips ─────────────────────────────────────────────────── */
.akl-source-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.akl-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--r-full);
  font-size: var(--t-micro);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--rule-mid);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.akl-chip:hover { color: var(--ink); border-color: var(--rule); }
.akl-chip.is-on {
  color: var(--ink);
  border-color: var(--akl-chip-border, var(--rule));
  background: var(--akl-chip-bg, var(--surface-alt));
}
.akl-chip.is-off { opacity: 0.55; }
.akl-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--akl-chip-color, var(--ink-faint));
  flex-shrink: 0;
}
.akl-chip-count {
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
  font-size: 10px;
  color: var(--ink-faint);
  margin-left: 2px;
}

/* Source variants — set CSS vars per chip */
.akl-chip[data-source="custom"]    { --akl-chip-color: var(--akl-source-custom);    --akl-chip-bg: var(--akl-source-custom-bg);    --akl-chip-border: var(--akl-source-custom-border); }
.akl-chip[data-source="briefing"]  { --akl-chip-color: var(--akl-source-briefing);  --akl-chip-bg: var(--akl-source-briefing-bg);  --akl-chip-border: var(--akl-source-briefing-border); }
.akl-chip[data-source="milestone"] { --akl-chip-color: var(--akl-source-milestone); --akl-chip-bg: var(--akl-source-milestone-bg); --akl-chip-border: var(--akl-source-milestone-border); }
.akl-chip[data-source="deadline"]  { --akl-chip-color: var(--akl-source-deadline);  --akl-chip-bg: var(--akl-source-deadline-bg);  --akl-chip-border: var(--akl-source-deadline-border); }

/* ─── Status row (loading/error/next-event pulse) ─────────────────────────── */
.akl-statusrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.akl-statusrow-empty { color: var(--ink-faint); font-size: var(--t-small); }
.akl-loading, .akl-error {
  text-align: center;
  padding: var(--sp-8) 0;
  font-size: var(--t-small);
}
.akl-loading { color: var(--ink-soft); }
.akl-error   { color: var(--danger); }

.akl-next-pulse {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
}
.akl-next-pulse-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange);
}
.akl-next-pulse-dot::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--orange);
  animation: akl-heartbeat 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes akl-heartbeat {
  0%   { transform: scale(1);   opacity: 0.6; }
  50%  { transform: scale(2.0); opacity: 0; }
  100% { transform: scale(1);   opacity: 0; }
}

/* ─── Month-navigation ────────────────────────────────────────────────────── */
.akl-monthnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}
.akl-monthnav-title {
  font-family: var(--font-sans);
  font-size: var(--t-h2);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: var(--ls-tight);
}
.akl-monthnav-title em {
  font-family: var(--akl-editorial, 'Fraunces'), Georgia, serif;
  font-style: italic;
  font-weight: 400;
  color: var(--orange);
  margin-left: 6px;
}
.akl-iconbtn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 18px;
  cursor: pointer;
  border-radius: var(--r-md);
  transition: background var(--dur-fast) var(--ease-out);
}
.akl-iconbtn:hover { background: var(--surface-alt); }
.akl-iconbtn:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

/* ─── Layout grid: calendar + sidebar ─────────────────────────────────────── */
.akl-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-5);
}
@media (min-width: 1024px) {
  .akl-layout { grid-template-columns: 1fr 264px; }
}

/* ─── Month-view ──────────────────────────────────────────────────────────── */
.akl-monthframe {
  border: 1px solid var(--rule-mid);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
}
.akl-dow-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--surface-alt);
  border-bottom: 1px solid var(--akl-grid-line);
}
.akl-dow {
  padding: 8px 0;
  text-align: center;
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
  font-size: 11px;
  font-weight: 500;
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--ink-soft);
}

.akl-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.akl-cell {
  min-height: 96px;
  padding: 6px;
  background: var(--akl-cell-bg);
  border-right: 1px solid var(--akl-grid-line);
  border-bottom: 1px solid var(--akl-grid-line);
  cursor: pointer;
  position: relative;
  transition: background var(--dur-fast) var(--ease-out);
  /* Staggered cascade — matches A11 (60ms increments) */
  opacity: 0;
  animation: akl-cell-in 0.42s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: calc(var(--akl-i, 0) * 18ms);
}
.akl-cell:nth-child(7n) { border-right: 0; }
.akl-cell:hover:not(.is-dragover) { background: var(--akl-cell-hover); }
.akl-cell.is-off  { background: var(--akl-cell-bg-off); }
.akl-cell.is-off .akl-daynum { color: var(--ink-faint); }
.akl-cell.is-today { background: var(--akl-today-bg); }
.akl-cell.is-selected { box-shadow: inset 0 0 0 2px var(--orange); }
.akl-cell.is-dragover { background: var(--akl-drag-over); }

@keyframes akl-cell-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.akl-daynum {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 4px;
  border-radius: 50%;
}
.akl-cell.is-today .akl-daynum {
  background: var(--orange);
  color: #FFFFFF;
  font-weight: 700;
  box-shadow: 0 0 0 3px var(--akl-today-ring);
}

.akl-cell-events {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.akl-eventpill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px 2px 4px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
  background: var(--akl-pill-bg, var(--surface-alt));
  color: var(--akl-pill-color, var(--ink));
  border-left: 2px solid var(--akl-pill-color, var(--orange));
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.akl-eventpill:hover { opacity: 0.85; transform: translateX(1px); }
.akl-eventpill-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--akl-pill-color, var(--orange));
  flex-shrink: 0;
}
.akl-eventpill-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.akl-eventpill-lock {
  margin-left: auto;
  font-size: 9px;
  color: var(--akl-lock-tint);
  flex-shrink: 0;
}
.akl-eventpill.is-readonly { cursor: default; }
.akl-eventpill.is-readonly:hover { opacity: 1; transform: none; }

/* Source variants */
.akl-eventpill[data-source="custom"]    { --akl-pill-color: var(--akl-source-custom);    --akl-pill-bg: var(--akl-source-custom-bg); }
.akl-eventpill[data-source="briefing"]  { --akl-pill-color: var(--akl-source-briefing);  --akl-pill-bg: var(--akl-source-briefing-bg); }
.akl-eventpill[data-source="milestone"] { --akl-pill-color: var(--akl-source-milestone); --akl-pill-bg: var(--akl-source-milestone-bg); }
.akl-eventpill[data-source="deadline"]  { --akl-pill-color: var(--akl-source-deadline);  --akl-pill-bg: var(--akl-source-deadline-bg); }

.akl-cell-more {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-faint);
  padding: 1px 4px;
}

/* ─── Week-view ───────────────────────────────────────────────────────────── */
.akl-weekframe {
  border: 1px solid var(--rule-mid);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
}
.akl-week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.akl-week-cell {
  min-height: 180px;
  padding: 10px;
  background: var(--surface);
  border-right: 1px solid var(--akl-grid-line);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.akl-week-cell:last-child { border-right: 0; }
.akl-week-cell.is-today { background: var(--akl-today-bg); }
.akl-week-cell.is-dragover { background: var(--akl-drag-over); }
.akl-week-dow {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.akl-week-day {
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 10px;
}
.akl-week-cell.is-today .akl-week-day { color: var(--orange); }
.akl-week-events {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ─── List-view ───────────────────────────────────────────────────────────── */
.akl-list { display: flex; flex-direction: column; gap: 2px; }
.akl-list-empty {
  padding: var(--sp-8) 0;
  text-align: center;
  font-size: var(--t-small);
  color: var(--ink-faint);
}
.akl-list-month {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: var(--sp-3) var(--sp-2) var(--sp-2);
  margin-top: var(--sp-2);
}
.akl-list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.akl-list-row:hover { background: var(--surface-alt); }
.akl-list-date {
  width: 44px;
  text-align: center;
  flex-shrink: 0;
  font-family: var(--font-mono);
}
.akl-list-dow {
  font-size: 10px;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.akl-list-day {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}
.akl-list-meta { flex: 1; min-width: 0; }
.akl-list-desc {
  font-size: var(--t-small);
  color: var(--ink-soft);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.akl-list-reminder {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  flex-shrink: 0;
}

/* ─── Sidebar ─────────────────────────────────────────────────────────────── */
.akl-side { display: flex; flex-direction: column; gap: var(--sp-4); }
.akl-side-card {
  border: 1px solid var(--rule-mid);
  border-radius: var(--r-lg);
  background: var(--surface);
  padding: var(--sp-4);
}
.akl-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}
.akl-side-title {
  font-size: var(--t-small);
  font-weight: 600;
  color: var(--ink);
}
.akl-side-link {
  font-size: var(--t-micro);
  color: var(--orange);
  background: none;
  border: 0;
  cursor: pointer;
  letter-spacing: 0.02em;
}
.akl-side-link:hover { color: var(--orange-hover); text-decoration: underline; }
.akl-side-empty {
  font-size: var(--t-small);
  color: var(--ink-faint);
}
.akl-side-row {
  margin-bottom: var(--sp-3);
  cursor: pointer;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.akl-side-row:hover { opacity: 0.82; }
.akl-side-row:last-child { margin-bottom: 0; }
.akl-side-row-meta {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.akl-side-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  width: 48px;
  flex-shrink: 0;
  padding-top: 2px;
}
.akl-side-desc {
  font-size: var(--t-small);
  color: var(--ink-soft);
  margin-top: 4px;
}

/* ─── Modal ───────────────────────────────────────────────────────────────── */
.akl-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 14, 12, 0.50);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  z-index: var(--z-modal);
}
.akl-modal {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--rule-mid);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xl);
  padding: var(--sp-6);
  animation: akl-modal-in 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes akl-modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}
.akl-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}
.akl-modal-title {
  font-family: var(--akl-editorial, 'Fraunces'), Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: 22px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.akl-modal-close {
  background: none; border: 0; cursor: pointer;
  width: 28px; height: 28px;
  font-size: 22px;
  color: var(--ink-faint);
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-md);
}
.akl-modal-close:hover { background: var(--surface-alt); color: var(--ink); }
.akl-modal-error {
  background: var(--danger-tint);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  font-size: var(--t-small);
  padding: 8px 12px;
  border-radius: var(--r-md);
  margin-bottom: var(--sp-3);
}
.akl-field { margin-bottom: var(--sp-3); }
.akl-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.akl-label {
  display: block;
  font-size: var(--t-micro);
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}
.akl-input, .akl-select, .akl-textarea {
  width: 100%;
  padding: 8px 12px;
  font-size: var(--t-small);
  font-family: var(--font-sans);
  background: var(--surface);
  border: 1px solid var(--rule-mid);
  border-radius: var(--r-md);
  color: var(--ink);
  outline: none;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.akl-input:focus, .akl-select:focus, .akl-textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 80, 0, 0.18);
}
.akl-textarea { resize: vertical; min-height: 64px; }
.akl-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--sp-5);
  gap: var(--sp-2);
}
.akl-btn-danger {
  padding: 7px 12px;
  background: transparent;
  color: var(--danger);
  border: 0;
  border-radius: var(--r-md);
  font-size: var(--t-small);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.akl-btn-danger:hover { background: var(--danger-tint); }
.akl-btn-ghost {
  padding: 7px 14px;
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--rule-mid);
  border-radius: var(--r-md);
  font-size: var(--t-small);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.akl-btn-ghost:hover { background: var(--surface-alt); color: var(--ink); }
.akl-btn-save {
  padding: 7px 14px;
  background: var(--orange);
  color: #FFFFFF;
  border: 0;
  border-radius: var(--r-md);
  font-size: var(--t-small);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.akl-btn-save:hover { background: var(--orange-hover); }
.akl-btn-save:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── AIChatWindow (PageAdminAI) — co-located here so admin-kalender.css
       carries all A12 styling. Tokens-only, prefix .aiw-*. ─────────────────── */
.aiw-shell {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--rule-mid);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
  min-height: 420px;
  max-height: 70vh;
  box-shadow: var(--shadow-sm);
}
.aiw-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  background: var(--bg);
}
.aiw-row {
  display: flex;
  width: 100%;
}
.aiw-row--user { justify-content: flex-end; }
.aiw-row--assistant { justify-content: flex-start; }
.aiw-bubble {
  max-width: 78%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: var(--t-small);
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.aiw-bubble--user {
  background: var(--orange);
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
}
.aiw-bubble--assistant {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule-faint);
  border-bottom-left-radius: 4px;
}
.aiw-bubble--typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 12px 14px;
}
.aiw-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--danger-tint);
  border-top: 1px solid var(--danger-border);
  color: var(--danger);
  font-size: var(--t-small);
}
.aiw-error-dismiss {
  margin-left: auto;
  background: none;
  border: 0;
  color: var(--danger);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.aiw-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: var(--sp-3);
  border-top: 1px solid var(--rule-faint);
  background: var(--surface);
}
.aiw-textarea {
  flex: 1;
  resize: none;
  min-height: 38px;
  max-height: 120px;
  padding: 9px 12px;
  font-size: var(--t-small);
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule-mid);
  border-radius: var(--r-md);
  outline: none;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.aiw-textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 80, 0, 0.18);
}
.aiw-textarea:disabled { opacity: 0.6; cursor: not-allowed; }
.aiw-send {
  padding: 9px 16px;
  font-size: var(--t-small);
  font-weight: 600;
  color: #FFFFFF;
  background: var(--orange);
  border: 0;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), transform var(--dur-instant) var(--ease-out);
}
.aiw-send:hover:not(:disabled) { background: var(--orange-hover); }
.aiw-send:active:not(:disabled) { transform: scale(0.97); }
.aiw-send:disabled { opacity: 0.45; cursor: not-allowed; }

/* ─── Reduced motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .akl-cell { animation: none !important; opacity: 1 !important; transform: none !important; }
  .akl-modal { animation: none !important; }
  .akl-next-pulse-dot::before { animation: none !important; opacity: 0.25; }
}
