
:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --text: #1c1c1e;
  --label: #1c1c1e;
  --secondary: #8e8e93;
  --tertiary: #c7c7cc;
  --fill: #e5e5ea;
  --fill-2: #d1d1d6;
  --sep: rgba(60, 60, 67, .29);
  --blue: #007aff;
  --green: #34c759;
  --red: #ff3b30;
  --mint: #00c7be;
  --nav: rgba(242, 242, 247, .86);
  --tab: rgba(255, 255, 255, .86);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--label);
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Helvetica Neue", "Segoe UI", sans-serif;
  letter-spacing: 0;
  font-size: 17px;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
input::placeholder { color: var(--tertiary); }
.is-hidden { display: none !important; }

.phone {
  min-height: 100vh;
  max-width: 430px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
}

.app-icon {
  width: 76px; height: 76px;
  border-radius: 22%;
  display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(180deg, #64b5ff 0%, #007aff 58%, #0063d1 100%);
  box-shadow: 0 10px 24px rgba(0, 122, 255, .28), inset 0 1px 0 rgba(255,255,255,.35);
}
.app-icon svg {
  width: 36px; height: 36px; fill: none; stroke: #fff; stroke-width: 2.4;
  stroke-linecap: round; stroke-linejoin: round;
}

.intro {
  position: absolute; inset: 0; z-index: 30;
  display: grid; place-items: center; align-content: center; gap: 12px;
  background: var(--bg);
  animation: introOut .45s ease 1.25s forwards;
  text-align: center;
}
.intro h1, .auth-hero h1 {
  margin: 8px 0 0;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: .2px;
}
.intro p, .auth-hero p { margin: 4px 0 0; color: var(--secondary); font-size: 15px; }
.intro .app-icon { animation: iconIn .6s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes iconIn { from { transform: scale(.72); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes introOut { to { opacity: 0; visibility: hidden; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.app { min-height: 100vh; }
.app.ready .auth-view, .app.ready .shell { animation: rise .42s cubic-bezier(.2,.8,.2,1) both; }

.auth-view { padding: 72px 16px 40px; }
.auth-hero { text-align: center; margin-bottom: 28px; }
.auth-hero .app-icon { margin: 0 auto 4px; }
.segmented {
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--fill);
  padding: 2px; border-radius: 9px;
  margin: 0 0 16px;
}
.tab {
  min-height: 28px; border-radius: 7px; color: var(--label);
  font-size: 13px; font-weight: 600;
}
.tab.is-on {
  background: var(--card);
  box-shadow: 0 1px 1px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.06);
}

.ios-group {
  background: var(--card);
  border-radius: 10px;
  overflow: hidden;
}
.field, .cell {
  display: flex; align-items: center; gap: 12px;
  min-height: 44px;
  padding: 10px 16px;
  width: 100%;
  text-align: left;
  background: var(--card);
  position: relative;
}
.cell + .cell,
.field + .field {
  box-shadow: inset 0 0.5px 0 0 var(--sep);
}
.field { display: grid; grid-template-columns: 72px 1fr; }
.field span, .cell-title { font-size: 17px; color: var(--label); }
.field input, .time-input {
  border: 0; outline: 0; background: transparent; min-width: 0; width: 100%;
  text-align: right; font-size: 17px;
}
.cell:active { background: #d1d1d6; }
.cell.danger {
  justify-content: center; color: var(--red); font-weight: 400;
}
.glyph {
  width: 29px; height: 29px; border-radius: 7px;
  display: grid; place-items: center; color: #fff; flex: 0 0 29px;
}
.glyph svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.glyph.blue { background: var(--blue); }
.glyph.green { background: var(--green); }
.glyph.gray { background: #8e8e93; }
.glyph.red { background: var(--red); }
.chevron {
  width: 8px; height: 8px; margin-left: auto;
  border-right: 2px solid #c7c7cc; border-top: 2px solid #c7c7cc;
  transform: rotate(45deg);
}
.trailing { color: var(--secondary); font-size: 17px; margin-left: auto; }

.ios-btn {
  margin-top: 18px; width: 100%; min-height: 50px; border-radius: 12px;
  background: var(--blue); color: #fff; font-size: 17px; font-weight: 600;
}
.ios-btn:active { filter: brightness(.94); }
.link-btn { color: var(--blue); font-size: 17px; min-height: 44px; padding: 0 4px; }
.link-btn.strong { font-weight: 600; }
.link-btn.red { color: var(--red); }

.ios-switch {
  appearance: none; width: 51px; height: 31px; border-radius: 16px;
  background: #e9e9eb; position: relative; flex: 0 0 51px; margin-left: auto;
  transition: background .2s ease;
}
.ios-switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 3px 8px rgba(0,0,0,.15);
  transition: left .2s ease;
}
.ios-switch:checked { background: var(--green); }
.ios-switch:checked::after { left: 22px; }
.time-input { color: var(--blue); margin-left: auto; width: auto; }

.shell { min-height: 100vh; padding-bottom: 88px; }
.nav {
  position: sticky; top: 0; z-index: 8;
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 8px 16px 8px;
  min-height: 96px;
  background: var(--nav);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.nav h1 { margin: 0; font-size: 34px; line-height: 1.15; font-weight: 700; }
.nav-actions { display: flex; align-items: center; gap: 4px; padding-bottom: 4px; }
.plus-btn {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--fill); color: var(--blue);
  display: grid; place-items: center; font-size: 22px; line-height: 1;
}

.pages { padding: 8px 16px 24px; }
.page { animation: rise .28s ease; }
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin: 4px 0 16px;
}
.metric {
  background: var(--card); border-radius: 12px; padding: 12px 4px 10px;
  text-align: center;
}
.metric b { display: block; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.metric span { color: var(--secondary); font-size: 11px; font-weight: 500; }
.metric.ok b { color: var(--green); }
.metric.bad b { color: var(--red); }
.section-label {
  margin: 22px 16px 8px;
  color: var(--secondary);
  font-size: 13px;
}
.pages .section-label { margin-left: 16px; }
.foot {
  margin: 8px 16px 0;
  color: var(--secondary);
  font-size: 13px;
  line-height: 1.38;
}
.empty {
  text-align: center; color: var(--secondary); padding: 48px 16px;
}
.empty p { margin: 8px 0 4px; color: var(--label); font-weight: 600; }
.empty small { font-size: 13px; }
.empty-icon {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto;
  background: var(--fill); color: var(--secondary);
  display: grid; place-items: center;
}
.empty-icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 16px; flex: 0 0 40px;
}
.avatar.xl { width: 60px; height: 60px; font-size: 24px; flex-basis: 60px; }
.profile { display: flex; align-items: center; gap: 14px; padding: 16px; }
.profile b { display: block; font-size: 22px; font-weight: 700; }
.profile small { color: var(--secondary); font-size: 13px; }

.account-main { display: grid; gap: 1px; min-width: 0; flex: 1; }
.account-main b { font-size: 17px; font-weight: 600; }
.account-main small {
  color: var(--secondary); font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.value { font-size: 15px; margin-left: auto; }
.value.ok { color: var(--green); }
.value.bad { color: var(--red); }
.value.wait { color: var(--secondary); }
.check {
  width: 22px; height: 22px; border-radius: 11px;
  border: 1.5px solid var(--fill-2); flex: 0 0 22px; position: relative;
}
.cell.selected .check {
  background: var(--blue); border-color: var(--blue);
}
.cell.selected .check::after {
  content: ""; position: absolute; left: 6px; top: 3px;
  width: 6px; height: 11px;
  border-right: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(45deg);
}

.day-head {
  margin: 20px 16px 8px;
  color: var(--label);
  font-size: 20px;
  font-weight: 700;
}
.log-row { align-items: flex-start; }
.log-row .msg { flex: 1; min-width: 0; }
.log-row .msg b { display: block; font-size: 15px; font-weight: 400; line-height: 1.35; }
.log-row .msg small { color: var(--secondary); font-size: 12px; }
.log-row.fail .msg b { color: var(--red); }
.day-actions { display: flex; justify-content: flex-end; margin: 4px 4px 0; }

.tabbar {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(430px, 100%);
  height: 84px; padding: 6px 8px 24px;
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--tab);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: inset 0 0.5px 0 var(--sep);
}
.tab-item {
  display: grid; justify-items: center; align-content: start; gap: 3px;
  color: var(--secondary); font-size: 10px; font-weight: 500; padding-top: 4px;
}
.tab-item svg {
  width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.tab-item.is-on { color: var(--blue); }
.tab-item.is-on svg { stroke-width: 2.2; }

.sheet {
  position: fixed; top: 0; bottom: 0; left: 50%; z-index: 40;
  width: min(430px, 100%);
  transform: translateX(-50%);
  background: rgba(0, 0, 0, .18);
  display: grid; align-items: end;
  animation: fade .2s ease;
}
.sheet-panel {
  background: var(--bg);
  border-radius: 12px 12px 0 0;
  padding: 0 0 28px;
  animation: sheetUp .34s cubic-bezier(.32,.72,0,1);
}
.sheet-nav {
  display: grid; grid-template-columns: 64px 1fr 64px;
  align-items: center;
  min-height: 56px; padding: 4px 8px;
}
.sheet-nav h3 { margin: 0; text-align: center; font-size: 17px; font-weight: 600; }
.sheet-panel .ios-group, .sheet-panel .foot, .sheet-panel .error { margin: 0 16px; }
.sheet-panel .foot { margin-top: 8px; margin-bottom: 16px; }
.sheet-panel .error { margin-top: 10px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(18%); } to { transform: none; } }

.error { min-height: 18px; color: var(--red); font-size: 13px; margin: 8px 4px 0; }
.toast {
  position: fixed; left: 50%; bottom: 108px; transform: translate(-50%, 8px);
  background: rgba(255,255,255,.94);
  color: var(--label);
  padding: 12px 18px; border-radius: 14px; opacity: 0;
  pointer-events: none; transition: .22s ease; z-index: 50;
  box-shadow: 0 8px 28px rgba(0,0,0,.12);
  backdrop-filter: blur(16px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 860px) {
  html, body { background: #e5e5ea; }
  .phone {
    min-height: 100vh;
    box-shadow: 0 0 0 .5px rgba(60,60,67,.18), 0 18px 50px rgba(60,60,67,.12);
  }
}
