/* Studio Manager - mobile-first responsive styles */
:root {
  --ink: #1c2333;
  --muted: #6b7386;
  --line: #e4e7ef;
  --bg: #f6f7fb;
  --card: #ffffff;
  --brand: #4f6df5;
  --brand-dark: #3a54cc;
  --green: #12a480;
  --amber: #d97a06;
  --red: #d64545;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.45;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Top bar */
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-inner {
  max-width: 1100px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 17px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 4px 14px; flex-wrap: wrap; margin-left: auto; }
.nav a { color: var(--ink); font-size: 15px; padding: 4px 2px; }
.nav a.muted { color: var(--muted); }

.assist-banner {
  background: #fff5e5; border-bottom: 1px solid #f0ddb8; color: #7a5410;
  padding: 8px 16px; font-size: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.assist-banner form { margin-left: auto; }

.container { max-width: 1100px; margin: 0 auto; padding: 18px 16px 60px; }
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 0 40px; }

h1 { font-size: 24px; margin: 6px 0 16px; }
h2 { font-size: 18px; margin: 22px 0 10px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
}
.card h2:first-child { margin-top: 0; }
.grid { display: grid; gap: 14px; }
@media (min-width: 760px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr 1fr; }
}

/* Stat tiles */
.stats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat .n { font-size: 24px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 13px; }

/* Tables that collapse to cards on phones */
.table { width: 100%; border-collapse: collapse; background: var(--card); }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; }
@media (max-width: 640px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border-bottom: 6px solid var(--bg); }
  .table td { border: none; padding: 6px 14px; }
  .table td:first-child { padding-top: 12px; font-weight: 600; }
  .table td:last-child { padding-bottom: 12px; }
  .table td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: 13px; }
}

