@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=Literata:wght@600;700&display=swap");

:root {
  --bg: #f4f7f6;
  --bg-soft: #edf2f0;
  --surface: #ffffff;
  --surface-alt: #f8faf9;
  --line: #d7dfdc;
  --text: #1f2b28;
  --muted: #62706b;
  --accent: #4f8a7c;
  --accent-strong: #2f5f54;
  --ok: #2f7a64;
  --error: #9a5959;
  --radius: 14px;
  --shadow: 0 10px 28px rgba(23, 41, 35, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", "Trebuchet MS", "Helvetica Neue", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at -8% -6%, rgba(79, 138, 124, 0.1), transparent 70%),
    radial-gradient(900px 420px at 106% 0%, rgba(47, 95, 84, 0.06), transparent 70%),
    var(--bg);
}

a {
  color: var(--text);
  text-decoration: none;
}

a:hover {
  color: var(--accent-strong);
}

.app-layout {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: 236px;
  border-right: 1px solid var(--line);
  background: rgba(244, 247, 246, 0.96);
  display: flex;
  flex-direction: column;
  padding: 12px 10px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 12px;
  margin-bottom: 10px;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(145deg, #71a99a, #2f5f54);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  letter-spacing: 0.05em;
}

.brand-text {
  display: grid;
  gap: 2px;
}

.brand-text strong {
  font-family: "Literata", Georgia, serif;
  font-size: 19px;
  line-height: 1.1;
}

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

.sidebar-nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  border: 1px solid transparent;
  color: var(--text);
  font-size: 14px;
  border-radius: 10px;
  padding: 9px 10px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.nav-item-form {
  margin: 0;
}

.nav-item-button {
  width: 100%;
  background: transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--surface-alt);
  color: var(--accent-strong);
}

.nav-item.active {
  background: rgba(79, 138, 124, 0.16);
  border-color: rgba(47, 95, 84, 0.26);
  color: var(--accent-strong);
  font-weight: 600;
}

.nav-label {
  line-height: 1.2;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 4px;
}

.nav-item--logout {
  color: var(--muted);
}

.content-area {
  flex: 1;
  min-width: 0;
  padding: 30px 28px 28px;
}

.auth-main {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

h1,
h2 {
  font-family: "Literata", Georgia, serif;
  color: var(--text);
}

h1 {
  margin: 0 0 4px;
  font-size: 48px;
  line-height: 1.05;
}

h2 {
  margin: 0 0 10px;
  font-size: 26px;
}

p {
  margin: 0 0 12px;
}

.page-head {
  margin-bottom: 18px;
}

.page-head h1 {
  font-size: 46px;
}

.page-head p {
  color: var(--muted);
  margin: 0;
}

.messages {
  margin: 0 0 14px;
  display: grid;
  gap: 8px;
}

.message {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-alt);
  color: var(--text);
  padding: 10px 12px;
}

.message.success {
  border-color: rgba(47, 122, 100, 0.26);
  background: rgba(47, 122, 100, 0.1);
}

.message.error {
  border-color: rgba(154, 89, 89, 0.28);
  background: rgba(154, 89, 89, 0.12);
}

.card,
.panel,
.table-wrap,
.stat-card,
.student-card,
.week-column,
.announcement-card,
.resource-card,
.chat-panel,
.chat-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card,
.panel {
  padding: 16px;
}

.form {
  display: grid;
  gap: 12px;
  max-width: 520px;
}

.form-row {
  display: grid;
  gap: 6px;
}

label {
  color: var(--muted);
  font-size: 14px;
}

.input,
input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  font-size: 14px;
}

.input:focus,
input:focus,
textarea:focus,
select:focus {
  border-color: rgba(79, 138, 124, 0.55);
  box-shadow: 0 0 0 3px rgba(79, 138, 124, 0.2);
}

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

.btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  padding: 9px 13px;
  cursor: pointer;
  font-weight: 600;
}

.btn:hover {
  border-color: rgba(79, 138, 124, 0.45);
  color: var(--accent-strong);
}

button.btn[type="submit"],
input.btn[type="submit"],
.btn-accent {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

button.btn[type="submit"]:hover,
input.btn[type="submit"]:hover,
.btn-accent:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  color: #fff;
}

.btn-small {
  padding: 7px 11px;
  font-size: 13px;
}

.btn-with-icon,
.inline-icon-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.error {
  color: var(--error);
  font-size: 13px;
}

.tag,
.badge {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--text);
  background: var(--surface);
}

.badge-todo {
  border-color: rgba(79, 138, 124, 0.36);
  background: rgba(79, 138, 124, 0.14);
}

.badge-done {
  border-color: rgba(47, 122, 100, 0.3);
  background: rgba(47, 122, 100, 0.11);
}

