:root {
  --primary: #900000; --primary-2: #A22929; --primary-soft: #E0B8B8; --danger: #A3213D;
  --bg: #F3F4F6; --card: #fff; --line: #E5E7EB; --text: #1F2937; --muted: #6B7280;
  --blue: #3498DB; --green: #3F8F63; --green-btn: #5BBA6F;
  font-family: Roboto, "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-size: 15px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
svg.i { width: 20px; height: 20px; fill: currentColor; flex: none; }
a { color: var(--primary); }

/* layout */
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--primary); color: #fff; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { display: flex; gap: 10px; align-items: center; padding: 0 8px 16px; border-bottom: 1px solid rgba(255,255,255,.18); margin-bottom: 10px; }
.side .brand .crest { width: 40px; height: 40px; border-radius: 10px; background: rgba(255,255,255,.18); display: grid; place-items: center; flex: none; }
.side .brand .crest img { height: 30px; width: auto; }
.side .brand .crest svg { width: 26px; height: 26px; fill: #fff; }
.side .brand b { display: block; font-size: 15px; }
.side .brand small { display: block; font-size: 12px; opacity: .8; }
.side .sec { font-size: 11px; letter-spacing: 1.4px; font-weight: 700; color: var(--primary-soft); padding: 14px 12px 6px; }
.side a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: #fff; text-decoration: none; margin: 1px 0; }
.side a:hover { background: rgba(255,255,255,.08); }
.side a.on { background: var(--primary-2); font-weight: 700; }
.side .foot { margin-top: 18px; padding: 12px; border-top: 1px solid rgba(255,255,255,.18); font-size: 12.5px; opacity: .9; }
.side .foot button { color: #fff; text-decoration: underline; margin-top: 6px; }
.content { padding: 22px 28px 60px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.topbar h1 { margin: 0; font-size: 24px; flex: 1; min-width: 200px; }
.mobile-menu { display: none; }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; transform: translateX(-105%); transition: transform .2s; z-index: 30; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .content { padding: 14px 12px 60px; }
  .mobile-menu { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--primary); color: #fff; }
}

/* elemente */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin-bottom: 16px; }
.card h2 { margin: 0 0 12px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.card h2 .sp { flex: 1; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stat b { display: block; font-size: 26px; }
.stat small { color: var(--muted); }
.btn { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 9px; font-weight: 600; white-space: nowrap; }
a.btn { text-decoration: none; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: #7a0000; }
.btn.green { background: var(--green-btn); color: #fff; }
.btn.ghost { background: #F3F4F6; border: 1px solid var(--line); }
.btn.danger { background: #FDECEC; color: var(--danger); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; display: inline-grid; place-items: center; color: #4B5563; }
.icon-btn:hover { background: #F3F4F6; }
.icon-btn.del:hover { background: #FDECEC; color: var(--danger); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 12.5px; color: #4B5563; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=url], select, textarea {
  height: 38px; border: 1px solid #D1D5DB; border-radius: 9px; padding: 0 10px; background: #fff; min-width: 0; width: 100%;
}
textarea { height: 90px; padding: 8px 10px; resize: vertical; }
input[type=color] { height: 38px; width: 56px; border: 1px solid #D1D5DB; border-radius: 9px; padding: 3px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid #F3C2C2; border-color: var(--primary); }
.pick { display: flex; align-items: center; gap: 8px; }
.pick select { min-width: 220px; }
.quick { display: grid; grid-template-columns: 2fr .7fr 1fr .8fr 1.4fr 1.6fr auto; gap: 10px; align-items: end; }
.quick.abs { grid-template-columns: 2fr 1fr .8fr 1.4fr 1fr auto; }
@media (max-width: 1100px) { .quick, .quick.abs { grid-template-columns: 1fr 1fr; } }
.lesson-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid #F1F2F4; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.act { text-align: right; white-space: nowrap; width: 1%; }
.tbl-wrap { overflow-x: auto; }
.grade { display: inline-grid; place-items: center; min-width: 30px; height: 26px; border-radius: 7px; background: #E8F4FC; color: #1D6FA5; font-weight: 700; }
.grade.low { background: #FDECEC; color: var(--danger); }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 10px; background: #F3F4F6; color: #4B5563; }
.tag.red { background: #FDECEC; color: var(--danger); }
.tag.green { background: #E7F5EC; color: var(--green); }
.empty { color: var(--muted); padding: 16px 4px; text-align: center; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.45; }

/* orar */
.tt { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; }
.tt th { text-align: center; color: #374151; font-size: 14px; border: 0; }
.tt td { border: 0; padding: 0; height: 58px; }
.tt td.h { width: 120px; font-size: 13px; font-weight: 700; text-align: center; background: #F3F6F9; border-radius: 8px; }
.cell { width: 100%; height: 100%; border-radius: 8px; border: 1px dashed #D1D5DB; display: flex; overflow: hidden; background: #FAFAFA; }
.cell:hover { outline: 2px solid var(--primary); }
.cell > div { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 4px 6px; font-size: 12.5px; text-align: center; overflow: hidden; }
.cell > div b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell > div i { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell.empty-cell { justify-content: center; align-items: center; color: #9CA3AF; font-size: 20px; }
.hours-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.hours-row span { width: 70px; color: var(--muted); font-size: 13px; }
.hours-row input { max-width: 200px; }

/* cont nou: pașii de completare */
.onb h2 { font-size: 20px; }
.onb-step { display: flex; align-items: center; gap: 14px; padding: 13px 14px; margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: inherit; }
.onb-step:hover { border-color: var(--primary); background: #FCF6F6; }
.onb-n { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: #fff; font-weight: 700; }
.onb-step.done .onb-n { background: var(--green); }
.onb-t b { display: block; font-size: 15px; }
.onb-t small { color: var(--muted); font-size: 13px; }

/* fereastră modală */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 16px; width: min(560px, 100%); max-height: 92vh; overflow-y: auto; padding: 20px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal h3 { margin: 0 0 14px; font-size: 18px; }
.modal .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal .grid .full { grid-column: 1 / -1; }
.modal .acts { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.lesson-box { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.lesson-box h4 { margin: 0 0 10px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #323232; color: #fff; padding: 10px 18px; border-radius: 9px; z-index: 60; max-width: 90%; }
.toast.err { background: var(--danger); }

/* autentificare */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, #900000 0 38%, var(--bg) 38%); }
.login-card { background: #fff; border-radius: 18px; padding: 28px 26px; width: min(400px, 100%); box-shadow: 0 20px 50px rgba(0,0,0,.18); }
.login-card .crest { width: 64px; height: 64px; border-radius: 16px; background: #F3F4F6; display: grid; place-items: center; margin: 0 auto 10px; }
.login-card .crest svg { width: 40px; height: 40px; fill: var(--primary); }
.login-card h1 { text-align: center; font-size: 20px; margin: 0 0 4px; }
.login-card p { text-align: center; color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.login-card .field { margin-bottom: 12px; }
.login-card .err { color: var(--danger); min-height: 20px; font-size: 14px; margin-bottom: 8px; }
.login-card .btn { width: 100%; justify-content: center; height: 44px; }
.setup { max-width: 640px; margin: 60px auto; }
.setup code { background: #F3F4F6; padding: 2px 6px; border-radius: 5px; }

/* telefon: o singură coloană peste tot, carduri și ferestre mai compacte */
@media (max-width: 560px) {
  html, body { font-size: 15px; }
  .content { padding: 12px 10px 48px; }
  .topbar { gap: 10px; margin-bottom: 14px; }
  .topbar h1 { font-size: 20px; min-width: 0; }
  .topbar [data-reload] { height: 34px; padding: 0 10px; }
  .card { padding: 14px 13px; border-radius: 12px; }
  .card h2 { font-size: 16px; flex-wrap: wrap; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px 13px; }
  .stat b { font-size: 22px; }
  .quick, .quick.abs { grid-template-columns: 1fr; }
  .quick .btn.green { width: 100%; justify-content: center; }
  .pick { flex-wrap: wrap; }
  .pick select { min-width: 0; width: 100%; }
  .modal { padding: 16px 15px; border-radius: 14px; }
  .modal .grid, .lesson-grid { grid-template-columns: 1fr; }
  .modal .acts { flex-direction: column-reverse; }
  .modal .acts .btn { width: 100%; justify-content: center; }
  .hours-row input { max-width: none; }
  .login-wrap { background: linear-gradient(170deg, #900000 0 26%, var(--bg) 26%); padding: 12px; }
  .login-card { padding: 22px 18px; }
}