/* Badges */
.badge {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px;
  border-radius: 999px; white-space: nowrap;
}
.badge-green { background: #e2f6ef; color: #0b7a5e; }
.badge-blue  { background: #e8edfe; color: #3a54cc; }
.badge-gray  { background: #ededf1; color: #5b6270; }
.badge-amber { background: #fdf0dd; color: #a35b03; }
.badge-red   { background: #fbe5e5; color: #b23030; }

/* Buttons + forms */
.btn {
  display: inline-block; border: 1px solid var(--brand); background: var(--brand); color: #fff;
  padding: 9px 16px; border-radius: 8px; font-size: 15px; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--brand); }
.btn-ghost:hover { background: #eef1fe; }
.btn-danger { background: var(--red); border-color: var(--red); }
.btn-danger:hover { background: #b23030; }
.btn-small { padding: 5px 11px; font-size: 13px; }
.inline { display: inline; }

form.stack label { display: block; font-size: 14px; font-weight: 600; margin: 12px 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], input[type=datetime-local], select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 16px; background: #fff; color: var(--ink); font-family: inherit;
}
textarea { min-height: 90px; }
.form-row { display: grid; gap: 10px; }
@media (min-width: 640px) { .form-row-2 { grid-template-columns: 1fr 1fr; } .form-row-3 { grid-template-columns: 1fr 1fr 1fr; } }
.form-actions { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.check { display: flex; gap: 8px; align-items: center; font-size: 15px; margin: 10px 0; }
.check input { width: auto; }

/* Flash messages */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 15px; }
.flash-ok { background: #e2f6ef; color: #0b7a5e; }
.flash-err { background: #fbe5e5; color: #b23030; }
.flash-warn { background: #fdf0dd; color: #a35b03; }

/* Schedule lists */
.day-group { margin-bottom: 18px; }
.day-group h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 8px; }
.lesson-row {
  display: flex; gap: 12px; align-items: center; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 8px;
  flex-wrap: wrap;
}
.lesson-row .time { font-weight: 700; min-width: 74px; }
.lesson-row .who { flex: 1; min-width: 140px; }
.lesson-row .meta { color: var(--muted); font-size: 14px; }
.teacher-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }

/* Week nav */
.week-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.week-nav .title { font-weight: 700; }

/* Login */
.login-box { max-width: 380px; margin: 8vh auto 0; }

/* Utility */
.right { text-align: right; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.balance-low { color: var(--amber); font-weight: 700; }
.balance-neg { color: var(--red); font-weight: 700; }
.balance-ok { color: var(--green); font-weight: 700; }
hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }

/* Onboarding */
.onboard { max-width: 660px; margin: 0 auto; }
.onboard-hero { text-align: center; padding: 20px 0 6px; }
.onboard-hero h1 { margin-bottom: 8px; }
.onboard-hero p { color: var(--muted); max-width: 460px; margin: 0 auto; }
.onboard-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px 24px; margin-top: 18px; box-shadow: 0 1px 3px rgba(28,35,51,.06);
}
.onboard-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.onboard-progress .label { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.onboard-bar { flex: 1; height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.onboard-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #7b8ff8); border-radius: 999px; transition: width .3s; }
.step { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.step:last-of-type { border-bottom: none; }
.step-icon {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
}
.step-icon.todo { border: 2px solid var(--line); color: var(--muted); background: #fff; }
.step-icon.done { background: #e2f6ef; color: #0b7a5e; border: 2px solid #bfe9db; }
.step-body { flex: 1; min-width: 0; }
.step-title { font-weight: 600; }
.step.done .step-title { color: var(--muted); }
.step-desc { color: var(--muted); font-size: 14px; margin-top: 2px; }
.onboard-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.onboard-actions .hint { color: var(--muted); font-size: 13px; margin-left: auto; }
@media (max-width: 560px) {
  .onboard-card { padding: 16px; }
  .step { align-items: flex-start; }
  .step .btn { margin-top: 2px; }
}

/* Tooltips: hover on desktop, tap (focus) on touch */
.tip {
  display: inline-flex; width: 16px; height: 16px; border-radius: 50%;
  background: #dfe3ee; color: #5b6270; font-size: 11px; font-weight: 700;
  align-items: center; justify-content: center; cursor: help;
  position: relative; vertical-align: 2px; user-select: none;
}
.tip::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 8px 11px; border-radius: 8px;
  font-size: 12.5px; font-weight: 400; line-height: 1.45; text-align: left;
  width: max-content; max-width: min(250px, 70vw); white-space: normal;
  opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 60;
  box-shadow: 0 4px 14px rgba(28,35,51,.25);
}
.tip::before {
  content: ""; position: absolute; bottom: calc(100% + 2px); left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--ink);
  opacity: 0; transition: opacity .15s; z-index: 60;
}
.tip:hover::after, .tip:focus::after, .tip:hover::before, .tip:focus::before { opacity: 1; }
.tip:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

/* Quick-resolve widget (Today list) */
.qr > summary { cursor: pointer; display: inline-block; list-style: none; }
.qr > summary::-webkit-details-marker { display: none; }
.qr[open] { flex-basis: 100%; }
.qr[open] > summary { margin-bottom: 8px; }
.qr-form { background: #fafbfe; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.qr-outcomes { display: flex; gap: 4px 18px; flex-wrap: wrap; margin-bottom: 8px; }
.qr-outcomes .check { margin: 2px 0; }
.qr-form textarea { margin-bottom: 6px; }

/* Time blocks */
.block-row { background: #f3f4f8; border-style: dashed; }

/* Homework attachments */
.hw-files { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.hw-file { display: inline-flex; align-items: center; gap: 6px; }
.hw-file-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }

/* Guide pages */
.guide-section h3 { font-size: 16px; margin: 18px 0 6px; }
.guide-section p, .guide-section li { max-width: 72ch; }
.guide-section ul { margin: 8px 0; padding-left: 22px; }
.guide-section li { margin-bottom: 6px; }

/* Guide: persona tabs */
.pills { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 18px; }
.pill {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 7px 15px; border-radius: 999px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.pill:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.pill.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.guide-section.tab-hidden { display: none; }

/* Guide: section header with persona chip */
.guide-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.guide-head .chip {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.guide-head h2 { margin: 0; }
.guide-sub { color: var(--muted); margin: 2px 0 14px; }

/* Guide: callouts */
.callout {
  border-left: 4px solid var(--brand); background: #f0f3fe;
  border-radius: 0 10px 10px 0; padding: 12px 16px; margin: 14px 0; max-width: 72ch;
}
.callout.warn { border-left-color: var(--amber); background: #fdf4e3; }
.callout p { margin: 0; }

/* Guide: at-a-glance chips */
.glance { display: grid; gap: 10px; margin: 12px 0 4px; }
@media (min-width: 640px) { .glance { grid-template-columns: 1fr 1fr; } }
.glance .g {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: #fafbfe;
}
.glance .g strong { display: block; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin-bottom: 4px; }
.glance .g span { font-size: 14px; }

/* Guide: numbered mini-steps */
.mini-steps { counter-reset: ms; list-style: none; padding: 0; margin: 10px 0; }
.mini-steps li {
  counter-increment: ms; position: relative; padding: 4px 0 12px 42px; max-width: 68ch;
}
.mini-steps li::before {
  content: counter(ms); position: absolute; left: 0; top: 2px;
  width: 28px; height: 28px; border-radius: 50%; background: #e8edfe; color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.mini-steps li + li { border-top: 0; }

/* Guide: outcome cards */
.outcomes { display: grid; gap: 10px; margin: 10px 0; }
@media (min-width: 640px) { .outcomes { grid-template-columns: 1fr 1fr 1fr; } }
.outcome { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.outcome .o-title { font-weight: 700; margin-bottom: 2px; }
.outcome .o-fx { font-size: 13px; }

/* Guide: accordions */
.guide-section details {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 8px 0; background: #fff;
}
.guide-section details[open] { background: #fafbfe; }
.guide-section summary { cursor: pointer; font-weight: 600; }
.guide-section summary::marker { color: var(--brand); }
.guide-section details p { margin: 8px 0 2px; }

/* Guide: quick-action row */
.guide-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