.badge-late {
  border-color: rgba(154, 89, 89, 0.3);
  background: rgba(154, 89, 89, 0.1);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.list li {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 10px 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

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

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.table th {
  color: var(--muted);
  background: var(--bg-soft);
  text-align: left;
  font-size: 13px;
  letter-spacing: 0.01em;
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr:hover td {
  background: var(--surface-alt);
}

.th-title {
  font-weight: 700;
  color: var(--text);
}

.cell {
  min-width: 190px;
  display: grid;
  gap: 8px;
}

.input-score {
  max-width: 120px;
}


.plan-checkbox-list {
  display: grid;
  gap: 8px;
}

.plan-checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.inline-assignment-form {
  display: grid;
  gap: 10px;
  min-width: 260px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.stat-card {
  padding: 14px 16px;
}

.stat-card .value {
  font-family: "Literata", Georgia, serif;
  font-size: 30px;
  line-height: 1.1;
}

.schedule-list {
  display: grid;
  gap: 8px;
}

.schedule-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-alt);
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 90px 1fr auto;
  align-items: center;
  gap: 10px;
}

.schedule-time {
  font-weight: 700;
  color: var(--accent-strong);
}

.metric-bars {
  display: grid;
  gap: 10px;
}

.metric-row {
  display: grid;
  gap: 5px;
}

.metric-row strong {
  font-size: 13px;
}

.metric-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #e3ebe8;
}

.metric-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #71a99a, #2f5f54);
}

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

.announcement-card,
.resource-card,
.student-card {
  padding: 14px 15px;
}

.announcement-card h3,
.resource-card h3,
.student-card h3 {
  margin: 0 0 8px;
  font-size: 22px;
  font-family: "Literata", Georgia, serif;
}

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

.student-meta {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.student-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.week-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(190px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.week-column {
  padding: 10px;
  min-height: 320px;
}

.week-column.is-today {
  border-color: rgba(79, 138, 124, 0.44);
  box-shadow: 0 0 0 2px rgba(79, 138, 124, 0.14), var(--shadow);
}

.week-column h3 {
  font-size: 18px;
  margin: 0;
  font-family: "Literata", Georgia, serif;
}

.week-column small {
  color: var(--muted);
}

.event-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-alt);
  padding: 8px 9px;
  margin-top: 8px;
  display: grid;
  gap: 4px;
}

.event-card .time {
  color: var(--accent-strong);
  font-weight: 700;
}

.chat-shell {
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 12px;
  min-height: 540px;
}

.chat-list,
.chat-panel {
  padding: 12px;
}

.chat-item {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px;
  display: grid;
  gap: 2px;
}

.chat-item:hover {
  background: var(--surface-alt);
}

.chat-item.active {
  border-color: rgba(79, 138, 124, 0.34);
  background: rgba(79, 138, 124, 0.13);
}

.chat-bubbles {
  min-height: 360px;
  display: grid;
  gap: 10px;
}

.bubble {
  max-width: 74%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-alt);
  padding: 10px;
  display: grid;
  gap: 3px;
}

.bubble.outgoing {
  justify-self: end;
  background: rgba(79, 138, 124, 0.14);
  border-color: rgba(79, 138, 124, 0.32);
}

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

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

.course-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-alt);
  padding: 14px;
}

.course-card h3 {
  margin: 0 0 8px;
  font-size: 20px;
  font-family: "Literata", Georgia, serif;
}

.course-meta {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.course-actions,
.auth-actions,
.action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.course-actions {
  margin-top: 10px;
}

.auth-actions {
  margin-top: 12px;
}

.action-row {
  justify-content: space-between;
}

.invite-code-output {
  margin: 0 0 10px;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.resource-card p,
.announcement-card p {
  color: var(--muted);
}

.auth-card {
  width: 100%;
  max-width: 460px;
  padding: 22px;
}

.auth-brand {
  text-align: center;
  margin-bottom: 18px;
}

.auth-brand h1 {
  font-size: 38px;
  margin: 8px 0 0;
}

.auth-brand p {
  color: var(--muted);
  margin: 2px 0 0;
}

.attendance-cell {
  text-align: center;
}

.attendance-yes {
  color: var(--ok);
  font-weight: 700;
}

.attendance-no,
.attendance-empty {
  color: var(--muted);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card,
.panel,
.table-wrap,
.stat-card,
.student-card,
.week-column,
.announcement-card,
.resource-card,
.chat-panel,
.chat-list {
  animation: fadeUp 0.34s ease both;
}

@media (max-width: 1200px) {
  .student-grid,
  .announcement-grid,
  .library-grid,
  .course-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .app-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .sidebar-footer {
    margin-top: 8px;
    display: flex;
    gap: 6px;
  }

  .content-area {
    padding: 18px;
  }

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

  .chat-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  h1,
  .page-head h1,
  .auth-brand h1 {
    font-size: 34px;
  }

  .stats-grid,
  .student-grid,
  .announcement-grid,
  .library-grid,
  .course-grid {
    grid-template-columns: 1fr;
  }

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

  .week-grid {
    grid-template-columns: repeat(7, minmax(210px, 1fr));
  }

  .table th,
  .table td {
    padding: 8px 9px;
  }
}
