

:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #637083;
  --line: #d9e0e8;
  --accent: #0f766e;
  --accent-2: #2563eb;
  --warning: #b45309;
  --danger: #b91c1c;
  --ok: #15803d;
  --soft: #edf2f7;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  background: #111827;
  color: #f9fafb;
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100vh;
  overflow-y: auto;
}

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

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  font-weight: 800;
  font-size: 21px;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p {
  margin: 0;
}

.brand h1 {
  font-size: 19px;
}

.brand p {
  color: #b8c2d1;
  font-size: 13px;
  margin-top: 3px;
}

.tabs {
  display: grid;
  gap: 8px;
}

.nav-item {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  color: #dbe4ee;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  text-align: right;
}

.nav-item:hover,
.nav-item.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.nav-item span {
  width: 22px;
  text-align: center;
}

.settings-block {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.settings-block label {
  display: grid;
  gap: 6px;
  color: #c8d2df;
  font-size: 13px;
}

.settings-block input,
.control-input,
.lesson-table input,
.lesson-table select {
  width: 100%;
  height: 32px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 4px 8px;
  background: #ffffff;
  color: var(--text);
  font-size: 13px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 8px center;
  cursor: pointer;
}
.lesson-table select:hover {
  border-color: #2d7d6b;
}

.lesson-table select.over-quota-field {
  border-color: var(--danger);
  background: #fee2e2;
  color: var(--danger);
  font-weight: 700;
}

.primary-button,
.ghost-button,
.small-button,
.chip-button {
  min-height: 36px;
  border-radius: 7px;
  border: 1px solid transparent;
  padding: 7px 12px;
}

.primary-button {
  color: white;
  background: var(--accent);
}

.ghost-button {
  color: #e5edf7;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.24);
}

.small-button,
.chip-button {
  background: #ffffff;
  color: var(--text);
  border-color: var(--line);
}

.chip-button.active {
  background: #dff3ef;
  border-color: #9bd2c8;
  color: #0f5f58;
  font-weight: 700;
}

.workspace {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100vh;
  overflow: hidden;
}

.topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  padding: 20px 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
}

.topbar h2 {
  font-size: 26px;
}

.topbar p {
  color: var(--muted);
  margin-top: 4px;
}

.kpis {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.kpi {
  min-width: 108px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fbfcfe;
}

.kpi strong {
  display: block;
  font-size: 20px;
}

.kpi span {
  color: var(--muted);
  font-size: 12px;
}
.kpi-alert {
  background: #fee2e2;
  border-color: #fca5a5;
}
.kpi-alert strong {
  color: #dc2626;
}
.kpi-alert span {
  color: #dc2626;
}

.content {
  padding: 22px 28px 34px;
  overflow-y: auto;
  height: 100%;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.grade-workspace {
  width: 100%;
}

.classes-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px 18px;
  align-items: start;
}

.class-panel {
  box-shadow: none;
  border: 0;
  background: transparent;
}

.class-panel .panel-header {
  min-height: 42px;
  padding: 0 6px 6px;
  border-bottom: 0;
  justify-content: center;
  text-align: center;
}

.class-panel .panel-header h3 {
  font-size: 18px;
  font-weight: 800;
}

.class-panel .panel-header .status-pill {
  display: none;
}

.class-panel .panel-body {
  padding: 0;
  background: transparent;
}

.class-title-row {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr);
  gap: 8px;
  align-items: center;
  width: 100%;
}

.class-title-row select {
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 6px;
  background: #ffffff;
  color: var(--text);
  font-size: 14px;
}


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

.panel-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-header h3 {
  margin: 0;
  font-size: 18px;
}

.panel-body {
  padding: 16px 18px;
}

.grade-strip,
.class-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.class-strip {
  margin: 0;
}

.lesson-table,
.summary-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.basket-title {
  display: none;
}

.basket-title h4 {
  margin: 0;
  font-size: 16px;
}

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

.lesson-table th,
.lesson-table td,
.summary-table th,
.summary-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
  text-align: right;
  vertical-align: middle;
}

.lesson-table th,
.summary-table th {
  color: #475569;
  background: #f8fafc;
  font-size: 13px;
}

.lesson-table th:nth-child(2),
.lesson-table td:nth-child(2) {
  width: 98px;
}

.lesson-table th:last-child,
.lesson-table td:last-child {
  width: 64px;
  text-align: center;
}

.class-panel .lesson-table th,
.class-panel .lesson-table td {
  border: 2px solid #111827;
  padding: 4px 5px;
  height: 32px;
}

.class-panel .lesson-table th {
  color: #000;
  background: #d9d9d9;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
  font-family: "Segoe UI", Arial, sans-serif;
}

.class-panel .lesson-table td {
  background: #ffffff;
}

.class-panel .lesson-table th:nth-child(1),
.class-panel .lesson-table td:nth-child(1) {
  width: 43%;
}

.class-panel .lesson-table th:nth-child(2),
.class-panel .lesson-table td:nth-child(2) {
  width: 54px;
  text-align: center;
}

.class-panel .lesson-table th:nth-child(3),
.class-panel .lesson-table td:nth-child(3) {
  width: 43%;
}

.class-panel .lesson-table th:last-child,
.class-panel .lesson-table td:last-child {
  width: 30px;
}

.class-panel .lesson-table select,
.class-panel .lesson-table input {
  height: 26px;
  border: 0;
  border-radius: 0;
  padding: 2px 3px;
  text-align: center;
  font-size: 14px;
  background: transparent;
  overflow: hidden;
  text-overflow: ellipsis;
}

.class-panel .lesson-table input[type="number"] {
  font-weight: 700;
}

