@import url("/static/ph/phosphor.css");

:root {
  /* ── Nocturne Light — verbindliche Farbrampen (Handoff 2a) ── */
  --neutral-100: #f3f5fe;
  --neutral-200: #e4e7f5;
  --neutral-300: #cfd3e5;
  --neutral-600: #75798c;
  --neutral-700: #595d6c;
  --neutral-800: #3f424d;
  --neutral-900: #292b31;
  --accent-200:  #e7e5fe;
  --accent-300:  #d2cefd;
  --accent-400:  #b5abfc;
  --accent-500:  #968ae0;
  --accent-600:  #796cbf;
  --accent-700:  #5d5294;

  /* Alias-Namen (bestehende Klassen nutzen diese) → auf Nocturne gemappt */
  --bg:         var(--neutral-200);
  --surface:    #ffffff;
  --surface2:   var(--neutral-100);
  --border:     var(--neutral-300);
  --border2:    #c2c6d6;
  --text:       var(--neutral-900);
  --muted:      var(--neutral-600);
  --accent:     var(--accent-600);
  --accent-lt:  var(--accent-200);
  --green:      #16a34a;
  --green-lt:   #dcfce7;
  --red:        #dc2626;
  --radius:     8px;
  --accent-txt: var(--accent-700);
  --shadow:     0 1px 6px rgba(0,0,0,.08);
  --shadow-md:  0 4px 20px rgba(0,0,0,.12);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.4;
}

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

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: 5px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  text-decoration: none;
  line-height: 1.5;
}
.btn:hover { background: var(--accent-lt); border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-primary { background: #fff; border: 1px solid var(--accent); color: var(--accent-txt); font-weight: 600; }
.btn-primary:hover { background: var(--accent-lt); border-color: var(--accent); color: var(--accent-txt); }
.btn-sm { padding: 3px 9px; font-size: 11px; }
.btn-full { width: 100%; text-align: center; display: block; }
.btn-danger { color: var(--red); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; border-color: var(--red); }

/* ── Filter bar ── */
.filterbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 5px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.nav-group { display: flex; align-items: center; gap: 4px; }
.nav-arrow {
  display: inline-block;
  padding: 4px 9px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  border: 1px solid var(--border);
  background: var(--surface2);
  text-decoration: none;
  line-height: 1.4;
}
.nav-arrow:hover { background: var(--accent-lt); border-color: var(--accent); color: var(--accent); text-decoration: none; }
.nav-period-label { font-size: 13px; font-weight: 600; color: var(--text); padding: 0 6px; white-space: nowrap; }

/* ── Flash ── */
.flash { padding: 7px 16px; font-size: 12px; border-left: 3px solid; }
.flash-ok  { background: #f0fdf4; border-color: var(--green); color: var(--green); }
.flash-err { background: #fef2f2; border-color: var(--red); color: var(--red); }


/* ── Login ── */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--bg);
}
.login-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 32px;
  width: 100%; max-width: 360px;
  box-shadow: var(--shadow-md);
}
.login-box h1 { font-size: 20px; margin-bottom: 4px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 4px; }
.field input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-lt); }

.alert { padding: 8px 12px; border-radius: var(--radius); font-size: 13px; margin-bottom: 14px; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: var(--red); }

/* ── Admin pages (Nocturne Light) ── */
.page-wrap { padding: 24px 28px 40px; max-width: 1040px; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 12px;
               flex-wrap: wrap; margin-bottom: 20px; }
.page-header h1 { font-size: 22px; font-weight: 500; color: var(--neutral-900); letter-spacing: -.01em; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.data-table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--surface2);
  border-bottom: 2px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }

.actions-cell { display: flex; gap: 6px; align-items: center; }
.role-badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.role-admin   { background: #ede9fe; color: #7c3aed; }
.role-cleaner { background: var(--green-lt); color: var(--green); }
code { background: var(--surface2); padding: 1px 5px; border-radius: 4px; font-size: 12px; font-family: monospace; border: 1px solid var(--border); }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-state .big-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h2 { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 16px;
}
.modal-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; width: 100%; max-width: 420px;
  box-shadow: var(--shadow-md); overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 14px;
}
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--muted); padding: 2px 6px; border-radius: 5px; line-height: 1; }
.modal-close:hover { background: var(--surface2); }
.modal-body { padding: 16px; }
.input-field { width: 100%; border: 1px solid var(--border); border-radius: var(--radius); padding: 7px 10px; font-size: 13px; color: var(--text); background: var(--surface); }
.input-field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-lt); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Phase 3: Role & Permission additions ── */

.role-owner { background: #fef9c3; color: #854d0e; }

/* ── Permission checklist ── */
.perm-check-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.perm-check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  transition: background .1s, border-color .1s;
}
.perm-check-row:hover { background: var(--accent-lt); border-color: var(--accent); }
.perm-check-row input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.perm-check-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
}
.perm-check-row.perm-overridden {
  border-color: var(--accent);
  background: var(--accent-lt);
}

