:root {
  --sand: #f6efe0;
  --paper: #fffaf0;
  --ink: #10212e;
  --ink-soft: #4f6275;
  --reef: #0f5f72;
  --reef-deep: #073a4a;
  --foam: #d8f3f5;
  --sun: #ff7a2f;
  --sun-soft: #ffb26b;
  --line: #dbcfae;
  --ok: #118857;
  --warn: #b33939;
  --card-shadow: 0 14px 30px #3f2a111c;
  --card-hover-shadow: 0 22px 40px #3f2a1130;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, #ffd8ac66, transparent 35%),
    radial-gradient(circle at 88% 18%, #91d8de66, transparent 30%),
    linear-gradient(165deg, #f9f1e5 0%, #f4e8d6 48%, #eddcc6 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 7px,
    #73472c 7px,
    #73472c 8px
  );
}

h1,
h2,
h3,
.display,
.logo {
  font-family: "Bebas Neue", sans-serif;
  letter-spacing: 0.05em;
}

.container {
  width: min(1360px, calc(100% - 2rem));
  margin: 0 auto;
}

.top {
  padding: 1.2rem 0 0.85rem;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: var(--reef-deep);
}

.badge {
  text-decoration: none;
  background: linear-gradient(90deg, var(--reef-deep), var(--reef));
  color: #ecffff;
  border: 1px solid #03232d;
  border-radius: 999px;
  padding: 0.36rem 0.82rem;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.hero {
  margin-top: 0.7rem;
  padding: 1.2rem;
  border-radius: 26px;
  border: 1px solid #042f3c;
  background:
    radial-gradient(circle at 10% 20%, #2ec4b655 0%, transparent 30%),
    linear-gradient(132deg, #0e4054 0%, #0a5367 48%, #0b2f3e 100%);
  color: #e9fbff;
  box-shadow: 0 28px 45px #23180e2e;
}

.hero h1 {
  margin: 0;
  line-height: 0.92;
  font-size: clamp(2.3rem, 6.8vw, 4.8rem);
}

.hero p {
  margin: 0.35rem 0 0;
  font-size: 1rem;
  max-width: 70ch;
  color: #d3f0f4;
}

.grid,
.admin-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1.1rem;
  padding-bottom: 1.5rem;
}

.grid {
  grid-template-columns: 1.1fr 1.35fr 1fr;
}

.admin-grid {
  grid-template-columns: 1.05fr 1fr 1fr;
}

.card {
  background:
    linear-gradient(180deg, #fff8ef 0%, #fff5e6 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem;
  box-shadow: inset 0 1px 0 #fff, var(--card-shadow);
  transition: box-shadow 160ms ease, border-color 160ms ease;
}

.card:hover {
  box-shadow: inset 0 1px 0 #fff, var(--card-hover-shadow);
  border-color: #d1bd95;
}

.card h2 {
  margin: 0;
  font-size: 1.25rem;
  color: #0d3040;
}

.card small {
  color: var(--ink-soft);
}

.list,
.days,
.slots {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.72rem;
}

#windowsList {
  max-height: 70vh;
  overflow: auto;
  padding-right: 0.25rem;
}

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

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

.btn {
  border: 1px solid #dcc8a4;
  background: linear-gradient(180deg, #ffffff 0%, #fff5de 100%);
  border-radius: 11px;
  padding: 0.68rem 0.72rem;
  font: inherit;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: 160ms ease;
  line-height: 1.35;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: #f19f5d;
}

.btn.active {
  border-color: #cf561f;
  box-shadow: 0 0 0 2px #ff7a2f33;
}

.btn.selected {
  border-color: var(--ok);
  box-shadow: 0 0 0 2px #1188572f;
}

.btn.busy {
  border-color: #d88989;
  background: #fdecec;
  color: #7a2f2f;
  cursor: not-allowed;
}

.form {
  display: grid;
  gap: 0.64rem;
  margin-top: 0.75rem;
}

.form.is-collapsed {
  display: none;
}

label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.84rem;
  font-weight: 700;
  color: #2a4355;
}

input,
select,
button {
  font: inherit;
  border-radius: 10px;
  border: 1px solid #d9c5a0;
  padding: 0.62rem 0.66rem;
}

input,
select {
  background: #fffef8;
}

button.primary,
button.secondary {
  border: 0;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  min-height: 42px;
  box-shadow: 0 8px 18px #00324322;
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

button.primary {
  background: linear-gradient(100deg, #e3692d, #ff9441);
}

button.secondary {
  background: linear-gradient(100deg, #0b5365, #15839b);
}

button.primary:hover,
button.secondary:hover {
  transform: translateY(-1px);
  filter: saturate(1.04);
  box-shadow: 0 12px 20px #00324333;
}

button:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  box-shadow: none;
}

.row {
  display: grid;
  gap: 0.58rem;
  grid-template-columns: 1fr 1fr;
}

.day-picker-wrap {
  display: grid;
  gap: 0.35rem;
}

.weekday-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.day-chip {
  position: relative;
  margin: 0;
}

.day-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.day-chip span {
  display: inline-block;
  min-width: 2.45rem;
  text-align: center;
  border-radius: 999px;
  padding: 0.45rem 0.72rem;
  border: 1px solid #d6bc93;
  background: linear-gradient(180deg, #fffdf7 0%, #fff2dd 100%);
  color: #5b3a17;
  font-weight: 800;
  cursor: pointer;
  transition: 140ms ease;
}

.day-chip span:hover {
  border-color: #de8743;
}

.day-chip input:checked + span {
  border-color: #8c3f19;
  background: linear-gradient(180deg, #ff9e56 0%, #e86b2d 100%);
  color: #fff8f1;
  box-shadow: 0 0 0 2px #ff8f4f33;
}

.summary {
  margin-top: 0.72rem;
  border-radius: 12px;
  border: 1px dashed #bea072;
  background: #fff3dd;
  padding: 0.7rem;
}

.summary p {
  margin: 0.2rem 0;
  font-size: 0.9rem;
}

.instructor-card {
  margin: 0.45rem 0;
  border: 1px solid #d9c5a0;
  border-radius: 10px;
  background: #fff8e9;
  padding: 0.45rem;
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 0.5rem;
  align-items: start;
}

.instructor-card img {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #ccb48c;
}

.pill {
  display: inline-block;
  margin-left: 0.35rem;
  border-radius: 999px;
  border: 1px solid #b98242;
  background: #fff0d6;
  color: #6d3a08;
  font-size: 0.72rem;
  padding: 0.18rem 0.5rem;
}

.pill.pill-off {
  opacity: 0.6;
  border-style: dashed;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.7rem;
  font-size: 0.88rem;
}

.table th,
.table td {
  border-bottom: 1px solid #e5d4b8;
  padding: 0.4rem 0.25rem;
  text-align: left;
}

.table tbody tr {
  cursor: default;
}

.table tbody tr:hover {
  background: #fff2da;
}

.table-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  min-width: 260px;
  white-space: nowrap;
}

.entity-row {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.entity-row.compact {
  border: 1px solid #dcc8a4;
  border-radius: 10px;
  padding: 0.35rem;
  background: #fff9ec;
}

.entity-row.compact.is-selected {
  border-color: #cf561f;
  box-shadow: 0 0 0 2px #ff7a2f33;
}

.entity-main-btn {
  flex: 1;
}

.mini-btn {
  border: 1px solid #d6c09a;
  background: #fff;
  color: #2a4355;
  border-radius: 8px;
  padding: 0.24rem 0.42rem;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1.15;
}

.mini-btn:hover {
  border-color: #c17d3d;
  background: #fff6e7;
}

.mini-btn.danger {
  border-color: #d8abab;
  color: #7f2b2b;
  background: #fff5f5;
}

.mini-link {
  flex: 1;
  border: 1px solid #dcc8a4;
  border-radius: 8px;
  background: #fff;
  color: #1f3c4f;
  padding: 0.4rem 0.55rem;
  text-align: left;
  font-weight: 700;
  cursor: pointer;
}

.mini-link.active {
  border-color: #cf561f;
  box-shadow: 0 0 0 2px #ff7a2f33;
}

.window-row {
  border: 1px solid #dcc8a4;
  border-radius: 14px;
  background: #fff9ee;
  padding: 0.75rem;
  display: grid;
  gap: 0.55rem;
}

.window-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.window-title {
  min-width: 0;
  flex: 1 1 auto;
  display: grid;
  gap: 0.18rem;
}

.window-title strong {
  font-size: clamp(1.1rem, 1.7vw, 1.35rem);
  line-height: 1.12;
  letter-spacing: 0.01em;
  word-break: keep-all;
}

.window-title small {
  font-size: 0.86rem;
  color: #435f73;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.window-badges {
  display: flex;
  flex-wrap: wrap;
  margin-left: auto;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 0.35rem;
  max-width: min(46%, 480px);
  min-width: 0;
  flex: 0 0 auto;
}

.window-badges .pill {
  margin-left: 0;
}

.window-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.window-editor {
  display: grid;
  gap: 0.35rem;
  grid-template-columns: 1fr 1fr auto auto;
}

.weekly-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #e2d3b8;
  border-radius: 12px;
  overflow: hidden;
  background: #fff9ef;
}

.weekly-table th,
.weekly-table td {
  border-bottom: 1px solid #eadcc3;
  padding: 0.35rem 0.4rem;
  text-align: left;
  font-size: 0.82rem;
}

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

.weekly-table th {
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  color: #6e5436;
  background: #fff4df;
}

.check-inline {
  width: 18px;
  height: 18px;
  margin: 0;
}

.time-inline {
  width: 88px;
  padding: 0.3rem 0.4rem;
  font-size: 0.82rem;
}

.notice {
  margin-top: 0.72rem;
  border-radius: 10px;
  border: 1px solid #0f5635;
  background: #0c442b;
  color: #d9ffe8;
  padding: 0.58rem 0.7rem;
  display: none;
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 9999;
  min-width: 240px;
  max-width: min(90vw, 480px);
  box-shadow: 0 12px 24px #0a1d2680;
}

.notice.show {
  display: block;
}

@media (max-width: 1080px) {
  .grid,
  .admin-grid {
    grid-template-columns: 1fr 1fr;
  }

  .grid .card:last-child,
  .admin-grid .card:last-child {
    grid-column: span 2;
  }
}

@media (max-width: 760px) {
  .grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .grid .card:last-child,
  .admin-grid .card:last-child {
    grid-column: auto;
  }

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

  .slots {
    grid-template-columns: 1fr;
  }

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

  .table-actions {
    min-width: 0;
    flex-wrap: wrap;
    white-space: normal;
  }

  .window-editor {
    grid-template-columns: 1fr;
  }

  .window-top {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }

  .window-badges {
    max-width: 100%;
    justify-content: flex-start;
    min-width: 0;
    margin-left: 0;
  }

  .window-title small {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }
}
