:root {
  --green: #2f7d54;
  --green-dark: #245f41;
  --mint: #dff2e7;
  --violet: #7a4ea3;
  --rose: #d7687f;
  --gold: #d99a2b;
  --ink: #1d2a24;
  --muted: #68756f;
  --line: #dce5df;
  --panel: #ffffff;
  --soft: #f4f8f6;
  --danger: #ad3434;
  --shadow: 0 16px 45px rgba(29, 42, 36, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--soft);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  min-height: 100vh;
  padding: 24px 18px;
  color: #fff;
  background:
    linear-gradient(rgba(20, 74, 48, 0.88), rgba(20, 74, 48, 0.95)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='1200' viewBox='0 0 900 1200'%3E%3Crect width='900' height='1200' fill='%232f7d54'/%3E%3Cpath d='M130 1050C255 780 340 665 548 520C650 449 704 348 720 176' fill='none' stroke='%23c9ead6' stroke-width='26' stroke-linecap='round' opacity='.35'/%3E%3Cpath d='M217 905c71-122 202-170 356-141' fill='none' stroke='%23fff3cf' stroke-width='18' stroke-linecap='round' opacity='.32'/%3E%3Ccircle cx='660' cy='210' r='92' fill='%23e4b757' opacity='.25'/%3E%3Ccircle cx='205' cy='260' r='130' fill='%237a4ea3' opacity='.2'/%3E%3C/svg%3E");
  background-size: cover;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 26px;
}

.mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #fff;
  color: var(--green);
  font-size: 24px;
  font-weight: 800;
}

.brand-logo {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  object-fit: cover;
  object-position: center;
  background: #fff;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.05;
  letter-spacing: 0;
}

.brand p {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
}

.role-switcher {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 6px;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
}

.role-switcher button,
.nav button,
.ghost-on-dark {
  border: 0;
  color: #fff;
  background: transparent;
}

.role-switcher button {
  min-height: 38px;
  border-radius: 6px;
  text-align: left;
  padding: 8px 10px;
  font-weight: 700;
}

.role-switcher button.active,
.nav button.active {
  background: rgba(255, 255, 255, 0.18);
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  min-height: 42px;
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.9);
  text-align: left;
}

.nav-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.sidebar-footer {
  margin-top: 28px;
  padding: 14px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.12);
  font-size: 13px;
  line-height: 1.45;
}

.main {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.topbar-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 800;
}

.topbar h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.1;
  letter-spacing: 0;
}

.role-subtitle {
  margin: 6px 0 0;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 800;
}

.user-chip {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 210px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  color: #fff;
  background: var(--violet);
  font-weight: 900;
}

.user-chip strong,
.user-chip span {
  display: block;
}

.user-chip span {
  color: var(--muted);
  font-size: 12px;
}

.notification-wrap {
  position: relative;
}

.notification-bell {
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green-dark);
  background: #fff;
}

.notification-count {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0 6px;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: var(--danger);
  font-size: 11px;
  font-weight: 900;
}

.notification-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(380px, calc(100vw - 36px));
  max-height: 520px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  z-index: 30;
}

.notification-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.notification-header strong,
.notification-header span {
  display: block;
}

