/* ── Variables ────────────────────────────────────────── */
:root {
  --bg:        #f4f5f7;
  --surface:   #ffffff;
  --border:    #e2e4e9;
  --text:      #1a1a2e;
  --muted:     #6b7280;
  --primary:   #2563eb;
  --primary-h: #1d4ed8;
  --danger:    #dc2626;
  --danger-h:  #b91c1c;
  --ok:        #16a34a;
  --radius:    6px;
}

/* ── Reset ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Nav ──────────────────────────────────────────────── */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand { font-weight: 700; font-size: 1.1rem; color: var(--primary); margin-right: .5rem; }
nav a { color: var(--muted); font-size: .9rem; }
nav a.active { color: var(--primary); font-weight: 600; }
nav a:hover { color: var(--primary); text-decoration: none; }
.nav-admin { margin-left: auto; font-size: .8rem !important; }

/* ── Layout ───────────────────────────────────────────── */
main { max-width: 980px; margin: 2rem auto; padding: 0 1.5rem 4rem; }
.page-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-header h1 { font-size: 1.4rem; font-weight: 700; flex: 1; }
.header-actions { display: flex; gap: .5rem; }

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  padding: .4rem .9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: .85rem;
  font-family: inherit;
  line-height: 1.4;
  transition: background .12s, border-color .12s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-h); border-color: var(--primary-h); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-h); border-color: var(--danger-h); }
.btn-sm { padding: .22rem .55rem; font-size: .78rem; }

/* ── Forms ────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: .8rem; max-width: 500px; }
.form label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; font-weight: 500; }

input[type="text"],
input[type="date"],
input[type="time"],
select,
textarea {
  padding: .45rem .7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color .12s, outline .12s;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: 0;
  border-color: transparent;
}

.inline-form { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 160px; }

/* ── Filters ──────────────────────────────────────────── */
.filters { display: flex; gap: .75rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.filters select { padding: .4rem .7rem; }

/* ── Table ────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  border: 1px solid var(--border);
}
.data-table th,
.data-table td { padding: .65rem 1rem; text-align: left; border-bottom: 1px solid var(--border); font-size: .88rem; }
.data-table th { background: var(--bg); font-weight: 600; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #f8f9fc; }

/* ── Item list ────────────────────────────────────────── */
.item-list { list-style: none; display: flex; flex-direction: column; gap: .4rem; }
.item-list li {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .65rem 1rem;
}
.item-name { flex: 1; font-weight: 500; }
.item-meta { color: var(--muted); font-size: .85rem; }

/* ── Lesson detail ────────────────────────────────────── */
.lesson-meta {
  display: flex;
  gap: 1rem;
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  padding: .75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ── Notes ────────────────────────────────────────────── */
.notes-section h2 { font-size: 1rem; font-weight: 600; margin-bottom: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-size: .8rem; }

.note-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  margin-bottom: .5rem;
}
.note-body { white-space: pre-wrap; line-height: 1.6; }
.note-actions { display: flex; gap: .4rem; margin-top: .5rem; }
.note-edit-input { width: 100%; margin-bottom: .4rem; resize: vertical; }

.note-add-form { margin-top: 1.25rem; display: flex; flex-direction: column; gap: .5rem; max-width: 640px; }
.note-add-form textarea { resize: vertical; }

/* ── Journal ──────────────────────────────────────────── */
.journal-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: .75rem;
}
.journal-header {
  display: flex;
  gap: .75rem;
  align-items: center;
  margin-bottom: .6rem;
  flex-wrap: wrap;
  font-size: .9rem;
}
.journal-notes {
  list-style: disc;
  padding-left: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
  line-height: 1.6;
  font-size: .9rem;
}

/* ── Badges & tags ────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-executed { background: #dcfce7; color: var(--ok); }
.badge-pending  { background: #fef9c3; color: #854d0e; }

.tag {
  background: #ede9fe;
  color: #5b21b6;
  padding: .15rem .55rem;
  border-radius: 99px;
  font-size: .8rem;
  font-weight: 500;
}
.muted { color: var(--muted); font-size: .85rem; }

/* ── Toast ────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: .75rem 1.25rem;
  border-radius: var(--radius);
  font-size: .9rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  z-index: 9999;
  animation: slideUp .2s ease;
}
.toast-ok  { background: var(--ok);     color: #fff; }
.toast-err { background: var(--danger); color: #fff; }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Auth ─────────────────────────────────────────────── */
.auth-wrap { max-width: 360px; margin: 5rem auto; }
.auth-title { font-size: 1.6rem; font-weight: 700; color: var(--primary); margin-bottom: .25rem; }
.auth-sub   { color: var(--muted); font-size: .9rem; margin-bottom: 1.5rem; }
.auth-form  { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.form-error { color: var(--danger); font-size: .85rem; min-height: 1.2em; }
.checkbox-label { display: flex; flex-direction: row; align-items: center; gap: .5rem; font-weight: 500; cursor: pointer; }
.toggle-label { display: flex; align-items: center; gap: .4rem; font-size: .88rem; color: var(--muted); cursor: pointer; margin-left: auto; }
.upcoming-hint { color: var(--muted); font-size: .85rem; margin-top: .75rem; text-align: right; }
.lesson-day-group { margin-bottom: 1.5rem; }
.week-group { border: 2px solid #000; border-radius: var(--radius); padding: .75rem; margin-bottom: 1.5rem; }
.lesson-day-header { font-weight: 700; font-size: .95rem; color: var(--text); padding: .4rem 0; border-bottom: 2px solid var(--primary); margin-bottom: .4rem; }
.lesson-row { display: flex; align-items: center; gap: .75rem; padding: .55rem .75rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: .35rem; }
.lesson-row .lr-time      { width: 50px;  flex-shrink: 0; color: var(--muted); font-size: .85rem; }
.lesson-row .lr-group     { width: 150px; flex-shrink: 0; }
.lesson-row .lr-course    { width: 150px; flex-shrink: 0; }
.lesson-row .lr-classroom { width: 75px;  flex-shrink: 0; color: var(--muted); font-size: .85rem; }
.lesson-row .lr-actions   { margin-left: auto; display: flex; gap: .4rem; }

/* ── Nav extras ───────────────────────────────────────── */
.nav-spacer { flex: 1; }
.nav-user   { color: var(--muted); font-size: .85rem; }

/* ── Misc ─────────────────────────────────────────────── */
.loading, .empty { color: var(--muted); padding: 3rem 0; text-align: center; }
.error { color: var(--danger); padding: 3rem 0; text-align: center; }
