/* ---------- themes ---------- */
:root, [data-theme="seker"] {
  --bg: #fff4f8;
  --bg2: #f3ecff;
  --card: #ffffff;
  --ink: #3d2b4f;
  --muted: #9a89ab;
  --line: #f0e3ef;
  --ok: #5fc59a;
  --warn: #f5b84b;
  --bad: #ef6f8a;
  --cancel: #c8bfd6;
  --emirhan: #7c9cf5;
  --muko: #f07fb0;
}
[data-theme="nane"] {
  --bg: #f2fbf5;
  --bg2: #fffbe9;
  --card: #ffffff;
  --ink: #24453a;
  --muted: #84a396;
  --line: #e1f0e6;
  --ok: #3fbf8a;
  --warn: #f2b33d;
  --bad: #ee6b6b;
  --cancel: #c3d6cb;
  --emirhan: #3fa7a0;
  --muko: #f28c6b;
}
[data-theme="gokyuzu"] {
  --bg: #eef6ff;
  --bg2: #fff6dc;
  --card: #ffffff;
  --ink: #23324d;
  --muted: #8494b0;
  --line: #e2ebf7;
  --ok: #4cc38a;
  --warn: #f6b73c;
  --bad: #f2667a;
  --cancel: #c4cfe0;
  --emirhan: #4c8df6;
  --muko: #b47cf2;
}
:root { --accent: var(--emirhan); }
[data-person="muko"] { --accent: var(--muko); }

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  font-weight: 600;
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg) 0%, var(--bg2) 100%) fixed;
  padding: 0 14px calc(32px + env(safe-area-inset-bottom));
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
h1, h2 { margin: 0; font-weight: 900; }

.top, #app { max-width: 560px; margin: 0 auto; }
.top { padding: 18px 2px 10px; position: sticky; top: 0; z-index: 5; background: linear-gradient(var(--bg) 75%, transparent); }
.brand { display: flex; align-items: baseline; justify-content: space-between; }
.brand h1 { font-size: 28px; letter-spacing: -0.5px; }
.brand small { color: var(--muted); font-size: 13px; }

.tabs { display: flex; gap: 8px; margin-top: 12px; padding: 5px; background: var(--card); border-radius: 999px; box-shadow: 0 4px 16px rgba(80, 40, 100, .06); }
.tab { flex: 1; padding: 10px 0; border-radius: 999px; font-weight: 800; font-size: 16px; color: var(--muted); transition: .2s; }
.tab.active { background: var(--accent); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 40%, transparent); }

.card { background: var(--card); border-radius: 24px; padding: 16px; margin-top: 14px; box-shadow: 0 6px 24px rgba(80, 40, 100, .07); }
.pill { font-style: normal; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 16%, white); color: var(--accent); margin-left: 6px; }
.link { color: var(--accent); font-weight: 800; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.small { font-size: 14px; font-weight: 800; padding: 7px 12px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, white); color: var(--accent); }
.empty { color: var(--muted); text-align: center; }

/* ---------- week ---------- */
.weeknav { display: flex; align-items: center; gap: 8px; }
.nav { width: 44px; height: 44px; border-radius: 50%; font-size: 26px; line-height: 1; background: color-mix(in srgb, var(--accent) 12%, white); color: var(--accent); font-weight: 900; }
.nav:disabled { opacity: .3; }
.weektitle { flex: 1; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.weektitle strong { font-size: 20px; font-weight: 900; }
.weektitle span { color: var(--muted); font-size: 13px; }
.legend { display: flex; justify-content: center; gap: 14px; color: var(--muted); font-size: 12px; margin: 10px 0 2px; }

.day { margin-top: 14px; }
.dayhead { font-weight: 900; font-size: 15px; margin: 0 4px 6px; }
.dayhead span { color: var(--muted); font-weight: 700; }
.day.today .dayhead { color: var(--accent); }

.session { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px; border-radius: 18px; background: color-mix(in srgb, var(--line) 55%, white); margin-bottom: 8px; transition: background .2s; }
.session.future { opacity: .55; }
.session.done-y { background: color-mix(in srgb, var(--ok) 14%, white); }
.session.done-n { background: color-mix(in srgb, var(--bad) 14%, white); }
.session.done-x { background: color-mix(in srgb, var(--cancel) 25%, white); }
.time { font-weight: 900; font-size: 14px; color: var(--muted); width: 44px; }
.what { flex: 1; min-width: 0; }
.cname { font-weight: 800; font-size: 15px; }
.sub { color: var(--muted); font-size: 12px; margin-top: 1px; }
.kind { font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 13%, white); color: var(--accent); vertical-align: 1px; }
.kind.k-U, .kind.k-L { background: color-mix(in srgb, var(--warn) 22%, white); color: color-mix(in srgb, var(--warn) 60%, var(--ink)); }

