/* CoffeeLab — Cupertino-ish UI (no frameworks) */
/* Versioned build — see index.html ?v=... */

:root{
  --bg: #0b0b0c;
  --surface: rgba(255,255,255,.06);
  --surface2: rgba(255,255,255,.10);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.62);
  --hairline: rgba(255,255,255,.12);
  --accent: #5ee6c0; /* mint */
  --danger: #ff6b6b;
  --shadow: 0 18px 50px rgba(0,0,0,.45);
  --shadow2: 0 10px 24px rgba(0,0,0,.35);
  --radius: 18px;
  --radius2: 22px;
  --tap: 44px;
}

[data-theme="light"]{
  --bg: #f6f6f7;
  --surface: rgba(255,255,255,.72);
  --surface2: rgba(255,255,255,.88);
  --text: rgba(0,0,0,.88);
  --muted: rgba(0,0,0,.55);
  --hairline: rgba(0,0,0,.10);
  --accent: #0a84ff; /* iOS blue */
  --danger: #ff3b30;
  --shadow: 0 18px 50px rgba(0,0,0,.12);
  --shadow2: 0 10px 24px rgba(0,0,0,.10);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","SF Pro Display",system-ui,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a{color:inherit;text-decoration:none}
code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--hairline);
}

.app{
  min-height:100%;
  padding-bottom: calc(78px + env(safe-area-inset-bottom));
}

/* Nav */
.nav{
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  background: rgba(0,0,0,.20);
  border-bottom: 1px solid var(--hairline);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
[data-theme="light"] .nav{ background: rgba(255,255,255,.55); }

.brand{
  display:flex;
  align-items:center;
  gap:10px;
}
.brand__mark{
  width: 32px;
  height: 32px;
  display:grid;
  place-items:center;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--hairline);
}
.brand__name{
  font-weight: 700;
  letter-spacing: .2px;
}

.nav__right{display:flex; gap: 10px;}
.iconbtn{
  width: 40px; height: 40px;
  border: 0;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--text);
  display:grid;
  place-items:center;
  box-shadow: var(--shadow2);
  cursor:pointer;
}
.iconbtn:active{ transform: scale(.98); }

/* Main */
.main{
  padding: 14px 14px 0;
  max-width: 760px;
  margin: 0 auto;
}

.h1{
  font-size: 22px;
  font-weight: 800;
  margin: 10px 2px 8px;
  letter-spacing: .2px;
}
.sub{
  margin: 0 2px 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.grid{
  display:grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 720px){
  .grid{ grid-template-columns: 1fr 1fr; }
}

/* Cards */
.card{
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius2);
  padding: 14px 14px;
  box-shadow: var(--shadow2);
}
.card--hero{
  padding: 16px 16px;
  box-shadow: var(--shadow);
}
.card__title{
  font-weight: 800;
  font-size: 15px;
  margin-bottom: 10px;
}
.kpi{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--surface2);
  border: 1px solid var(--hairline);
  color: var(--text);
  font-size: 13px;
}
.pill__dot{
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--accent);
}

.help{
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.35;
  margin-top: 10px;
}

/* Buttons */
.btn{
  min-height: 40px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--hairline);
  background: var(--accent);
  color: rgba(0,0,0,.88);
  font-weight: 800;
  cursor: pointer;
}
[data-theme="dark"] .btn{ color: rgba(0,0,0,.92); }
.btn:active{ transform: scale(.99); }
.btn--ghost{
  background: transparent;
  color: var(--text);
}

/* Row */
.row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}
.row__left{display:flex; flex-direction:column; gap:2px;}
.row__label{font-size: 13px; font-weight: 700;}
.row__value{font-size: 13px; color: var(--muted);}

/* Segmented */
.seg{
  display:flex;
  gap: 8px;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid var(--hairline);
  background: var(--surface2);
}
.seg__btn{
  flex:1;
  min-height: 36px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-weight: 800;
  cursor:pointer;
}
.seg__btn.is-active{
  background: var(--surface);
  border-color: var(--hairline);
  box-shadow: var(--shadow2);
}

/* Tab bar */
.tabbar{
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(66px + env(safe-area-inset-bottom));
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  display:flex;
  gap: 6px;
  justify-content:space-between;
  border-top: 1px solid var(--hairline);
  background: rgba(0,0,0,.25);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 30;
}
[data-theme="light"] .tabbar{ background: rgba(255,255,255,.65); }

.tab{
  width: 16.2%;
  min-width: 52px;
  border-radius: 16px;
  padding: 8px 6px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap: 4px;
  border: 1px solid transparent;
  color: var(--muted);
}
.tab__icon{ font-size: 18px; line-height: 1; }
.tab__label{ font-size: 11px; font-weight: 800; letter-spacing: .2px; }
.tab.is-active{
  color: var(--text);
  background: var(--surface);
  border-color: var(--hairline);
}

/* Toast */
.toast{
  position: fixed;
  left: 50%;
  bottom: calc(78px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(0,0,0,.75);
  color: rgba(255,255,255,.95);
  border: 1px solid rgba(255,255,255,.12);
  max-width: calc(100% - 28px);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 40;
}
[data-theme="light"] .toast{
  background: rgba(255,255,255,.86);
  color: rgba(0,0,0,.85);
  border-color: rgba(0,0,0,.10);
}
.toast.show{
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

/* Sheet */
.sheet-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 50;
}
.sheet{
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  z-index: 60;
  border-radius: 22px 22px 0 0;
  border: 1px solid var(--hairline);
  background: rgba(20,20,22,.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  max-height: calc(85vh);
  overflow:auto;
  box-shadow: var(--shadow);
}
[data-theme="light"] .sheet{
  background: rgba(255,255,255,.92);
}
.sheet__handle{
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255,255,255,.25);
  margin: 10px auto 6px;
}
[data-theme="light"] .sheet__handle{
  background: rgba(0,0,0,.12);
}
.sheet__header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 8px 14px 10px;
  border-bottom: 1px solid var(--hairline);
}
.sheet__title{
  margin: 0;
  font-size: 16px;
  font-weight: 900;
}
.sheet__content{
  padding: 14px;
  display:grid;
  gap: 12px;
}

.hidden{ display:none !important; }

/* Auth form */
.field{
  display:flex;
  flex-direction:column;
  gap: 6px;
  margin: 10px 0;
}
.input{
  height: 44px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--hairline);
  background: var(--surface2);
  color: var(--text);
  outline: none;
}
.input::placeholder{ color: var(--muted); }
.small{
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.35;
}
.badge{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--surface2);
  font-size: 13px;
  font-weight: 800;
}
.badge .dot{
  width: 8px; height: 8px;
  border-radius: 99px;
  background: var(--danger);
}
.badge .dot.ok{ background: var(--accent); }

/* Tiny animations (iOS-ish) */
@media (prefers-reduced-motion: no-preference){
  .card{ transition: transform .15s ease, box-shadow .15s ease; }
  .card:active{ transform: translateY(1px); }
}
