/* casa: a native-iPhone look. Grouped lists, large titles, one tint. */
:root {
  --bg: #F2F2F7;
  --card: #FFFFFF;
  --ink: #1C1C1E;
  --muted: #6C6C70;
  --faint: #8E8E93;
  --line: #D1D1D6;
  --fill: #E5E5EA;
  --tint: #0A64D6;
  --tint-soft: rgba(10, 100, 214, 0.1);
  --on-tint: #FFFFFF;
  --danger: #D70015;
  --ok: #248A3D;
  --bar: rgba(249, 249, 249, 0.94);
  --bar-line: #C6C6C8;
  color-scheme: light dark;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1C1C1E;
    --ink: #FFFFFF;
    --muted: #AEAEB2;
    --faint: #8E8E93;
    --line: #38383A;
    --fill: #2C2C2E;
    --tint: #4CA0FF;
    --tint-soft: rgba(76, 160, 255, 0.16);
    --on-tint: #000000;
    --danger: #FF6961;
    --ok: #30D158;
    --bar: rgba(22, 22, 24, 0.92);
    --bar-line: #38383A;
  }
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.3;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) calc(96px + env(safe-area-inset-bottom)) env(safe-area-inset-left);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--tint); }
main { max-width: 600px; margin: 0 auto; padding: 0 16px; display: flex; flex-direction: column; gap: 8px; }
.child { display: flex; flex-direction: column; gap: 20px; }

/* Large title header */
.title-bar { max-width: 600px; margin: 0 auto; padding: 18px 20px 8px; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.title-bar h1 { margin: 0; font-size: 34px; font-weight: 700; letter-spacing: -0.4px; line-height: 1.1; overflow-wrap: anywhere; }
.title-bar .who { color: var(--muted); font-size: 15px; white-space: nowrap; }
.back { display: inline-flex; align-items: center; gap: 2px; color: var(--tint); text-decoration: none; font-size: 17px; padding: 10px 0 0 12px; max-width: 600px; margin: 0 auto; width: 100%; }
.back-wrap { max-width: 600px; margin: 0 auto; padding: 8px 8px 0; }

/* Groups */
.section-label { margin: 18px 4px 0; font-size: 13px; text-transform: uppercase; letter-spacing: 0.2px; color: var(--muted); font-weight: 400; }
.section-label:first-child { margin-top: 4px; }
.section-note { margin: 0 4px; font-size: 13px; color: var(--muted); }
.group { background: var(--card); border-radius: 14px; overflow: hidden; }
.group.padded { padding: 18px 16px 16px; display: flex; flex-direction: column; gap: 14px; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 48px; padding: 0 16px; margin: 0;
  background: none; border: 0; border-radius: 0; color: var(--ink);
  font: inherit; font-size: 17px; text-align: left; text-decoration: none;
  position: relative; cursor: pointer;
}
.row + .row::before, .row + details::before, details + .row::before {
  content: ""; position: absolute; top: 0; right: 0; left: 16px; border-top: 0.5px solid var(--line);
}
.row.has-icon + .row.has-icon::before { left: 60px; }
.row:active { background: var(--fill); }
.row .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .value { color: var(--muted); font-size: 15px; }
.row .chevron { color: var(--faint); font-size: 22px; line-height: 1; }
.row.tinted { color: var(--tint); }
.row.danger { color: var(--danger); }
.row:disabled { opacity: 0.4; }
.icon-tile { width: 32px; height: 32px; border-radius: 8px; background: var(--tint); display: flex; align-items: center; justify-content: center; flex: none; }
.icon-tile svg { stroke: #FFFFFF; }
details { position: relative; }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary .chevron { transform: rotate(90deg); }
.disclosure { padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 10px; }

/* Screen time card */
.big { margin: 0; font-size: 34px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 15px; }
.status.locked .big { color: var(--danger); }
.status.offline .big { color: var(--muted); font-size: 24px; }
.meter { height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; }
.meter > span { display: block; height: 100%; width: 0; background: var(--tint); transition: width 0.4s ease; }
.status.locked + .meter > span { background: var(--danger); }
.quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pill {
  height: 50px; border: 0; border-radius: 12px; font: inherit; font-size: 17px; font-weight: 600;
  background: var(--tint-soft); color: var(--tint); cursor: pointer; touch-action: manipulation;
}
.pill.solid { background: var(--tint); color: var(--on-tint); }
.pill:active { opacity: 0.6; }
.pill:disabled { opacity: 0.4; }
.stepper { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; }
.field {
  height: 50px; border: 0; border-radius: 12px; background: var(--fill); color: var(--ink);
  font: inherit; font-size: 17px; padding: 0 14px; width: 100%; min-width: 0;
}
.stepper .pill { padding: 0 16px; }
.error { color: var(--danger); font-size: 15px; margin: 4px 4px 0; }
.toast { color: var(--ok); font-size: 15px; margin: 4px 4px 0; }

/* Big buttons */
.primary-button {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  height: 52px; border: 0; border-radius: 14px; background: var(--tint); color: var(--on-tint);
  font: inherit; font-size: 17px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.primary-button:active { opacity: 0.7; }
.primary-button svg { stroke: currentColor; }

/* Photos */
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; border-radius: 14px; overflow: hidden; }
.photo-grid a { display: block; aspect-ratio: 1; background: var(--fill); }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
progress { width: 100%; height: 6px; accent-color: var(--tint); }

/* History */
.event { flex-direction: column; align-items: stretch; gap: 2px; padding-top: 10px; padding-bottom: 10px; cursor: default; }
.event:active { background: none; }
.event .line { display: flex; justify-content: space-between; gap: 12px; }
.event .what { flex: 1; min-width: 0; }
.event time, .event .who-did { color: var(--muted); font-size: 15px; }
.event.failed .what { color: var(--danger); }

/* Sign-in */
.welcome { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 0 8px; }
.app-icon { width: 84px; height: 84px; border-radius: 19px; box-shadow: 0 2px 10px rgba(0,0,0,0.12); }
.welcome h1 { margin: 6px 0 0; font-size: 28px; font-weight: 700; }
.welcome p { margin: 0 0 10px; color: var(--muted); }
.welcome .group { width: 100%; text-align: left; }
.invite-link { word-break: break-all; font-size: 15px; color: var(--muted); padding: 0 16px 14px; margin: 0; }
.avatar { width: 32px; height: 32px; border-radius: 16px; background: var(--fill); color: var(--muted); display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; flex: none; }

/* Tab bar */
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  background: var(--bar); border-top: 0.5px solid var(--bar-line);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 2px 0; color: var(--faint); text-decoration: none; font-size: 10px; font-weight: 500; }
.tabs a svg { stroke: currentColor; }
.tabs a[aria-current="page"] { color: var(--tint); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Rows with a link and an action */
.file-link { color: var(--ink); text-decoration: none; }
.row-action { height: 32px; border: 0; background: none; color: var(--danger); font: inherit; font-size: 15px; padding: 0 4px; cursor: pointer; }
.two-line { white-space: normal; }
.two-line > span { display: block; }
.passkey-row { padding-top: 8px; padding-bottom: 8px; }
.device-input { flex: 1; min-width: 0; border: 0; background: none; color: inherit; font: inherit; text-align: right; }
.upload-form { display: flex; flex-direction: column; gap: 8px; }
.empty { margin-top: 12px; }
.tabs.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.primary-button.secondary { background: var(--tint-soft); color: var(--tint); }