.notification-header span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.notification-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.notification-item {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.notification-item.unread {
  border-color: #b9e5c9;
  background: #edfbf2;
}

.notification-content {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.notification-content span {
  color: var(--muted);
  line-height: 1.35;
}

.notification-content small {
  color: var(--green-dark);
  font-weight: 800;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(0, 1.1fr) minmax(290px, 0.9fr);
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel,
.stat,
.login-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel h3,
.stat h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.panel p,
.stat p {
  color: var(--muted);
}

.panel p {
  margin: 5px 0 0;
  line-height: 1.45;
}

.stat {
  padding: 16px;
  min-height: 126px;
}

.welcome-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.36fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #ffffff, #f1faf5);
}

.welcome-card h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.welcome-card p {
  margin: 0 0 10px;
}

.welcome-card ul {
  margin: 0;
  padding-left: 20px;
  color: var(--ink);
  line-height: 1.6;
}

.welcome-help {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.welcome-help a,
.contact-row a {
  color: var(--green-dark);
  font-weight: 800;
}

.family-dashboard {
  display: grid;
  gap: 16px;
}

.family-welcome {
  margin-bottom: 0;
}

.dashboard-section {
  margin-top: 0;
}

.dashboard-card {
  min-height: 168px;
}

.dashboard-card > strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
  line-height: 1.25;
}

.dashboard-list {
  display: grid;
  gap: 10px;
}

.dashboard-list-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.dashboard-list-item p {
  margin-bottom: 0;
}

.dashboard-list-item.split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stat strong {
  display: block;
  margin-top: 12px;
  font-size: 30px;
}

.tag,
.status,
.mini-tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.tag {
  color: var(--green-dark);
  background: var(--mint);
}

.tag.violet {
  color: var(--violet);
  background: #efe5f7;
}

.tag.gold {
  color: #7a520d;
  background: #fff2d8;
}

.status {
  color: var(--green-dark);
  background: #e6f6ed;
}

.status.pending {
  color: #805911;
  background: #fff2d8;
}

.status.missing {
  color: var(--danger);
  background: #fbe5e5;
}

.mini-tag {
  min-height: 22px;
  padding: 3px 8px;
  color: var(--muted);
  background: var(--soft);
}

.program-list,
.resource-list,
.message-list,
.homework-list,
.family-list {
  display: grid;
  gap: 10px;
}

.program-row,
.resource-row,
.message,
.homework,
.family-row {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.reply-target {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid #b9e5c9;
  border-radius: 8px;
  color: var(--green-dark);
  background: #edfbf2;
}

.reply-target strong,
.reply-target span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
}

.reply-target span {
  color: var(--muted);
  font-size: 13px;
}

.program-row {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.program-row h4,
.resource-row h4,
.homework h4,
.family-row h4 {
  margin: 0;
  font-size: 15px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.attendance {
  display: grid;
  gap: 10px;
}

.attendance-list {
  display: grid;
  gap: 12px;
}

.attendance-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.attendance-card h4 {
  margin: 0;
  font-size: 16px;
}

.session-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(116px, 1fr));
  gap: 8px;
}

.session-cell {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.session-cell strong {
  font-size: 12px;
  color: var(--muted);
}

.session-cell select {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 12px;
}

.attendance-status {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.announcement-row p {
  margin: 0;
}

.contact-list {
  display: grid;
  gap: 10px;
}

.contact-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.emergency-panel {
  border-color: #f0c7c7;
  background: #fff8f8;
}

.emergency-panel h3,
.emergency-panel p {
  color: var(--danger);
}

.session-cell.present {
  border-color: #9ed6b4;
  background: #edf8f1;
}

.session-cell.absent {
  border-color: #f1b4b4;
  background: #fff0f0;
}

.session-cell.excused {
  border-color: #ecd18e;
  background: #fff8e5;
}

.attendance-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) repeat(6, minmax(42px, 1fr));
  gap: 6px;
  align-items: center;
}

.session-dot {
  min-height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--soft);
  font-weight: 800;
}

.session-dot.done {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.session-dot.missed {
  color: var(--danger);
  border-color: #f4bbbb;
  background: #fff0f0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.required-form {
  margin-top: 18px;
}

.form-type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.form-type-card {
  display: grid;
  gap: 10px;
  align-content: space-between;
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.form-type-card strong {
  line-height: 1.25;
}

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.inline-check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  line-height: 1.35;
}

.inline-check input {
  width: auto;
  min-height: auto;
  margin-top: 2px;
  flex: 0 0 auto;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cfdad4;
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.btn {
  min-height: 40px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  padding: 9px 13px;
  color: #fff;
  background: var(--green);
  font-weight: 850;
  text-decoration: none;
}

.btn:hover {
  background: var(--green-dark);
}

.btn.secondary {
  color: var(--green-dark);
  border: 1px solid var(--line);
  background: #fff;
}

.btn.secondary:hover {
  background: var(--soft);
}

.btn.warn {
  background: var(--violet);
}

.btn.mini {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 12px;
}

.btn.danger {
  background: var(--danger);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
  background:
    linear-gradient(90deg, rgba(19, 79, 51, 0.9), rgba(47, 125, 84, 0.72)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='900' viewBox='0 0 1200 900'%3E%3Crect width='1200' height='900' fill='%23dff2e7'/%3E%3Cpath d='M70 780c210-168 378-204 620-136 190 54 307 8 430-116' fill='none' stroke='%237a4ea3' stroke-width='35' stroke-linecap='round' opacity='.23'/%3E%3Cpath d='M167 610c155-214 329-315 624-325' fill='none' stroke='%232f7d54' stroke-width='28' stroke-linecap='round' opacity='.34'/%3E%3Ccircle cx='876' cy='206' r='116' fill='%23d99a2b' opacity='.28'/%3E%3C/svg%3E");
  background-size: cover;
}

.login-hero {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 100vh;
  padding: 44px;
  color: #fff;
}

.login-hero h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(36px, 6vw, 74px);
  line-height: 0.95;
  letter-spacing: 0;
}

.login-logo {
  width: min(310px, 72vw);
  height: auto;
  margin-bottom: 22px;
  border: 2px solid rgba(255, 255, 255, 0.62);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.28);
}

.login-hero p {
  max-width: 640px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 18px;
  line-height: 1.5;
}

.login-box {
  align-self: center;
  margin: 26px;
  padding: 24px;
}

.login-box h2 {
  margin: 0 0 8px;
}

.helper {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--soft);
  font-size: 13px;
  line-height: 1.45;
}

.auth-status {
  margin: 14px 0 0;
  padding: 11px 12px;
  border: 1px solid #b9e5c9;
  border-radius: 8px;
  color: var(--green-dark);
  background: #edfbf2;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.auth-status.error {
  color: var(--danger);
  border-color: #f2bbbb;
  background: #fff0f0;
}

.auth-status.success {
  color: var(--green-dark);
  border-color: #b9e5c9;
  background: #edfbf2;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  padding: 13px 15px;
  border-radius: 8px;
  color: #fff;
  background: var(--green-dark);
  box-shadow: var(--shadow);
  font-weight: 800;
  z-index: 20;
}

.hidden {
  display: none !important;
}

@media (max-width: 960px) {
  .shell,
  .login-view {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .grid.two,
  .grid.three,
  .welcome-card,
  .form-type-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .notification-wrap {
    order: 3;
  }

  .notification-panel {
    right: auto;
    left: 0;
  }

  .session-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .login-hero {
    min-height: 44vh;
  }
}

@media (max-width: 620px) {
  .main,
  .login-hero {
    padding: 18px;
  }

  .login-box {
    margin: 18px;
  }

  .program-row,
  .attendance-row {
    grid-template-columns: 1fr;
  }

  .attendance-row {
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
  }

  .contact-row {
    grid-template-columns: 1fr;
  }

  .dashboard-list-item.split {
    align-items: flex-start;
    flex-direction: column;
  }

  .quick-actions .btn {
    width: 100%;
  }

  .topbar-actions .user-chip {
    min-width: 0;
    flex: 1 1 100%;
  }
}