.class-panel .total-row {
  margin-top: 6px;
  padding: 4px 6px;
  justify-content: center;
  background: transparent;
}

.class-panel .total-row strong {
  font-size: 18px;
}

.class-panel .total-row .status-pill { /* visible */ }

.class-panel .primary-button {
  margin-top: 8px;
  font-size: 12px;
  padding: 5px 10px;
  min-height: 29px;
}
.copy-grade-button {
  margin-top: 6px;
  margin-right: 8px;
  padding: 5px 11px;
  background: #e8f4f0;
  color: #2d7d6b;
  border: 1.5px solid #2d7d6b;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  min-height: 29px;
}
.copy-grade-button:hover {
  background: #2d7d6b;
  color: #fff;
}

.icon-button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.class-panel .icon-button {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 16px;
  line-height: 1;
  display: inline-grid;
  place-items: center;
  color: #b91c1c;
}

.icon-button.danger {
  color: var(--danger);
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
  background: var(--soft);
  border-radius: 8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 99px;
  padding: 4px 10px;
  font-weight: 700;
  font-size: 13px;
}

.status-ok {
  color: var(--ok);
  background: #dcfce7;
}

.status-warn {
  color: var(--warning);
  background: #fef3c7;
}

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

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

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

.alert-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warning);
  margin-top: 5px;
}

.alert-row.danger .alert-dot {
  background: var(--danger);
}

.alert-row.ok .alert-dot {
  background: var(--ok);
}

.alert-row strong,
.alert-row p {
  margin: 0;
}

.alert-row p {
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.45;
}

.empty-state {
  color: var(--muted);
  padding: 26px;
  text-align: center;
}

.bar {
  height: 10px;
  border-radius: 99px;
  background: #e2e8f0;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--accent-2);
}

.bar span.warn {
  background: var(--warning);
}

.bar span.danger {
  background: var(--danger);
}

.free-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.rules-section {
  margin-top: 20px;
}

.rules-section h4 {
  margin: 0 0 10px;
  font-size: 16px;
}

.compact-input {
  max-width: 110px;
}

.teacher-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.teacher-actions .control-input {
  width: 180px;
  flex-shrink: 0;
}

.teachers-table {
  table-layout: auto;
}

.teachers-table th:nth-child(1),
.teachers-table td:nth-child(1) {
  width: 160px;
  max-width: 160px;
}

.teachers-table th:nth-child(2),
.teachers-table td:nth-child(2),
.teachers-table th:nth-child(3),
.teachers-table td:nth-child(3) {
  width: 86px;
}

.teachers-table th:nth-child(4),
.teachers-table td:nth-child(4) {
  width: 190px;
}

.teachers-table th:nth-child(5),
.teachers-table td:nth-child(5) {
  width: auto;
}

.teachers-table th:nth-child(6),
.teachers-table td:nth-child(6) {
  width: 90px;
  text-align: center;
  white-space: nowrap;
  padding: 9px 6px;
}

.teachers-table td:first-child strong {
  display: inline-block;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.homeroom-class-select {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 7px;
  background: #ffffff;
  color: var(--text);
}

.teacher-homeroom-name {
  color: #15803d;
  font-weight: 700;
}

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

.day-box h4 {
  margin: 0 0 8px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  border-radius: 99px;
  background: #eef2ff;
  color: #3730a3;
  padding: 4px 8px;
  font-size: 12px;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
    overflow: visible;
  }

  body {
    height: auto;
    overflow: auto;
  }

  .workspace {
    height: auto;
    overflow-y: visible;
  }

  .sidebar {
    height: auto;
    z-index: 100;
    padding: 8px 10px;
    gap: 8px;
  }

  .brand {
    display: none;
  }

  .tabs {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 3px;
  }

  .nav-item {
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    padding: 6px 3px;
    min-height: 52px;
  }

  .nav-item span {
    font-size: 18px;
  }

  .nav-item strong {
    font-size: 10px;
    font-weight: 600;
    display: block;
  }

  .settings-block {
    display: none;
  }

  .layout-grid,
  .topbar {
  
/* ===== LESSON CARD LAYOUT (redesign 2026) ===== */
.lesson-cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0 8px;
  max-height: 55vh;
  overflow-y: auto;
  overflow-x: visible;
}

.lesson-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  transition: box-shadow 0.15s ease;
}

.lesson-card:nth-child(even) {
  background: #f8fafc;
}

.lesson-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.lesson-card.lesson-card-over {
  border-color: #fca5a5;
  background: #fff5f5;
}

.lesson-card.lesson-card-over:nth-child(even) {
  background: #fff0f0;
}

.lesson-card.lesson-card-exact {
  border-color: #86efac;
  background: #f0fff4;
}

.lesson-card.lesson-card-exact:nth-child(even) {
  background: #eafff2;
}

.lc-subject { flex: 2 1 0; min-width: 0; overflow: hidden; }
.lc-hours { flex: 0 0 46px; display: flex; justify-content: center; align-items: center; }
.lc-teacher { flex: 3 1 0; min-width: 0; overflow: hidden; }
.lc-del { flex: 0 0 30px; display: flex; justify-content: center; align-items: center; }

.lc-empty {
  text-align: center;
  color: #9ca3af;
  font-size: 14px;
  padding: 24px 0;
}

/* ===== LESSON FOOTER ===== */
.lesson-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 4px 4px;
  border-top: 1px solid #e5e7eb;
  margin-top: 6px;
}

.lesson-footer-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.lf-total {
  font-weight: 600;
  font-size: 14px;
  color: #374151;
}

.lesson-footer-btns {
  display: flex;
  gap: 8px;
  align-items: center;
}
