:root {
  --ink: #17231f;
  --muted: #68736f;
  --forest: #173d36;
  --green: #247566;
  --mint: #d9ebe6;
  --paper: #f5f7f5;
  --white: #ffffff;
  --line: #d9dfdc;
  --danger: #a23b32;
  --gold: #b88a3d;
  --shadow: 0 18px 44px rgba(21, 42, 36, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0.65)),
    radial-gradient(circle at 1px 1px, rgba(23, 61, 54, 0.12) 1px, transparent 0);
  background-size: auto, 24px 24px;
}

button,
input,
select {
  font: inherit;
}

button,
.secondary-button {
  min-height: 44px;
  border: 1px solid var(--forest);
  border-radius: 6px;
  padding: 0 18px;
  background: var(--forest);
  color: var(--white);
  font-weight: 750;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

button:hover {
  background: var(--green);
}

button:active {
  transform: translateY(1px);
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--forest);
}

.secondary-button:hover {
  color: var(--white);
}

.danger-button {
  border-color: #e4c3bf;
  background: #fff4f2;
  color: var(--danger);
}

.danger-button:hover {
  border-color: var(--danger);
  background: var(--danger);
}

.compact {
  min-height: 36px;
  padding: 0 12px;
}

.top-nav {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 max(24px, calc((100vw - 1440px) / 2));
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(23, 61, 54, 0.96);
  color: var(--white);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand span {
  font-family: Georgia, serif;
  font-size: 20px;
  letter-spacing: 0;
}

.brand strong {
  color: #bfdbd3;
  font-size: 13px;
  font-weight: 600;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
}

.nav-links a {
  color: var(--white);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.nav-links form {
  margin: 0;
}

.user-name {
  color: #c5d7d2;
  font-size: 13px;
}

.icon-button {
  display: inline-grid;
  min-width: 40px;
  min-height: 40px;
  place-items: center;
  border-color: rgba(255, 255, 255, 0.25);
  padding: 0;
  background: transparent;
}

.icon-button svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.page-shell {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
  padding: 44px 0 72px;
}

.page-head,
.section-title,
.dialog-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 800px;
  margin-bottom: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 500;
  line-height: 1.04;
}

h2 {
  margin-bottom: 20px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
  font-weight: 500;
}

h3 {
  margin-bottom: 4px;
  font-size: 18px;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.notice {
  margin: 0 0 24px;
  border-left: 4px solid var(--green);
  border-radius: 4px;
  padding: 15px 18px;
  background: var(--mint);
  color: var(--forest);
  font-weight: 650;
}

.notice.error {
  border-color: var(--danger);
  background: #fff0ee;
  color: var(--danger);
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.tool-panel,
.list-panel,
.contacts-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.tool-panel {
  padding: 28px;
}

.compact-tool {
  grid-column: span 1;
}

.tool-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 16px;
}

.tool-form .wide,
.tool-form > button {
  grid-column: span 2;
}

label {
  display: grid;
  gap: 7px;
  color: #4d5955;
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-width: 0;
  height: 44px;
  border: 1px solid #cbd4d0;
  border-radius: 5px;
  padding: 0 12px;
  outline: none;
  background: var(--white);
  color: var(--ink);
}

input:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(36, 117, 102, 0.12);
}

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

.time-field {
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.time-field legend {
  margin-bottom: 7px;
  color: #4d5955;
  font-size: 13px;
  font-weight: 700;
}

.time-field > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 7px;
}

.time-field label span {
  font-size: 10px;
  font-weight: 600;
}

.time-separator {
  padding-bottom: 12px;
  color: var(--muted);
  font-weight: 800;
}

.list-panel {
  margin-bottom: 24px;
  overflow: hidden;
}

.section-title {
  padding: 24px 26px;
  border-bottom: 1px solid var(--line);
}

.section-title h2,
.dialog-head h2 {
  margin-bottom: 0;
}

.filters {
  display: flex;
  gap: 12px;
}

.filters label {
  min-width: 190px;
}

.schedule-list,
.availability-list {
  display: grid;
}

.schedule-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  min-height: 112px;
  border-bottom: 1px solid var(--line);
  padding: 20px 26px;
}

.schedule-row:last-child {
  border-bottom: 0;
}

.date-block {
  display: grid;
  gap: 5px;
}

.date-block strong {
  font-family: Georgia, serif;
  font-size: 18px;
  font-weight: 500;
}

