:root {
    --bg: #f4f7f2;
    --bg-soft: #edf4ee;
    --card: #ffffff;
    --ink: #15231b;
    --muted: #65756a;
    --brand: #0d6b3f;
    --brand-dark: #08452b;
    --brand-soft: #e4f3e8;
    --line: #dbe6dc;
    --danger: #b42318;
    --danger-soft: #fff0ee;
    --warning: #f97316;
    --shadow: 0 10px 28px rgba(21, 35, 27, .08);
    --radius: 18px;
}

* { box-sizing: border-box; }
html { min-height: 100%; -webkit-text-size-adjust: 100%; }
body {
    min-height: 100%;
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(13,107,63,.12), transparent 34rem),
        linear-gradient(180deg, #fbfdfb 0%, var(--bg) 42%, #eef4ef 100%);
    line-height: 1.45;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
h1 { margin: 0 0 18px; font-size: clamp(26px, 4vw, 40px); letter-spacing: -.03em; }
h2 { margin: 0 0 14px; font-size: clamp(20px, 2.5vw, 26px); letter-spacing: -.02em; }
h3 { margin: 16px 0 10px; font-size: 17px; }
p { margin-top: 0; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 12px clamp(14px, 3vw, 28px);
    color: #fff;
    background: rgba(8, 69, 43, .96);
    border-bottom: 1px solid rgba(255,255,255,.12);
    box-shadow: 0 8px 24px rgba(8,69,43,.18);
    backdrop-filter: blur(10px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; }
.brand:hover { color: #fff; }
.brand-mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: linear-gradient(135deg, #ffffff, #cdebd4);
    color: var(--brand-dark);
    box-shadow: inset 0 -2px 8px rgba(13,107,63,.14);
}
.brand-text { font-size: 22px; letter-spacing: .08em; }
.topnav { display: flex; justify-content: flex-end; align-items: center; gap: 8px; flex-wrap: wrap; }
.topnav a {
    color: #fff;
    padding: 9px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,.08);
}
.topnav a:hover { background: rgba(255,255,255,.18); }
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,.14);
    font-weight: 700;
}
.user-chip small { opacity: .82; font-weight: 400; }

