/* views.css — Layouts der einzelnen Ansichten. */

/* ============ LOGIN ============ */
.login { min-height: 100dvh; display: grid; grid-template-columns: 1.05fr 0.95fr; }
.login__aside {
  position: relative; overflow: hidden;
  padding: var(--space-8) var(--space-7);
  display: flex; flex-direction: column;
  color: var(--ink-invert);
  background: linear-gradient(155deg, oklch(34% 0.09 264) 0%, oklch(26% 0.07 270) 55%, oklch(20% 0.04 270) 100%);
}
.login__aside::before {
  content: ''; position: absolute; inset: 0; opacity: 0.5;
  background:
    radial-gradient(40% 50% at 80% 12%, oklch(60% 0.18 264 / 0.5), transparent 70%),
    radial-gradient(45% 45% at 12% 88%, oklch(55% 0.15 310 / 0.4), transparent 70%);
  animation: auraShift 16s var(--ease-in-out) infinite alternate;
}
@keyframes auraShift { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(0,-3%,0) scale(1.08); } }
.login__aside > * { position: relative; z-index: 1; }
.login__brand { display: flex; align-items: center; gap: var(--space-3); }
.login__brand .brand__name { color: white; }
.login__lede { margin-top: auto; }
.login__lede h2 { font-family: var(--font-display); font-weight: 500; font-size: var(--text-2xl); line-height: 1.04; letter-spacing: -0.02em; }
.login__lede p { margin-top: var(--space-4); color: oklch(90% 0.02 264 / 0.85); font-size: var(--text-md); max-width: 42ch; }
.login__flow { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-6); }
.login__chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 13px; border-radius: var(--r-pill);
  background: oklch(100% 0 0 / 0.1); border: 1px solid oklch(100% 0 0 / 0.16);
  font-size: var(--text-sm); font-weight: 500; backdrop-filter: blur(6px);
}
.login__chip svg { width: 15px; height: 15px; opacity: 0.9; }

.login__main { display: grid; place-items: center; padding: var(--space-6); background: var(--canvas); }
.login__card { width: 100%; max-width: 384px; }
.login__card h1 { font-size: var(--text-xl); font-family: var(--font-display); font-weight: 500; }
.login__card > p { color: var(--ink-muted); margin: var(--space-2) 0 var(--space-6); }
.login__form { display: flex; flex-direction: column; gap: var(--space-4); }
.login__demo-note {
  display: flex; align-items: center; gap: var(--space-2);
  margin-top: var(--space-4); padding: var(--space-3);
  background: var(--brand-soft); border-radius: var(--r-sm);
  font-size: var(--text-xs); color: var(--brand-strong);
}
.login__demo-note svg { width: 16px; height: 16px; flex-shrink: 0; }
.login__legal { margin-top: var(--space-5); font-size: var(--text-xs); color: var(--ink-faint); text-align: center; }

@media (max-width: 820px) {
  .login { grid-template-columns: 1fr; }
  .login__aside { display: none; }
}

/* ============ DASHBOARD (Bento) ============ */
.bento { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }
.stat { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); position: relative; overflow: hidden; }
.stat__top { display: flex; align-items: center; justify-content: space-between; }
.stat__icon { width: 36px; height: 36px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--surface-2); color: var(--ink-soft); }
.stat__icon svg { width: 19px; height: 19px; }
.stat__value { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 500; line-height: 1; letter-spacing: -0.03em; }
.stat__label { font-size: var(--text-sm); color: var(--ink-muted); font-weight: 500; }
.stat--alert .stat__value { color: var(--danger); }
.stat--alert .stat__icon { background: var(--danger-soft); color: var(--danger); }

.span-2 { grid-column: span 2; }
.dash-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--space-4); margin-top: var(--space-4); }

.timeline-item { display: flex; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--line); }
.timeline-item:last-child { border-bottom: none; }
.timeline-item__meta { margin-left: auto; text-align: right; flex-shrink: 0; }
.timeline-item__file { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--ink-soft); word-break: break-all; }

