:root {
  --bg: #f6f4f3;
  --surface: #ffffff;
  --ink: #221e1f;
  --muted: #6b6466;
  --line: #e3dcd9;
  --accent: #a3282f;
  --accent-hover: #861f25;
  --accent-soft: #f8e7e8;
  --danger: #b42318;
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px; color: var(--ink); background: var(--bg); line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--danger); min-height: 1.2em; margin: 6px 0 0; }

input {
  font: inherit; color: var(--ink); width: 100%;
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; min-height: 44px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.btn {
  font: inherit; font-weight: 600; font-size: 15px; cursor: pointer;
  min-height: 44px; padding: 10px 20px; border-radius: 999px;
  border: 1.5px solid var(--accent); background: var(--accent); color: #fff;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--ghost { background: transparent; color: var(--accent); }
.btn--ghost:hover { background: var(--accent-soft); }
.btn--sm { min-height: 40px; padding: 8px 14px; font-size: 14px; }
.btn--block { width: 100%; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login__card { width: min(380px, 100%); display: grid; gap: 14px; }
.login__card h1 { margin: 0; font-size: 1.6rem; }

.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--ink); color: #fff;
  padding-top: calc(12px + env(safe-area-inset-top));
}
.top .btn--ghost { color: #fff; border-color: rgba(255,255,255,.5); }

.modules { display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.modules a { white-space: nowrap; min-height: 40px; display: inline-flex; align-items: center; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 600; }
.modules a[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: #fff; }

.wrap { max-width: 980px; margin: 0 auto; padding: 22px 16px 60px; display: grid; gap: 18px; }
.greet { font-family: Georgia, 'Cormorant Garamond', serif; font-size: 2.2rem; margin: 0; font-weight: 500; }
.wrap > p { margin: -10px 0 0; }

.cards { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .cards { grid-template-columns: repeat(3, 1fr); } }

.tile {
  display: grid; gap: 6px; padding: 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none;
  transition: transform .15s ease, border-color .15s ease;
}
.tile:hover { transform: translateY(-2px); border-color: var(--accent); }
.tile__label { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); font-weight: 700; }
.tile__big { font-size: 2.2rem; line-height: 1.1; }
.tile__sub { font-size: 14px; color: var(--muted); }

.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.section-title h2, .card > h2 { margin: 0 0 10px; font-size: 1.2rem; }
.section-title h2 { margin: 0; }
.link-btn { color: var(--accent); font-weight: 600; text-decoration: none; font-size: 14px; }

.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.list a {
  display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; background: #fff;
}
.list a:hover { border-color: var(--accent); }
.list__name { font-weight: 700; }
.list__meta { font-size: 14px; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); z-index: 60; max-width: calc(100% - 32px); text-align: center;
}
.toast--bad { background: var(--danger); }