.perm-override-tag {
  font-size: 10px;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 1px 6px;
  white-space: nowrap;
}
.perm-role-tag {
  font-size: 10px;
  font-weight: 600;
  background: var(--green-lt);
  color: var(--green);
  border-radius: 8px;
  padding: 1px 6px;
  white-space: nowrap;
}

/* ── Phase 5: API admin styles ── */

.api-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 4px;
}
.api-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.api-card-body { padding: 16px; }

.api-provider-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.api-provider-name { font-size: 14px; font-weight: 700; color: var(--text); }
.api-provider-sub  { font-size: 11px; color: var(--muted); margin-top: 1px; }

.api-status { font-size: 12px; font-weight: 600; white-space: nowrap; }
.api-status-ok   { color: var(--green); }
.api-status-warn { color: #d97706; }
.api-status-off  { color: var(--muted); }

.api-sync-info {
  margin-top: 12px;
  padding: 8px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--text);
}

/* Sync interval selector */
.interval-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.interval-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 6px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
  cursor: pointer;
  transition: border-color .1s, background .1s;
}
.interval-option input[type="radio"] { display: none; }
.interval-option:hover { border-color: var(--accent); background: var(--accent-lt); }
.interval-option.selected {
  border-color: var(--accent);
  background: var(--accent-lt);
}
.interval-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.interval-option.selected .interval-label { color: var(--accent); }