/* Mini-Donut fürs Aufgaben-Fortschritts-Widget */
.donut { display: grid; place-items: center; gap: var(--space-3); padding: var(--space-3) 0; }
.donut__ring { --p: 0; width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--ok) calc(var(--p) * 1%), var(--surface-sunken) 0); position: relative; }
.donut__ring::after { content: ''; position: absolute; inset: 13px; border-radius: 50%; background: var(--surface); }
.donut__num { position: relative; z-index: 1; font-family: var(--font-display); font-size: 1.9rem; font-weight: 500; }
.donut__num small { display: block; font-family: var(--font-ui); font-size: var(--text-xs); color: var(--ink-muted); font-weight: 500; }

@media (max-width: 980px) { .bento { grid-template-columns: repeat(2, 1fr); } .dash-grid { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .bento { grid-template-columns: 1fr; } }

/* ============ ERFASSEN (Capture-Flow) ============ */
.capture { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); align-items: start; }
.capture__form { display: flex; flex-direction: column; gap: var(--space-4); }
.capture__preview { position: sticky; top: calc(var(--topbar-h) + var(--space-6)); }

/* Live-Vorschau-Karte: das "Magie"-Ergebnis */
.preview {
  border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow-md); background: var(--surface);
}
.preview__head { padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: var(--space-3); background: var(--surface-2); }
.preview__head .u-eyebrow { margin-left: 2px; }
.preview__live { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 600; color: var(--ok); }
.preview__live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 oklch(58% 0.13 152 / 0.5); } 70% { box-shadow: 0 0 0 8px oklch(58% 0.13 152 / 0); } 100% { box-shadow: 0 0 0 0 oklch(58% 0.13 152 / 0); } }
.preview__body { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-5); }

.preview__filename {
  font-family: var(--font-mono); font-size: var(--text-sm); line-height: 1.5;
  padding: var(--space-4); border-radius: var(--r-md);
  background: oklch(24% 0.012 270); color: oklch(92% 0.02 150);
  word-break: break-all; position: relative;
}
.preview__filename .seg-code { color: oklch(80% 0.12 264); }
.preview__filename .seg-date { color: oklch(78% 0.1 200); }
.preview__filename .seg-amt { color: oklch(82% 0.13 150); }
.preview__copy { position: absolute; top: var(--space-2); right: var(--space-2); color: oklch(75% 0.02 150); padding: 5px; border-radius: var(--r-xs); }
.preview__copy:hover { background: oklch(100% 0 0 / 0.1); color: white; }
.preview__copy svg { width: 16px; height: 16px; }

.preview__derived { display: grid; gap: var(--space-4); }
.derive-block__label { display: flex; align-items: center; gap: 7px; margin-bottom: var(--space-2); }
.derive-block__label svg { width: 15px; height: 15px; color: var(--ink-muted); }
.derive-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; }
.derive-row + .derive-row { border-top: 1px dashed var(--line); }
.derive-row__due { margin-left: auto; font-size: var(--text-xs); font-weight: 600; font-variant-numeric: tabular-nums; }

.reveal { animation: reveal var(--dur-slow) var(--ease-out) both; }
@keyframes reveal { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (max-width: 900px) {
  .capture { grid-template-columns: 1fr; }
  .capture__preview { position: static; }
}

/* ============ ARCHIV ============ */
.archive-toolbar { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-5); flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 200px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-faint); }
.search .input { padding-left: 2.5rem; }

.cat-group { margin-bottom: var(--space-5); }
.cat-group__head { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); }
.cat-group__head h3 { font-size: var(--text-base); font-weight: 600; }
.cat-group__count { font-size: var(--text-xs); color: var(--ink-muted); background: var(--surface-2); padding: 2px 8px; border-radius: var(--r-pill); }
.cat-group__line { flex: 1; height: 1px; background: var(--line); }