.date-block span {
  color: var(--green);
  font-size: 14px;
  font-weight: 750;
}

.schedule-detail {
  min-width: 0;
}

.schedule-detail strong {
  display: block;
  margin: 5px 0 3px;
}

.schedule-detail p {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-label {
  display: inline-block;
  color: var(--green);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.status-blocked .status-label,
.status-cancelled .status-label {
  color: var(--danger);
}

.row-action form {
  margin: 0;
}

.empty-state {
  margin: 0;
  padding: 32px 26px;
}

.availability-card {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  min-height: 128px;
  border-bottom: 1px solid var(--line);
  padding: 20px 26px;
}

.availability-card:last-child {
  border-bottom: 0;
}

.availability-card p {
  margin-bottom: 0;
}

.availability-date {
  display: grid;
  border-left: 3px solid var(--gold);
  padding-left: 16px;
}

.availability-date span,
.availability-date small {
  color: var(--muted);
}

.availability-date strong {
  margin: 3px 0;
  font-family: Georgia, serif;
  font-size: 30px;
  font-weight: 500;
}

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

.contacts-panel {
  position: sticky;
  top: 96px;
  padding: 26px;
  background: var(--forest);
  color: var(--white);
}

.contacts-panel h2,
.contacts-panel p,
.contacts-panel small {
  color: inherit;
}

.contacts-panel > p:not(.eyebrow) {
  color: #c4d5d0;
}

.contacts-panel .eyebrow {
  color: #8dd0bf;
}

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

.contact-card {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  padding: 13px;
  color: var(--white);
  text-decoration: none;
  transition: background 160ms ease;
}

.contact-card:hover {
  background: rgba(255, 255, 255, 0.08);
}

.contact-card div {
  display: grid;
  gap: 2px;
}

.contact-card small,
.contact-card span {
  color: #bed0cb;
}

.whatsapp-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: #25d366;
  color: var(--white) !important;
  font-size: 18px;
}

.whatsapp-icon svg {
  width: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.history-dialog {
  width: min(900px, calc(100% - 32px));
  max-height: 82vh;
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 30px 90px rgba(8, 25, 20, 0.3);
}

.history-dialog::backdrop {
  background: rgba(9, 27, 22, 0.68);
  backdrop-filter: blur(4px);
}

.dialog-head {
  position: sticky;
  z-index: 2;
  top: 0;
  border-bottom: 1px solid var(--line);
  padding: 22px 26px;
  background: var(--white);
}

.dialog-head .icon-button {
  border-color: var(--line);
  color: var(--ink);
}

.two-column-admin {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  align-items: start;
  gap: 24px;
}

.stack-form {
  display: grid;
  gap: 16px;
}

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

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

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

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

td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 480px);
  align-items: center;
  gap: 8vw;
  min-height: calc(100vh - 116px);
}

.auth-brand h1 {
  max-width: 720px;
  font-size: clamp(48px, 7vw, 88px);
}

.auth-brand > p:last-child {
  max-width: 560px;
  font-size: 18px;
}

.auth-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 38px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.auth-card h2 {
  font-size: 36px;
}

@media (max-width: 1000px) {
  .student-layout,
  .two-column-admin {
    grid-template-columns: 1fr;
  }

  .contacts-panel {
    position: static;
  }

  .auth-shell {
    grid-template-columns: 1fr;
    gap: 36px;
    padding: 40px 0;
  }
}

@media (max-width: 760px) {
  .top-nav {
    min-height: 64px;
    padding: 0 16px;
  }

  .brand strong,
  .user-name {
    display: none;
  }

  .nav-links {
    gap: 12px;
  }

  .page-shell {
    width: min(100% - 28px, 1440px);
    padding-top: 28px;
  }

  .page-head,
  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .action-grid,
  .tool-form,
  .time-pair {
    grid-template-columns: 1fr;
  }

  .tool-form .wide,
  .tool-form > button,
  .time-pair {
    grid-column: span 1;
  }

  .tool-panel {
    padding: 22px;
  }

  .filters {
    display: grid;
    width: 100%;
  }

  .filters label {
    min-width: 0;
  }

  .schedule-row,
  .availability-card {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 20px;
  }

  .row-action button,
  .availability-card button {
    width: 100%;
  }

  .schedule-detail p {
    white-space: normal;
  }

  .auth-brand h1 {
    font-size: 48px;
  }

  .auth-card {
    padding: 26px;
  }
}