/* ── Logo square (gradient brand icon) ──────────────────────── */
.logo-sq {
  width: 28px; height: 28px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, #6f61c0, #9c92d9);
}
/* ── User color picker ── */
.color-dot-btn {
  width: 26px; height: 26px; border-radius: 999px;
  border: 2px solid #fff; box-shadow: 0 0 0 1px #d5dbe5;
  cursor: pointer; padding: 0; display: block;
}
.color-dot-btn:hover { box-shadow: 0 0 0 2px #6f61c0; }
.color-dot-none { background: #f1f5f9; border: 2px dashed #c3ccd9; box-shadow: none; }
.color-grid {
  display: grid; grid-template-columns: repeat(8, 1fr);
  gap: 10px; justify-items: center; padding: 4px 0;
}
.color-swatch {
  width: 34px; height: 34px; border-radius: 999px;
  border: none; cursor: pointer; padding: 0;
  transition: transform .1s ease;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.current { outline: 3px solid #6f61c0; outline-offset: 2px; }
.src-badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
}
.src-api    { background: #e2ddf9; color: #55499c; }
.src-manual { background: #f1f5f9; color: #475569; }
/* Nocturne-Prinzip: Primary als Akzent-Outline, keine Vollfüllung */
.add-booking-btn {
  height: 34px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--accent);
  background: #fff; color: var(--accent-txt); font-size: 13px; font-weight: 600;
  font-family: 'Inter', system-ui, sans-serif; cursor: pointer;
  transition: background .12s ease;
}
.add-booking-btn:hover { background: var(--accent-lt); }
.bk-manual { cursor: pointer; }

/* ── Auswahl-Popup (Buchung/Block/Reinigung) ── */
.action-choice { display: flex; flex-direction: column; gap: 10px; }
.btn-block-gray  { background: #64748b; color: #fff; }
.btn-block-gray:hover  { background: #475569; }
.btn-clean-green { background: #0e9f6e; color: #fff; }
.btn-clean-green:hover { background: #0b7d57; }

/* ── Eintrag-Modal (Bearbeiten/Stornieren) ── */
.entry-info { display: flex; flex-direction: column; gap: 6px; }
.ei-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; color: #64748b;
  padding: 6px 10px; background: #f8fafc; border-radius: 8px;
}
.ei-row strong { color: #262833; font-weight: 600; text-align: right; }
.ei-note { font-size: 12px; color: #b45309; padding: 4px 2px 0; }
.btn-cancel-red  { background: #dc2626; color: #fff; }
.btn-cancel-red:hover { background: #b91c1c; }

/* ── Seitenleiste (Nocturne Light, 216px, beschriftet) ────────────────────
   Löst die 60px-Icon-Rail ab. body.with-sidebar bleibt als Klasse erhalten
   (alle Templates tragen sie) und trägt jetzt die App-Grundfläche. */
body.with-sidebar { padding-left: 216px; background: var(--neutral-200); }
.sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 216px; background: var(--neutral-100);
           border-right: 1px solid var(--neutral-300); display: flex; flex-direction: column;
           padding: 18px 14px 16px; z-index: 120; }
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; margin-bottom: 22px;
            text-decoration: none; }
.sb-mark { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--accent-600);
           color: var(--accent-700); font-size: 15px; font-weight: 700; flex: none;
           display: flex; align-items: center; justify-content: center; }
.sb-word { font-size: 16px; font-weight: 500; color: var(--neutral-900); letter-spacing: -.01em; }
.sb-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sb-item { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px;
           color: var(--neutral-700); font-size: 14px; font-weight: 500; text-decoration: none;
           position: relative; transition: background .12s ease, color .12s ease; }
.sb-item .ph { font-size: 17px; color: var(--neutral-600); flex: none; }
.sb-item:hover { background: var(--neutral-200); color: var(--neutral-900); }
.sb-item:hover .ph { color: var(--neutral-700); }
.sb-item.active { background: var(--accent-200); color: var(--accent-700); }
.sb-item.active .ph { color: var(--accent-700); }
.sb-badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
            background: var(--red); color: #fff; font-size: 10px; font-weight: 700; line-height: 18px;
            text-align: center; box-sizing: border-box; }
.sb-foot { display: flex; flex-direction: column; gap: 2px; margin-top: 8px;
           padding-top: 12px; border-top: 1px solid var(--neutral-300); }
.sb-user { position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 8px 2px; }
.sb-avatar { width: 32px; height: 32px; border-radius: 999px; background: var(--accent-200);
             color: var(--accent-700); border: none; font-family: inherit; font-size: 12px;
             font-weight: 600; cursor: pointer; flex: none; transition: background .12s ease; }
.sb-avatar:hover { background: var(--accent-300); }
.sb-uinfo { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sb-uname { font-size: 13px; font-weight: 500; color: var(--neutral-900);
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-urole { font-size: 11.5px; color: var(--neutral-600); }
.user-drop { display: none; position: absolute; bottom: 44px; left: 8px; width: 184px; background: #fff;
             border: 1px solid var(--border); border-radius: 10px;
             box-shadow: 0 0 0 1px var(--neutral-300), 0 6px 18px rgba(20,20,40,0.10); padding: 5px; z-index: 130; }
.user-drop.open { display: block; }
.user-drop a { display: block; padding: 9px 11px; font-size: 13px; border-radius: 8px;
               color: var(--text); text-decoration: none; }
.user-drop a:hover { background: var(--accent-lt); }
.user-drop a.danger { color: var(--red); }
.user-drop a.danger:hover { background: #fdf0ef; }

/* ── App-Kopfzeile (Handoff 2a) ── */
.appheader { display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
             padding: 18px 28px; }
.ah-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ah-pill { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px;
           background: var(--neutral-200); border-radius: 999px; font-size: 12.5px;
           color: var(--neutral-700); white-space: nowrap; }
.ah-pill .ph { font-size: 15px; color: var(--neutral-600); }
.ah-date { font-size: 13px; color: var(--neutral-600); white-space: nowrap; }
.ah-spacer { flex: 1; }
.ah-actions { display: flex; align-items: center; gap: 10px; }
.ah-btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px;
          border-radius: 8px; border: 1px solid var(--neutral-300); background: #fff;
          color: var(--neutral-700); font-size: 13px; font-weight: 500; font-family: inherit;
          cursor: pointer; text-decoration: none; transition: background .12s ease, border-color .12s ease; }
.ah-btn .ph { font-size: 16px; }
.ah-btn:hover { background: var(--neutral-100); border-color: var(--neutral-600); }
.ah-btn.accent { border-color: var(--accent-600); color: var(--accent-700); }
.ah-btn.accent:hover { background: var(--accent-200); }
.ah-firm { font-size: 13.5px; font-weight: 500; color: var(--neutral-800); white-space: nowrap; }
.ah-avatar { width: 32px; height: 32px; border-radius: 999px; background: var(--accent-200);
             color: var(--accent-700); font-size: 12px; font-weight: 600; flex: none;
             display: inline-flex; align-items: center; justify-content: center; }

/* Inhaltsfläche unter der Kopfzeile */
.app-main { padding: 4px 28px 40px; }

@media (max-width: 720px) {
  body.with-sidebar { padding-left: 0; padding-top: 54px; }
  .sidebar { flex-direction: row; align-items: center; bottom: auto; width: 100%; height: 54px;
             padding: 0 12px; gap: 4px; overflow-x: auto; }
  .sb-brand { margin-bottom: 0; }
  .sb-word, .sb-item span, .sb-uinfo { display: none; }
  .sb-nav { flex-direction: row; flex: 1; }
  .sb-foot { flex-direction: row; margin-top: 0; padding-top: 0; border-top: none; border-left: 1px solid var(--neutral-300); padding-left: 8px; }
  .sb-user { padding: 0; }
  .user-drop { bottom: auto; top: 44px; left: auto; right: 8px; }
}
@media print {
  .sidebar, .appheader { display: none !important; }
  body.with-sidebar { padding-left: 0; background: #fff; }
}

/* ── Interaktionszustände (Handoff, verbindlich) ── */
:is(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
:is(button, input, select, textarea)[disabled] { opacity: .45; }

/* ── Einstellungen: Unterreiter ── */
.settings-tabs { display: flex; gap: 6px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.settings-tabs a { padding: 10px 4px; margin-right: 18px; font-size: 14px; font-weight: 700;
                   color: #94a3b8; text-decoration: none; border-bottom: 2px solid transparent; }
.settings-tabs a:hover { color: var(--text); }
.settings-tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
