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

/* Variabili palette iOS / Scelgo Io */
:root {
  --bg:            #F9F5F0;   /* paperBackground */
  --surface:       #FFFFFF;
  --border:        #E0D8CE;
  --ink-primary:   #2C2C2E;
  --ink-secondary: #8E8E93;
  --accent:        #D97941;
  --accent-on:     #FFFFFF;
  --separator:     rgba(60,60,67,0.12);

  /* Pastelli card */
  --rosa-cipria:   #F4D7D7;
  --blu-polvere:   #C8D8E8;
  --giallo:        #F5EBC8;
  --lilla:         #DDD0EE;
  --verde-salvia:  #C8DDD0;
  --azzurrino:     #C8E0F0;
  --pesca:         #F5D8C0;
  --menta:         #C8EDE0;

  /* Tipografia */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
          "Helvetica Neue", Arial, sans-serif;
  --font-size-base: 17px;
  --font-size-sm:   13px;
  --font-size-caption: 12px;
  --font-size-lg:   22px;
  --font-size-title: 28px;
  --font-size-large-title: 34px;
}

/* ── Device frame ── */
body {
  background: #1C1C1E;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 32px 16px;
  font-family: var(--font);
}

.device-frame {
  width: 393px;          /* iPhone 15/16 logical width */
  min-height: 852px;     /* iPhone 15/16 logical height */
  background: var(--bg);
  border-radius: 50px;
  overflow: hidden;
  position: relative;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.08),
    0 30px 80px rgba(0,0,0,0.7),
    inset 0 0 0 2px #3A3A3C;
}

/* Dynamic island */
.device-frame::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 126px;
  height: 34px;
  background: #1C1C1E;
  border-radius: 20px;
  z-index: 100;
}

/* ── Status bar ── */
.status-bar {
  height: 59px;          /* safe area top iPhone 15 */
  padding: 16px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-primary);
  background: var(--bg);
  position: relative;
  z-index: 10;
}
.status-bar .time { font-variant-numeric: tabular-nums; }
.status-bar .icons { display: flex; gap: 6px; align-items: center; font-size: 13px; }

/* ── Nav bar ── */
.nav-bar {
  height: 44px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  border-bottom: 0.5px solid var(--separator);
}
.nav-bar .title {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink-primary);
  text-align: center;
  flex: 1;
}
.nav-bar .nav-btn {
  font-size: 17px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 4px;
  min-width: 44px;
}
.nav-bar .nav-btn.right { text-align: right; }
.nav-bar .nav-btn.left  { text-align: left; }

/* ── Scroll content ── */
.screen-content {
  overflow-y: auto;
  padding-bottom: 84px; /* spazio tab bar */
}

/* ── Tab bar ── */
.tab-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 83px;          /* safe area bottom iPhone 15 */
  padding-top: 8px;
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  background: rgba(249,245,240,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 0.5px solid var(--separator);
}
.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--ink-secondary);
  flex: 1;
  cursor: pointer;
}
.tab-item.active { color: var(--accent); }
.tab-item .icon { font-size: 24px; }

/* ── Lista generica ── */
.list {
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  margin: 0 16px 24px;
}
.list-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  font-size: var(--font-size-base);
  color: var(--ink-primary);
  border-bottom: 0.5px solid var(--separator);
  gap: 12px;
}
.list-row:last-child { border-bottom: none; }
.list-row .label { flex: 1; }
.list-row .chevron { color: var(--ink-secondary); font-size: 14px; }

/* ── Griglia card 3 colonne (home Scelgo Io) ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 0 16px 16px;
}
.card {
  aspect-ratio: 1;
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 0.5px solid var(--border);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.card .card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-primary);
  line-height: 1.3;
  flex: 1;
}
.card .card-footer {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--ink-secondary);
  margin-top: auto;
}
.card .card-icon {
  position: absolute;
  bottom: 10px;
  right: 10px;
  font-size: 16px;
  opacity: 0.4;
}

/* ── Dot urgenza ── */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot.medium { background: #FF9500; }
.dot.high   { background: #FF3B30; }

/* ── Header schermata ── */
.screen-header {
  padding: 16px 16px 12px;
  font-size: var(--font-size-large-title);
  font-weight: 700;
  color: var(--ink-primary);
  line-height: 1.2;
}
.screen-header.small {
  font-size: var(--font-size-lg);
  font-weight: 700;
}

/* ── Bottone capsule ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 100px;
  font-family: var(--font);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  border: none;
}
.btn-primary  { background: var(--accent); color: var(--accent-on); }
.btn-surface  { background: var(--surface); color: var(--ink-primary); border: 0.5px solid var(--border); }
.btn-full     { width: 100%; }

/* ── Segmented control ── */
.segmented {
  display: flex;
  background: rgba(120,120,128,0.12);
  border-radius: 9px;
  padding: 2px;
  margin: 8px 16px;
}
.segmented .seg {
  flex: 1;
  text-align: center;
  padding: 6px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-secondary);
  border-radius: 7px;
  cursor: pointer;
}
.segmented .seg.active {
  background: var(--surface);
  color: var(--ink-primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

/* ── Sheet modal ── */
.sheet-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 50;
  display: flex;
  align-items: flex-end;
}
.sheet {
  width: 100%;
  background: var(--bg);
  border-radius: 12px 12px 0 0;
  padding: 12px 20px 40px;
}
.sheet-handle {
  width: 36px;
  height: 5px;
  background: rgba(60,60,67,0.18);
  border-radius: 3px;
  margin: 0 auto 16px;
}
