/* =========================================================================
   My First Company — shared polish styles
   ========================================================================= */
:root {
  --primary: #4F46E5;
  --primary-dark: #4338CA;
  --primary-50: #EEF2FF;
  --primary-100: #E0E7FF;
  --ink: #0F172A;
  --ink-soft: #334155;
  --muted: #64748B;
  --line: #E2E8F0;
  --bg: #F1F5F9;
  --card: #FFFFFF;
  --ok: #16A34A;
  --ok-50: #F0FDF4;
  --warn: #D97706;
  --warn-50: #FFFBEB;
  --danger: #DC2626;
  --danger-50: #FEF2F2;
  --shadow: 0 1px 2px rgba(15,23,42,.06), 0 4px 16px rgba(15,23,42,.06);
}

* { -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: #E2E8F0;
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Phone shell -------------------------------------------------------------- */
.phone {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 0 1px rgba(15,23,42,.04), 0 30px 60px rgba(15,23,42,.12);
  padding-bottom: 88px;
}

.page-pad { padding: 16px; }

/* App bar ------------------------------------------------------------------ */
.appbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
}
.appbar h1 { font-size: 17px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.appbar .sub { font-size: 12px; color: var(--muted); }

.brand { display:flex; align-items:center; gap:8px; font-weight:800; letter-spacing:-.02em;}
.brand .logo {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #7C3AED);
  color:#fff; display:grid; place-items:center; font-size:15px; font-weight:800;
  box-shadow: 0 2px 8px rgba(79,70,229,.35);
}

/* Cards -------------------------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.card-pad { padding: 16px; }
.card + .card { margin-top: 14px; }
.section-title { font-size: 13px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }

/* Buttons ------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 12px; font-weight: 650; font-size: 15px;
  padding: 12px 16px; cursor: pointer; transition: transform .08s ease, background .15s ease, box-shadow .15s;
  font-family: inherit;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(79,70,229,.3); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: #C7CBD9; box-shadow: none; cursor: not-allowed; }
.btn-ghost { background: var(--primary-50); color: var(--primary); }
.btn-ghost:hover { background: var(--primary-100); }
.btn-soft { background: #F1F5F9; color: var(--ink-soft); }
.btn-soft:hover { background: #E2E8F0; }
.btn-outline { background:#fff; border:1px solid var(--line); color: var(--ink-soft); }
.btn-danger { background: var(--danger-50); color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.linkbtn { background:none; border:none; color: var(--primary); font-weight:600; cursor:pointer; font-size:14px; font-family:inherit; padding:0; }

/* Forms -------------------------------------------------------------------- */
.field { margin-bottom: 16px; }
.label { display:block; font-size: 13px; font-weight: 650; color: var(--ink-soft); margin-bottom: 6px; }
.input, .textarea, select.input {
  width: 100%; box-sizing: border-box; border: 1.5px solid var(--line);
  border-radius: 12px; padding: 12px 14px; font-size: 15px; font-family: inherit;
  background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, select.input:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.15);
}
.textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.helper { font-size: 12px; color: var(--muted); margin-top: 6px; }
.error-text { font-size: 12px; color: var(--danger); margin-top: 6px; }

