:root {
  --bg: #faf6f8;
  --bg-soft: #f4ecf0;
  --surface: #ffffff;
  --ink: #453b42;
  --ink-soft: #6f636b;
  --muted: #a2949c;
  --line: #f0e6ec;
  --line-strong: #e6d7df;
  --rose: #c17693;
  --rose-deep: #a65b78;
  --rose-tint: #f8edf2;
  --plum: #7a5566;
  --sage: #5f9370;
  --sage-bg: #eaf3ec;
  --amber: #b0813f;
  --amber-bg: #f8efdc;
  --alert: #c96a70;
  --alert-bg: #fbe9ea;
  --serif: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --shadow: 0 1px 2px rgba(150, 90, 120, .05), 0 6px 22px rgba(150, 90, 120, .07);
  --shadow-soft: 0 1px 2px rgba(150, 90, 120, .04);
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(1100px 520px at 82% -8%, #fbeef4 0%, rgba(251, 238, 244, 0) 60%),
    radial-gradient(900px 480px at 6% 4%, #f3eef8 0%, rgba(243, 238, 248, 0) 55%),
    var(--bg);
  background-attachment: fixed;
}

main { max-width: 1150px; margin: 0 auto; padding: 20px 20px 70px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: .01em; }
h1 { font-size: 33px; margin: 20px 0 16px; color: var(--plum); line-height: 1.15; }
h2 { font-size: 23px; margin: 4px 0 14px; color: var(--plum); }
h3 { font-size: 17px; margin: 18px 0 8px; color: var(--rose-deep); font-weight: 600; }

a { color: var(--rose-deep); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--plum); text-decoration: none; }

/* Header / nav */
header {
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(1.2) blur(6px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .6);
}
nav {
  max-width: 1150px; margin: 0 auto; padding: 16px 20px 14px;
  display: flex; gap: 22px; align-items: baseline; flex-wrap: wrap;
}
nav a { color: var(--ink-soft); font-weight: 500; position: relative; }
nav a:hover { color: var(--rose-deep); }
nav .brand {
  font-family: var(--serif); font-size: 22px; font-weight: 600;
  color: var(--plum); margin-right: 14px; letter-spacing: .015em;
}
nav .brand::before {
  content: ""; display: inline-block; width: 8px; height: 8px;
  margin-right: 9px; border-radius: 50%; vertical-align: middle;
  background: linear-gradient(135deg, var(--rose) 0%, var(--rose-deep) 100%);
  box-shadow: 0 0 0 3px var(--rose-tint);
}
.syncline {
  max-width: 1150px; margin: 0 auto; padding: 0 20px 12px;
  display: flex; gap: 12px; align-items: center; font-size: 13px;
  color: var(--muted);
}

/* Flash / banners */
.flash {
  max-width: 1110px; margin: 14px auto 0; padding: 11px 16px;
  border-radius: 12px; font-size: 14px; border: 1px solid transparent;
}
.flash-ok { background: var(--sage-bg); color: #35704a; border-color: #d5e8db; }
.flash-err { background: var(--alert-bg); color: #a53d43; border-color: #f2d3d5; }
.flash-warn { background: var(--amber-bg); color: #8a6420; border-color: #efdcb8; }
.flash-warn a { color: #8a6420; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 24px; margin: 18px 0;
  box-shadow: var(--shadow);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.month-nav { display: flex; gap: 8px; }

/* Tables */
table.list {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--surface); border-radius: 14px; overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow-soft);
}
table.list th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 700; padding: 12px 14px;
  background: var(--rose-tint); border-bottom: 1px solid var(--line-strong);
}
table.list td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tbody tr:last-child td { border-bottom: none; }
table.list tbody tr { transition: background .12s ease; }
table.list tbody tr:hover { background: #fdf7fa; }

table.mini { border-collapse: collapse; margin: 6px 0 12px; width: 100%; }
table.mini td { padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); }
.total-row td { font-weight: 700; border-bottom: none; padding-top: 10px; color: var(--plum); }
.num { text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
tr.cancelled td { color: var(--muted); text-decoration: line-through; }
tr.cancelled td .muted { text-decoration: none; }

.student-link { font-weight: 600; color: var(--rose-deep); }
.student-link:hover { color: var(--plum); }
.muted { color: var(--muted); }
.small { font-size: 13px; font-weight: 400; }

.money { font-weight: 600; white-space: nowrap; }
.money-debt { color: var(--alert); }
.money-prepaid { color: var(--sage); }

/* Badges & chips */
.badge {
  display: inline-block; padding: 3px 11px; border-radius: 20px;
  font-size: 11px; font-weight: 700; letter-spacing: .03em; vertical-align: middle;
}
.badge-warn { background: linear-gradient(135deg, var(--rose) 0%, var(--rose-deep) 100%); color: #fff; }
.badge-ok { background: var(--sage-bg); color: #35704a; }
.badge-muted { background: var(--bg-soft); color: var(--ink-soft); }

.chip {
  border: 1px solid transparent; border-radius: 22px; padding: 6px 15px;
  font-size: 13px; font-weight: 600; cursor: pointer; transition: filter .15s ease;
}
.chip:hover { filter: brightness(.97); }
.chip-paid { background: var(--sage-bg); color: #35704a; border-color: #d5e8db; }
.chip-pending { background: var(--amber-bg); color: #8a6420; border-color: #efdcb8; }
.chip-static { cursor: default; }
.chip-static:hover { filter: none; }

/* Buttons */
.btn {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: 22px;
  padding: 8px 18px; font-size: 14px; font-family: var(--sans); cursor: pointer;
  color: var(--ink); font-weight: 500; transition: all .15s ease;
  box-shadow: var(--shadow-soft);
}
.btn:hover { background: var(--rose-tint); border-color: var(--rose); color: var(--rose-deep); }
.btn-primary {
  background: linear-gradient(135deg, var(--rose) 0%, var(--rose-deep) 100%);
  border-color: transparent; color: #fff;
  box-shadow: 0 2px 10px rgba(166, 91, 120, .28);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--rose-deep) 0%, #94506a 100%); color: #fff; filter: none; }
.btn-small { padding: 5px 13px; font-size: 13px; }
.btn-x {
  border: none; background: none; color: #d3c3cc; cursor: pointer;
  font-size: 18px; line-height: 1; padding: 0 5px; transition: color .15s ease;
}
.btn-x:hover { color: var(--alert); }

/* Forms */
form.inline { display: inline; }
.row-form { display: flex; gap: 9px; align-items: center; margin: 10px 0; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

input[type="text"], input[type="date"], input[type="password"], select, textarea {
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 9px 11px;
  font-size: 14px; font-family: inherit; background: var(--surface); color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input[type="text"]:focus, input[type="date"]:focus, input[type="password"]:focus,
select:focus, textarea:focus {
  outline: none; border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(193, 118, 147, .16);
}
input::placeholder, textarea::placeholder { color: #c4b6bd; }
textarea { resize: vertical; }

select.hw { font-size: 13px; padding: 6px 10px; border-radius: 22px; font-weight: 600; border-color: transparent; }
.hw-sent { background: var(--sage-bg); color: #35704a; }
.hw-not_sent { background: var(--alert-bg); color: #a53d43; }
.hw-check { background: var(--amber-bg); color: #8a6420; }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 860px) { .kanban { grid-template-columns: repeat(2, 1fr); } }
.kcol {
  background: linear-gradient(180deg, var(--rose-tint) 0%, var(--bg-soft) 100%);
  border: 1px solid var(--line); border-radius: 14px; padding: 12px;
}
.kcol h3 { margin: 2px 0 10px; text-align: center; color: var(--plum); font-size: 15px; }
.kcol-list { list-style: none; margin: 0; padding: 0; min-height: 44px; }
.kcol-list li {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 11px; margin-bottom: 7px; cursor: grab;
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
  box-shadow: var(--shadow-soft); transition: box-shadow .15s ease, transform .1s ease;
}
.kcol-list li:hover { box-shadow: var(--shadow); }
.kcol-list li.sortable-ghost { opacity: .4; }
.topic-title { flex: 1; }

/* Misc */
.month-block { margin-bottom: 26px; }
.day-block { margin-bottom: 20px; }
pre.message {
  background: var(--rose-tint); border: 1px solid var(--line-strong); border-radius: 12px;
  padding: 14px 16px; white-space: pre-wrap; font-family: inherit; font-size: 14px;
  color: var(--ink); line-height: 1.6;
}
.billing-card h2 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Students list — clickable cards */
.sort-form { margin: 0; }
.sort-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.sort-label select { padding: 7px 12px; border-radius: 22px; }

.student-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px; margin: 18px 0;
}
.student-card {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
  transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease;
}
.student-card:hover {
  transform: translateY(-2px); border-color: var(--rose);
  box-shadow: 0 4px 14px rgba(150, 90, 120, .12), 0 12px 30px rgba(150, 90, 120, .10);
}
/* Stretched link: the whole card follows the student link... */
.card-link {
  font-family: var(--serif); font-size: 21px; font-weight: 600;
  color: var(--plum); line-height: 1.2;
}
.student-card:hover .card-link { color: var(--rose-deep); }
.card-link::after { content: ""; position: absolute; inset: 0; z-index: 0; border-radius: var(--radius); }
/* ...except interactive controls, which sit above the overlay. */
.on-top { position: relative; z-index: 1; }

.sc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sc-program { font-size: 14px; }
.sc-topics { font-size: 13px; color: var(--ink-soft); line-height: 1.5; }
.sc-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 700;
}
.sc-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  margin-top: auto; padding-top: 4px;
}
.sc-debt { font-size: 15px; }

/* Installed full-screen on iPhone: keep content clear of the notch, the rounded
   corners and the home indicator, and soften tap flashes. */
body { -webkit-tap-highlight-color: rgba(193, 118, 147, .15); }
header { padding-top: env(safe-area-inset-top); }
nav, .syncline {
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}
main {
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
  padding-bottom: calc(70px + env(safe-area-inset-bottom));
}

@media (max-width: 700px) {
  main {
    padding-top: 14px;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    padding-bottom: calc(44px + env(safe-area-inset-bottom));
  }
  h1 { font-size: 28px; }
  nav { gap: 16px; padding-top: 12px; padding-bottom: 12px; }
  .card { padding: 18px 16px; }
  table.list { display: block; overflow-x: auto; }
  .student-grid { grid-template-columns: 1fr; }
  .two { grid-template-columns: 1fr; }
  /* iOS zooms the page when a focused field's text is under 16px — pin to 16 */
  input[type="text"], input[type="date"], input[type="password"], select, textarea { font-size: 16px; }
}

/* Header logout button pushed to the far right */
.nav-logout { margin-left: auto; }

/* ===== Login — a page from the tutor's зошит ===== */
.login-body {
  min-height: 100vh; margin: 0;
  display: flex; align-items: center; justify-content: center;
  padding: calc(28px + env(safe-area-inset-top)) 18px calc(28px + env(safe-area-inset-bottom));
  background:
    radial-gradient(1200px 600px at 85% -12%, #f7e6ee 0%, rgba(247, 230, 238, 0) 60%),
    radial-gradient(900px 520px at -5% 108%, #ece4f2 0%, rgba(236, 228, 242, 0) 55%),
    var(--bg);
}
.login-shell { width: 100%; max-width: 400px; }

.login-sheet {
  position: relative;
  background: linear-gradient(180deg, #fffdfb 0%, #fdf7f4 100%);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  padding: 34px 30px 30px 48px;            /* room for the margin rule on the left */
  box-shadow: 0 1px 2px rgba(150, 90, 120, .05), 0 20px 48px rgba(150, 90, 120, .15);
}
/* the single rose margin line of a ruled exercise book */
.login-sheet::before {
  content: ""; position: absolute; top: 22px; bottom: 22px; left: 30px; width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg,
    rgba(193, 118, 147, 0), rgba(193, 118, 147, .5) 14%,
    rgba(193, 118, 147, .5) 86%, rgba(193, 118, 147, 0));
}

.login-seal {
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 26px; font-weight: 600; color: var(--rose-deep);
  background: radial-gradient(circle at 34% 30%, #fbeef4, #f2d7e2);
  border: 1px solid #e9cdd9; box-shadow: inset 0 1px 2px rgba(255, 255, 255, .75);
  margin-bottom: 18px;
}
.login-eyebrow {
  display: block; font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; margin-bottom: 7px;
}
.login-title {
  font-family: var(--serif); font-weight: 600; color: var(--plum);
  font-size: 34px; line-height: 1.04; margin: 0 0 9px; letter-spacing: .01em;
}
.login-sub { margin: 0 0 24px; color: var(--ink-soft); font-size: 14px; }

.login-error {
  margin: 0 0 18px; padding: 10px 14px; border-radius: 10px; font-size: 13.5px;
  background: var(--alert-bg); color: #a53d43; border: 1px solid #f2d3d5;
}

.login-form { display: flex; flex-direction: column; gap: 21px; }
.field { display: flex; flex-direction: column; gap: 3px; }
.field-label {
  font-size: 11px; letter-spacing: .13em; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
}
/* underline fields — writing on the ruled line */
.field input {
  border: none; border-bottom: 1.5px solid var(--line-strong); border-radius: 0;
  background: transparent; padding: 7px 2px; font-size: 16px; font-family: var(--sans);
  color: var(--ink); transition: border-color .18s ease, box-shadow .18s ease;
}
.field input:focus {
  outline: none; border-bottom-color: var(--rose-deep);
  box-shadow: 0 1.5px 0 var(--rose-deep);
}

.login-remember {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  font-size: 13.5px; color: var(--ink-soft); margin-top: -3px;
}
.login-remember input { width: 18px; height: 18px; accent-color: var(--rose-deep); flex: none; }

.login-btn {
  margin-top: 6px; width: 100%; padding: 13px; border: none; cursor: pointer;
  border-radius: 26px; font-size: 15px; font-weight: 600; letter-spacing: .02em;
  font-family: var(--sans); color: #fff;
  background: linear-gradient(135deg, var(--rose) 0%, var(--rose-deep) 100%);
  box-shadow: 0 6px 18px rgba(166, 91, 120, .32);
  transition: transform .12s ease, box-shadow .15s ease, filter .15s ease;
}
.login-btn:hover { filter: brightness(1.03); box-shadow: 0 8px 22px rgba(166, 91, 120, .4); }
.login-btn:active { transform: translateY(1px); }
.login-btn:focus-visible { outline: 3px solid rgba(193, 118, 147, .45); outline-offset: 2px; }

.login-foot {
  text-align: center; margin: 16px 0 0; font-size: 12px; color: var(--muted); letter-spacing: .02em;
}

@media (max-width: 430px) {
  .login-title { font-size: 30px; }
  .login-sheet { padding: 28px 22px 26px 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .login-btn { transition: none; }
  .login-btn:active { transform: none; }
}