.container { width: min(1220px, 100%); margin: 0 auto; padding: clamp(16px, 3vw, 30px); }
.hero { min-height: calc(100vh - 66px); display: grid; align-items: center; }
.hero-card {
    background: linear-gradient(135deg, #fff 0%, #eff8f1 100%);
    border: 1px solid var(--line);
    border-radius: 30px;
    padding: clamp(24px, 5vw, 48px);
    box-shadow: 0 24px 70px rgba(21,35,27,.11);
}

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; align-items: start; }
.card {
    background: rgba(255,255,255,.96);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: clamp(16px, 2.4vw, 22px);
    box-shadow: var(--shadow);
}
a.card { display: block; color: var(--ink); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
a.card:hover { transform: translateY(-2px); border-color: #b8d8c2; box-shadow: 0 16px 36px rgba(21,35,27,.12); }
.card h3 { margin-top: 0; }
.dashboard-card { position: relative; overflow: hidden; padding-top: 64px; }
.dashboard-card::after { content: ""; position: absolute; right: -28px; top: -28px; width: 96px; height: 96px; border-radius: 50%; background: rgba(13,107,63,.08); }
.card-icon {
    position: absolute;
    top: 18px;
    left: 18px;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: var(--brand-soft);
    color: var(--brand-dark);
}
.card-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }

.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 42px;
    border: 0;
    background: var(--brand);
    color: #fff;
    padding: 10px 16px;
    border-radius: 13px;
    cursor: pointer;
    font-weight: 800;
    line-height: 1.15;
    box-shadow: 0 8px 18px rgba(13,107,63,.18);
}
.btn:hover { background: var(--brand-dark); color: #fff; }
.btn.secondary { background: #e7efe8; color: var(--ink); box-shadow: none; }
.btn.secondary:hover { background: #d8e8dc; color: var(--ink); }
.btn.danger { background: var(--danger); box-shadow: 0 8px 18px rgba(180,35,24,.15); }

.form { display: grid; gap: 14px; max-width: 820px; }
label { display: grid; gap: 7px; font-weight: 800; }
input, select, textarea {
    width: 100%;
    min-height: 43px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    font: inherit;
    color: var(--ink);
    background: #fff;
    outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(13,107,63,.12); }
input[disabled] { background: #f1f5f2; color: var(--muted); }
textarea { min-height: 96px; resize: vertical; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }

.alert { padding: 13px 15px; border-radius: 14px; margin-bottom: 18px; background: #e9f7ef; border: 1px solid #bfe6cc; box-shadow: var(--shadow); }
.alert.error { background: var(--danger-soft); border-color: #f4b6ae; color: var(--danger); }

.table-wrap { overflow-x: auto; border-radius: 16px; border: 1px solid var(--line); box-shadow: var(--shadow); background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 760px; background: #fff; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { position: sticky; top: 0; z-index: 1; background: #edf5ef; color: var(--brand-dark); font-size: 13px; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fbfdfb; }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(62px, 1fr)); gap: 9px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
    display: block;
    min-height: 43px;
    text-align: center;
    padding: 11px 9px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: #fff;
    cursor: pointer;
    font-weight: 800;
    transition: background .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
}
.choice span:hover { transform: translateY(-1px); border-color: #b8d8c2; }
.choice input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.wide-choice { grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); }
.actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }

.teacher-box { border: 2px solid var(--brand); border-top: 8px solid var(--brand); background: linear-gradient(180deg, #ffffff 0%, #f7fbf8 100%); box-shadow: 0 12px 32px rgba(9,78,47,.12); }
.teacher-box h2 { margin: calc(clamp(16px, 2.4vw, 22px) * -1) calc(clamp(16px, 2.4vw, 22px) * -1) 14px; padding: 14px 18px; background: #e3f2e8; border-bottom: 1px solid #bfe6cc; border-radius: 16px 16px 0 0; color: var(--brand-dark); }
.drop-zone { transition: transform .15s ease, border-color .15s ease, background .15s ease; }
.drop-zone.drag-over { transform: translateY(-3px); border-color: var(--brand); background: #f0faf3; }
.unassigned-drop { border: 2px dashed #d92d20; background: #fff4f2; margin-bottom: 16px; }
.unassigned-row td { background: var(--danger-soft); }
.pending-ack-row td { background: var(--danger-soft); }
.assignment-list { display: grid; gap: 6px; max-height: 420px; overflow: auto; padding: 10px; border: 1px dashed #b9d8c2; border-radius: 14px; background: rgba(255,255,255,.75); }
.assignment-item { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 9px 10px; cursor: grab; }
.assignment-item.assigned-item { background: #e9f7ef; border-color: #bfe6cc; }
.assignment-item.dragging { opacity: .55; cursor: grabbing; }
.assignment-item strong { color: var(--brand); font-size: 12px; }

.student-status { border-left: 7px solid var(--line); }
.student-status.pending-class { background: #eefbf3; border-left-color: var(--brand); }
.student-status.done-class, .student-status.locked-class { background: var(--danger-soft); border-left-color: var(--danger); }
.student-pool { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; max-height: 260px; overflow: auto; padding: 4px; }
.student-drag { display: inline-flex; align-items: center; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 9px 12px; cursor: grab; font-weight: 800; box-shadow: 0 4px 12px rgba(23,38,29,.05); }
.student-drag.dragging { opacity: .55; cursor: grabbing; }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #edf5ef; border-radius: 999px; padding: 6px 8px 6px 12px; }
.chip button { border: 0; background: var(--danger); color: #fff; border-radius: 50%; width: 24px; height: 24px; cursor: pointer; line-height: 1; }

@media (max-width: 760px) {
    .topbar { position: static; align-items: flex-start; flex-direction: column; gap: 10px; }
    .topnav { width: 100%; justify-content: flex-start; }
    .topnav a, .user-chip { flex: 1 1 auto; justify-content: center; text-align: center; }
    .user-chip { flex-direction: column; gap: 1px; border-radius: 14px; }
    .brand-mark { width: 36px; height: 36px; border-radius: 12px; }
    .brand-text { font-size: 20px; }
    .container { padding: 14px; }
    .hero { min-height: auto; padding: 10px 0; }
    .hero-card { border-radius: 22px; }
    .grid { grid-template-columns: 1fr; gap: 12px; }
    .row { grid-template-columns: 1fr; }
    .actions { align-items: stretch; }
    .actions .btn, .actions a.btn, .actions form, .actions form .btn { width: 100%; }
    .btn { width: 100%; }
    .table-wrap { margin-inline: -2px; }
    table { min-width: 680px; }
    th, td { padding: 10px; }
    .choice-grid, .wide-choice { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
}

@media (max-width: 420px) {
    .topnav a { flex-basis: calc(50% - 8px); }
    .card { border-radius: 15px; }
    .choice-grid, .wide-choice { grid-template-columns: 1fr 1fr; }
    .assignment-item { grid-template-columns: auto 1fr; }
    .assignment-item strong { grid-column: 2; }
}
