/* Ki-Ela — styles */
:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #eef2ff;
  --green: #10b981;
  --green-light: #d1fae5;
  --red: #ef4444;
  --red-light: #fee2e2;
  --amber: #f59e0b;
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 14px rgba(15, 23, 42, .06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; gap: 10px;
}
.topbar .brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 19px; color: var(--text); }
.topbar .brand img { width: 34px; height: 34px; border-radius: 9px; }
.topbar .actions { display: flex; gap: 8px; align-items: center; }
.container { max-width: 760px; margin: 0 auto; padding: 18px 16px 90px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 18px; border-radius: 11px; font-size: 15px; font-weight: 600;
  background: var(--primary); color: #fff; transition: .15s; border: 1px solid transparent;
}
.btn:hover { background: var(--primary-dark); }
.btn.secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: var(--primary-light); }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn.danger { background: var(--red-light); color: #b91c1c; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px;
}
.card.clickable { cursor: pointer; transition: .15s; }
.card.clickable:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(15,23,42,.1); }
.card h3 { font-size: 17px; margin-bottom: 2px; }
.card .meta { color: var(--muted); font-size: 13.5px; }
.page-title { font-size: 24px; font-weight: 800; margin: 6px 0 4px; }
.page-sub { color: var(--muted); margin-bottom: 18px; font-size: 14.5px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin: 20px 0 12px; }
.section-head h2 { font-size: 18px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 5px; color: #334155; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px; border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 15px; font-family: inherit; background: #fff; color: var(--text);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--primary); }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 14.5px; margin-bottom: 8px; }
.checkbox-row input { width: 18px; height: 18px; accent-color: var(--primary); }
.roll-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 14px; background: #fff; border-radius: 12px; margin-bottom: 9px;
  box-shadow: var(--shadow); flex-wrap: wrap;
}
.roll-row .name { font-weight: 600; font-size: 15.5px; }
.roll-row .sub { font-size: 12.5px; color: var(--muted); }
.roll-row .self-hint { font-size: 12px; padding: 2px 8px; border-radius: 20px; display: inline-block; margin-top: 2px; }
.self-hint.present { background: var(--green-light); color: #047857; }
.self-hint.absent { background: var(--red-light); color: #b91c1c; }
.roll-btns { display: flex; gap: 8px; }
.pa-btn {
  padding: 9px 15px; border-radius: 10px; font-weight: 700; font-size: 14px;
  border: 1.5px solid var(--border); background: #fff; color: var(--muted); transition: .12s;
}
.pa-btn.present.active { background: var(--green); border-color: var(--green); color: #fff; }
.pa-btn.absent.active { background: var(--red); border-color: var(--red); color: #fff; }
.pa-btn.present:not(.active):hover { background: var(--green-light); }
.pa-btn.absent:not(.active):hover { background: var(--red-light); }
.stat-bar-bg { background: var(--border); border-radius: 20px; height: 9px; overflow: hidden; flex: 1; }
.stat-bar { background: var(--green); height: 100%; border-radius: 20px; }
.stat-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.stat-row:last-child { border-bottom: none; }
.stat-row .name { min-width: 140px; font-weight: 600; font-size: 14.5px; }
.stat-row .pct { min-width: 46px; text-align: right; font-weight: 700; font-size: 14px; }
.pills { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.pill {
  padding: 7px 14px; border-radius: 20px; font-size: 13.5px; font-weight: 600;
  background: #fff; border: 1.5px solid var(--border); color: var(--muted);
}
.pill.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge.green { background: var(--green-light); color: #047857; }
.badge.red { background: var(--red-light); color: #b91c1c; }
.badge.gray { background: #f1f5f9; color: var(--muted); }
.tabs { display: flex; gap: 4px; background: #e9ecf3; border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.tabs button { flex: 1; padding: 9px; border-radius: 9px; font-weight: 600; font-size: 14px; background: transparent; color: var(--muted); }
.tabs button.active { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.hero { text-align: center; padding: 44px 20px 30px; }
.hero img.logo { width: 92px; height: 92px; border-radius: 24px; box-shadow: var(--shadow); margin-bottom: 18px; }
.hero h1 { font-size: 34px; font-weight: 800; letter-spacing: -0.5px; }
.hero h1 span { color: var(--primary); }
.hero p.tagline { font-size: 17px; color: var(--muted); max-width: 480px; margin: 10px auto 26px; }
.hero .cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin: 30px 0; }
.feature { background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.feature .emoji { font-size: 28px; margin-bottom: 8px; }
.feature h3 { font-size: 15.5px; margin-bottom: 4px; }
.feature p { font-size: 13.5px; color: var(--muted); }
.install-tip {
  background: linear-gradient(135deg, #eef2ff, #e0e7ff); border-radius: var(--radius);
  padding: 20px; margin-top: 10px; font-size: 14.5px;
}
.install-tip h3 { margin-bottom: 8px; font-size: 16px; }
.install-tip ol { padding-left: 20px; }
.install-tip li { margin-bottom: 4px; }
.empty { text-align: center; color: var(--muted); padding: 34px 16px; font-size: 14.5px; }
.empty .emoji { font-size: 38px; display: block; margin-bottom: 10px; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1e293b; color: #fff; padding: 12px 22px; border-radius: 12px;
  font-size: 14.5px; z-index: 100; box-shadow: 0 8px 24px rgba(0,0,0,.25);
  opacity: 0; transition: .25s; pointer-events: none; max-width: 92vw; text-align: center;
}
.toast.show { opacity: 1; }
.modal-bg {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal { background: #fff; border-radius: 18px; padding: 22px; width: 100%; max-width: 440px; max-height: 88vh; overflow-y: auto; }
.modal h3 { margin-bottom: 14px; font-size: 18px; }
.modal .modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.back-link { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 14px; margin-bottom: 8px; font-weight: 600; }
.auth-card { max-width: 400px; margin: 30px auto; }
.error-msg { background: var(--red-light); color: #b91c1c; padding: 10px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 12px; }
.notice { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; padding: 10px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 14px; }
@media (max-width: 480px) {
  .roll-row { padding: 12px; }
  .roll-btns { width: 100%; }
  .roll-btns .pa-btn { flex: 1; }
  .stat-row .name { min-width: 105px; }
}
