/* MacLife iCloud Portal — brand tokens extracted from www.maclife.pl (light only).
   --primary-strong is a Derived darker step of the brand hue for AA text contrast. */
:root {
  --background: oklch(0.9791 0 0);
  --foreground: oklch(0.2621 0.0095 248.19);
  --muted: oklch(0.45 0.01 248);
  --primary: oklch(0.708 0.1489 234.36);
  --primary-strong: oklch(0.55 0.1489 234.36);
  --primary-foreground: oklch(1 0 0);
  --primary-tint: oklch(0.708 0.1489 234.36 / 0.12);
  --border: oklch(0.7133 0.14 232.8 / 0.6);
  --hairline: oklch(0.2621 0.0095 248.19 / 0.12);
  --surface: oklch(1 0 0);
  --danger: oklch(0.55 0.19 27);
  --danger-tint: oklch(0.55 0.19 27 / 0.1);
  --success: oklch(0.55 0.13 155);
  --success-tint: oklch(0.55 0.13 155 / 0.12);
  --font-sans: Barlow, sans-serif;
  --radius-button: 100px;
  --radius-input: 14px;
  --radius-card: 16px;
  --shadow-card: 0 1px 2px oklch(0 0 0 / 0.05), 0 8px 24px oklch(0.2621 0.0095 248.19 / 0.06);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
}

h1 { font-size: 22px; font-weight: 700; margin: 0 0 8px; }
h2 { font-size: 17px; font-weight: 600; margin: 0 0 12px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); font-size: 14px; }
.brand { font-weight: 700; font-size: 16px; margin: 0; }
.brand-sep { color: var(--primary); }

/* layout */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; }
.shell { max-width: 1120px; margin: 0 auto; padding: 24px 24px 64px; }
.view[hidden] { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
}
.topnav { display: flex; gap: 8px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.userchip {
  font-size: 13px; font-weight: 600;
  background: var(--primary-tint); color: var(--primary-strong);
  padding: 4px 12px; border-radius: 100px;
}
.navlink {
  border: 0; background: transparent; cursor: pointer;
  font: 500 14px var(--font-sans); color: var(--muted);
  padding: 6px 12px; border-radius: 100px;
}
.navlink[aria-current="page"] { background: var(--primary-tint); color: var(--primary-strong); }

.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 24px;
}
.connect-card { max-width: 520px; margin: 40px auto 0; }

/* forms */
label { display: block; font-size: 13px; font-weight: 600; margin: 16px 0 6px; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], select {
  width: 100%;
  font: 400 15px var(--font-sans);
  color: var(--foreground);
  background: oklch(1 0 0 / 0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 10px 14px;
}
input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 3px solid oklch(0.708 0.1489 234.36 / 0.45);
  outline-offset: 1px;
}
.step[hidden] { display: none; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 14px var(--font-sans);
  border: 0; border-radius: var(--radius-button);
  padding: 9px 20px; cursor: pointer;
  transition: filter 120ms ease;
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--primary-strong); color: var(--primary-foreground); }
.btn-secondary { background: var(--primary-tint); color: var(--primary-strong); }
.btn-ghost { background: transparent; color: var(--primary-strong); padding: 9px 14px; }
.btn-danger { background: var(--danger); color: oklch(1 0 0); }
.btn-block { width: 100%; margin-top: 20px; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-row { display: flex; gap: 12px; align-items: center; margin-top: 16px; flex-wrap: wrap; }

/* alerts */
.alert { border-radius: 12px; padding: 12px 16px; font-size: 14px; margin: 16px 0 0; }
.alert[hidden] { display: none; }
.alert-error { background: var(--danger-tint); color: var(--danger); font-weight: 500; }
.alert-success { background: var(--success-tint); color: var(--success); font-weight: 500; }
.alert-info { background: var(--primary-tint); color: var(--primary-strong); }

/* client bar */
.clientbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.clientbar-label { font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 2px; }
.clientbar-id { font-size: 17px; font-weight: 600; margin: 0; }
.clientbar-meta { display: flex; align-items: center; gap: 16px; }
.badge {
  font-size: 13px; font-weight: 600;
  background: var(--primary-tint); color: var(--primary-strong);
  padding: 4px 12px; border-radius: 100px;
}
.badge-ok { background: var(--success-tint); color: var(--success); }

.index-card { margin-bottom: 24px; }

/* workspace */
.workspace-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 860px) { .workspace-grid { grid-template-columns: 1fr; } }

.scope-modes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.radio-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; margin: 0;
  padding: 6px 14px; border-radius: 100px;
  border: 1px solid var(--hairline); cursor: pointer;
  background: var(--surface);
}
.radio-pill:has(input:checked) { background: var(--primary-tint); border-color: transparent; color: var(--primary-strong); }
.radio-pill input { accent-color: var(--primary-strong); margin: 0; }
.scope-panel[hidden] { display: none; }
.bignum { font-size: 20px; font-weight: 700; }
.scope-tools { margin: 0 0 8px; }

.month-list { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow-y: auto; }
.month-list li { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; }
.month-list li:hover { background: oklch(0.2621 0.0095 248.19 / 0.04); }
.month-list label { display: flex; align-items: center; gap: 10px; margin: 0; font-weight: 500; font-size: 14px; flex: 1; cursor: pointer; }
.month-list input { accent-color: var(--primary-strong); width: 16px; height: 16px; }
.month-meta { color: var(--muted); font-size: 13px; white-space: nowrap; }

.range-row { display: flex; gap: 16px; }
.range-row > div { flex: 1; }

/* progress */
progress { width: 100%; height: 10px; accent-color: var(--primary-strong); margin-top: 16px; }
.dl-stats { font-weight: 600; margin: 8px 0 0; }
.dl-current { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* audit */
.table-wrap { overflow-x: auto; }
.audit-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.audit-table th { text-align: left; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
.audit-table td { padding: 8px 10px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.audit-table td:last-child { color: var(--muted); max-width: 340px; overflow: hidden; text-overflow: ellipsis; }

/* dialog */
dialog {
  border: 0; border-radius: var(--radius-card);
  box-shadow: 0 24px 80px oklch(0 0 0 / 0.28);
  padding: 24px; max-width: 420px; width: calc(100% - 48px);
}
dialog::backdrop { background: oklch(0 0 0 / 0.3); backdrop-filter: blur(2px); }