.doc-row { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-3) var(--space-4); border-radius: var(--r-md); transition: background var(--dur-fast); }
.doc-row:hover { background: var(--surface-2); }
.doc-row__main { min-width: 0; flex: 1; }
.doc-row__file { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-row__sub { font-size: var(--text-xs); color: var(--ink-muted); margin-top: 2px; }
.doc-row__amount { font-variant-numeric: tabular-nums; font-weight: 600; font-size: var(--text-sm); flex-shrink: 0; }
.doc-row__date { font-size: var(--text-xs); color: var(--ink-muted); flex-shrink: 0; min-width: 84px; text-align: right; }

/* ============ AUFGABEN ============ */
.task-list { display: flex; flex-direction: column; }
.task-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4); border-bottom: 1px solid var(--line); transition: background var(--dur-fast); }
.task-row:last-child { border-bottom: none; }
.task-row:hover { background: var(--surface-2); }
.task-row__body { min-width: 0; flex: 1; }
.task-row__title { font-weight: 500; transition: color var(--dur-fast); }
.task-row.is-done .task-row__title { color: var(--ink-faint); text-decoration: line-through; }
.task-row__sub { font-size: var(--text-xs); color: var(--ink-muted); margin-top: 2px; }
.prio { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.prio--high { background: var(--danger); }
.prio--normal { background: var(--warn); }
.prio--low { background: var(--ink-faint); }

/* ============ FRISTEN / KALENDER ============ */
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.cal__head { display: flex; align-items: center; padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--line); }
.cal__title { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 500; }
.cal__weekdays { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--line); }
.cal__weekday { padding: var(--space-2); text-align: center; font-size: var(--text-xs); font-weight: 600; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal__cell { min-height: 92px; padding: var(--space-2); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; }
.cal__cell:nth-child(7n) { border-right: none; }
.cal__cell.is-out { background: var(--surface-2); }
.cal__daynum { font-size: var(--text-xs); font-weight: 600; color: var(--ink-muted); align-self: flex-end; }
.cal__cell.is-today .cal__daynum { background: var(--brand); color: white; border-radius: var(--r-pill); width: 22px; height: 22px; display: grid; place-items: center; }
.cal__event { font-size: 0.66rem; font-weight: 600; padding: 2px 5px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid var(--a, var(--brand)); background: color-mix(in oklch, var(--a, var(--brand)) 12%, white); color: color-mix(in oklch, var(--a, var(--brand)) 65%, black); }
.cal__event.is-hard { border-left-color: var(--danger); background: var(--danger-soft); color: var(--danger); }

.fr-list { margin-top: var(--space-5); display: flex; flex-direction: column; gap: var(--space-2); }
.fr-row { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-3) var(--space-4); border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); }
.fr-row__when { text-align: center; flex-shrink: 0; min-width: 52px; }
.fr-row__day { font-family: var(--font-display); font-size: 1.5rem; font-weight: 500; line-height: 1; }
.fr-row__mon { font-size: var(--text-xs); color: var(--ink-muted); text-transform: uppercase; }
.fr-row__body { flex: 1; min-width: 0; }
.fr-row.is-overdue { border-color: oklch(58% 0.19 22 / 0.4); }
.fr-row.is-overdue .fr-row__day { color: var(--danger); }

@media (max-width: 720px) {
  .cal__cell { min-height: 62px; }
  .cal__event { font-size: 0.55rem; }
}

/* ============ ADMIN ============ */
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.rule-card { padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); display: flex; flex-direction: column; gap: var(--space-3); }
.rule-card__head { display: flex; align-items: center; gap: var(--space-3); }
.rule-card__title { font-weight: 600; }
.rule-card__code { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--ink-muted); background: var(--surface-2); padding: 2px 7px; border-radius: var(--r-xs); margin-left: auto; }
.rule-card dl { display: grid; grid-template-columns: auto 1fr; gap: 4px var(--space-3); font-size: var(--text-sm); }
.rule-card dt { color: var(--ink-muted); }
@media (max-width: 760px) { .admin-grid { grid-template-columns: 1fr; } }