/* Pills -------------------------------------------------------------------- */
.pill {
  display:inline-flex; align-items:center; gap:6px; border:1.5px solid var(--line);
  background:#fff; color: var(--ink-soft); border-radius: 999px; padding: 10px 14px;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all .15s;
}
.pill:hover { border-color: #C7CBD9; }
.pill.selected { border-color: var(--primary); background: var(--primary-50); color: var(--primary); }
.chip {
  display:inline-flex; align-items:center; gap:5px; border-radius: 999px;
  padding: 3px 10px; font-size: 12px; font-weight: 650;
}
.chip-primary { background: var(--primary-50); color: var(--primary); }
.chip-ok { background: var(--ok-50); color: var(--ok); }
.chip-warn { background: var(--warn-50); color: var(--warn); }
.chip-danger { background: var(--danger-50); color: var(--danger); }
.chip-muted { background: #F1F5F9; color: var(--muted); }

/* Progress ----------------------------------------------------------------- */
.bar { height: 8px; background: #E2E8F0; border-radius: 999px; overflow: hidden; }
.bar > span { display:block; height: 100%; background: linear-gradient(90deg, var(--primary), #7C3AED); border-radius: 999px; transition: width .5s ease; }

/* Stage tracker ------------------------------------------------------------ */
.stages { display:flex; align-items:center; gap:4px; }
.stage-dot { flex:1; text-align:center; font-size:10.5px; font-weight:650; color: var(--muted); }
.stage-dot .dot {
  width: 26px; height: 26px; border-radius: 50%; margin: 0 auto 4px;
  display:grid; place-items:center; background:#E2E8F0; color: var(--muted); font-size:12px; font-weight:700;
}
.stage-dot.done .dot { background: var(--ok); color:#fff; }
.stage-dot.current .dot { background: var(--primary); color:#fff; box-shadow: 0 0 0 4px var(--primary-100); }
.stage-dot.current { color: var(--primary); }

/* Tab bar ------------------------------------------------------------------ */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px; z-index: 40;
  background: rgba(255,255,255,.92); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
.tab { display:flex; flex-direction:column; align-items:center; gap:3px; text-decoration:none; color: var(--muted); font-size: 10.5px; font-weight: 600; padding: 4px 0; }
.tab svg { width: 22px; height: 22px; }
.tab-active { color: var(--primary); }

/* Toast -------------------------------------------------------------------- */
.toast-host { position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%); z-index: 60; display:flex; flex-direction:column; gap:8px; width: 90%; max-width: 400px; }
.toast { padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; color:#fff; box-shadow: 0 8px 24px rgba(15,23,42,.2); opacity:0; transform: translateY(10px); transition: all .3s; }
.toast.show { opacity:1; transform: translateY(0); }
.toast-ok { background: var(--ink); }
.toast-error { background: var(--danger); }

/* Sheets / modals ---------------------------------------------------------- */
.scrim { position: fixed; inset:0; background: rgba(15,23,42,.45); z-index: 50; opacity:0; transition: opacity .2s; }
.scrim.show { opacity:1; }
.sheet {
  position: fixed; left:50%; bottom:0; transform: translate(-50%, 100%);
  width:100%; max-width:430px; background:#fff; z-index: 51;
  border-radius: 20px 20px 0 0; box-shadow: 0 -8px 40px rgba(15,23,42,.25);
  transition: transform .28s cubic-bezier(.2,.8,.2,1); max-height: 90vh; overflow-y:auto;
}
.sheet.show { transform: translate(-50%, 0); }
.sheet-grab { width: 40px; height: 4px; background: #CBD5E1; border-radius: 999px; margin: 10px auto 4px; }
.sheet-full {
  position: fixed; inset:0; left:50%; transform: translate(-50%, 100%);
  width:100%; max-width:430px; background: var(--bg); z-index: 51;
  transition: transform .28s cubic-bezier(.2,.8,.2,1); overflow-y:auto;
}
.sheet-full.show { transform: translate(-50%, 0); }

/* Skeleton ----------------------------------------------------------------- */
.skel { background: linear-gradient(90deg,#EEF2F6 25%,#E2E8F0 37%,#EEF2F6 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* Misc --------------------------------------------------------------------- */
.spinner { width:18px; height:18px; border:2.5px solid rgba(255,255,255,.4); border-top-color:#fff; border-radius:50%; animation: spin .7s linear infinite; }
.spinner-dark { border-color: rgba(79,70,229,.25); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }
.muted { color: var(--muted); }
.row { display:flex; align-items:center; }
.between { justify-content: space-between; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; }
.divider { height:1px; background: var(--line); margin: 14px 0; }
.icon-tile { width:44px; height:44px; border-radius: 12px; display:grid; place-items:center; background: var(--primary-50); color: var(--primary); font-size:20px; }
.fade-in { animation: fadein .4s ease; }
@keyframes fadein { from { opacity:0; transform: translateY(6px);} to {opacity:1; transform:none;} }
.shake { animation: shake .4s; }
@keyframes shake { 0%,100%{transform:translateX(0);} 20%,60%{transform:translateX(-5px);} 40%,80%{transform:translateX(5px);} }
a { color: var(--primary); }
.back-btn { background:none;border:none;cursor:pointer;color:var(--ink-soft);padding:4px;display:grid;place-items:center; }
.swipe-wrap { position:relative; overflow:hidden; border-radius:12px; }
.strike { text-decoration: line-through; color: var(--muted); }