.marks { display: flex; gap: 5px; }
.mark { width: 38px; height: 38px; border-radius: 13px; font-size: 18px; font-weight: 900; background: var(--card); color: var(--muted); box-shadow: inset 0 0 0 2px var(--line); transition: transform .1s; }
.mark:active { transform: scale(.9); }
.mark.on.m-y { background: var(--ok); color: #fff; box-shadow: none; }
.mark.on.m-n { background: var(--bad); color: #fff; box-shadow: none; }
.mark.on.m-x { background: var(--cancel); color: #fff; box-shadow: none; }

/* ---------- courses ---------- */
.sectionhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sectionhead h2 { font-size: 18px; }
.course { padding: 14px; border-radius: 20px; margin-top: 10px; background: color-mix(in srgb, var(--line) 40%, white); cursor: pointer; border: 2px solid transparent; }
.course:hover { border-color: var(--line); }
.chead { display: flex; justify-content: space-between; gap: 10px; }
.left { text-align: right; white-space: nowrap; }
.left strong { display: block; font-size: 20px; font-weight: 900; }
.left span { font-size: 12px; color: var(--muted); }
.lvl-ok .left strong { color: var(--ok); }
.lvl-warn .left strong { color: var(--warn); }
.lvl-edge .left strong, .lvl-over .left strong { color: var(--bad); }
.lvl-over { border-color: color-mix(in srgb, var(--bad) 45%, white); }

.bar { height: 8px; border-radius: 999px; background: var(--card); margin: 10px 0 8px; overflow: hidden; }
.bar b { display: block; height: 100%; border-radius: 999px; background: var(--ok); transition: width .3s; }
.lvl-warn .bar b { background: var(--warn); }
.lvl-edge .bar b, .lvl-over .bar b { background: var(--bad); }

.stats { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.nag { color: color-mix(in srgb, var(--warn) 70%, var(--ink)); font-weight: 800; }
.dots { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 9px; }
.dot { width: 11px; height: 11px; border-radius: 50%; }
.d-y { background: var(--ok); }
.d-n { background: var(--bad); }
.d-x { background: var(--cancel); }
.d-e { background: var(--card); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--warn) 60%, white); }
.d-f { background: var(--card); box-shadow: inset 0 0 0 2px var(--line); }
.note { font-size: 12px; color: var(--muted); margin-top: 8px; font-style: italic; }

.foot { max-width: 560px; margin: 18px auto 0; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 12px; padding: 0 4px; }

/* ---------- dialogs ---------- */
dialog { border: 0; border-radius: 24px; padding: 20px; width: min(440px, calc(100vw - 24px)); color: var(--ink); background: var(--card); box-shadow: 0 20px 60px rgba(60, 30, 80, .25); }
dialog::backdrop { background: rgba(60, 40, 80, .3); backdrop-filter: blur(2px); }
dialog h2 { font-size: 20px; margin-bottom: 10px; }
label { display: block; font-size: 13px; color: var(--muted); font-weight: 800; margin-top: 10px; }
input, select { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-weight: 700; font-size: 15px; }
input:focus, select:focus { outline: none; border-color: var(--accent); }
fieldset { border: 2px dashed var(--line); border-radius: 16px; margin: 12px 0 0; padding: 8px 10px 10px; }
legend { font-size: 13px; color: var(--muted); font-weight: 800; padding: 0 4px; }
.slot { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.slot select { flex: 1.3; } .slot input { flex: 1; }
.slot select, .slot input { margin-top: 0; }
.x { font-size: 22px; color: var(--muted); width: 32px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { font-size: 12px; color: var(--muted); margin: 6px 2px 0; }
.actions { display: flex; gap: 8px; margin-top: 18px; align-items: center; }
.actions span { flex: 1; }
.actions button { padding: 10px 14px; border-radius: 14px; font-weight: 800; }
.primary { background: var(--accent); color: #fff; }
.danger { color: var(--bad); font-size: 13px; }

/* ---------- login & toast ---------- */
.login { position: fixed; inset: 0; display: grid; place-items: center; background: linear-gradient(160deg, var(--bg), var(--bg2)); z-index: 20; padding: 20px; }
.login[hidden] { display: none; }
.login form { width: min(340px, 100%); text-align: center; }
.login .big { font-size: 56px; }
.login p { color: var(--muted); }
.login .primary { width: 100%; margin-top: 12px; padding: 12px; border-radius: 14px; font-weight: 900; }
.error { color: var(--bad) !important; min-height: 1em; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 30px); opacity: 0; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 14px; font-size: 14px; transition: .25s; pointer-events: none; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- backlog & help ---------- */
.backlog-banner { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; padding: 14px 16px; border-radius: 20px; background: color-mix(in srgb, var(--warn) 22%, white); color: var(--ink); font-size: 15px; box-shadow: 0 6px 20px rgba(80, 40, 100, .06); text-align: left; }
.backlog-banner .go { font-weight: 900; color: color-mix(in srgb, var(--warn) 55%, var(--ink)); white-space: nowrap; }
.backlog .dayhead { margin-top: 12px; }
.backlog .time { width: 58px; font-size: 12px; }
.dot { cursor: pointer; }
.help h2 { font-size: 18px; margin-bottom: 4px; }
.help ol { margin: 6px 0 0; padding-left: 20px; font-size: 14px; line-height: 1.5; }
.help li { margin-top: 6px; }
.help b { font-weight: 900; }
.signature { text-align: center; margin: 22px 0 6px; font-size: 12px; color: var(--muted); font-style: italic; opacity: .85; }
