/* 1:1 clone of Sentral mobile timetable — measurements taken from
   iPhone screenshots at 3x (IMG_0304-0307), colours pixel-sampled. */

:root {
  --green: #0a7866;
  --bg: #f3f3f3;
  --card: #ffffff;
  --card-border: #e4e4e4;
  --chip: #ebebeb;
  --chip-border: #d6d6d6;
  --selected: #d8d8d8;
  --text: #3c3c3c;
  --muted: #8a8a8a;
  --nav-grey: #757575;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

/* ---------- Green top bar ---------- */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: calc(48px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 14px 0 12px;
  background: var(--green);
  display: flex;
  align-items: center;
  gap: 11px;
  z-index: 20;
}

.menu-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: #fff;
  padding: 2px 2px 0;
  flex-shrink: 0;
}

.menu-bars { display: flex; flex-direction: column; gap: 4px; }
.menu-bars i {
  display: block;
  width: 28px;
  height: 4px;
  border-radius: 2px;
  background: #fff;
}

.menu-label {
  font-size: 12px;
  line-height: 1.1;
  font-weight: 400;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #141414;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.titles { min-width: 0; }

.titles h1 {
  font-family: Montserrat, Roboto, sans-serif;
  font-size: 20px;
  font-weight: 500;
  color: #fff;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.subtitle {
  font-family: Montserrat, Roboto, sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  line-height: 1.2;
  margin-top: 1px;
}

/* ---------- Page ---------- */

.page {
  padding-top: calc(48px + env(safe-area-inset-top));
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

.page-title {
  font-family: Montserrat, Roboto, sans-serif;
  font-size: 29px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--text);
  margin: 20px 10px 18px;
}

/* ---------- Controls row ---------- */

.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 36px 27px 10px;
  gap: 10px;
}

.range-dropdown,
.chip-btn {
  background: var(--chip);
  border: 1px solid var(--chip-border);
  border-radius: 8px;
  height: 31px;
  font-size: 15px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}

.range-dropdown {
  flex: 0 1 auto;
  min-width: 0;
  padding: 0 12px;
  gap: 9px;
}

#range-label {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.caret {
  width: 0; height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 7px solid var(--text);
  flex-shrink: 0;
}

.controls-right { display: flex; gap: 6px; flex-shrink: 0; }

#btn-today { width: 62px; }

.dots-btn { width: 37px; gap: 3px; }
.dots-btn i {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--text);
}

/* ---------- Day tabs ---------- */

.day-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin: 0 10px 23px;
}

.day-tab {
  border-radius: 8px;
  padding: 6px 0 7px;
  text-align: center;
  line-height: 1.2;
}

.day-tab.selected { background: var(--selected); }

.day-tab .d-name {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.day-tab .d-date {
  display: block;
  font-size: 15px;
  font-weight: 400;
  color: var(--text);
  margin-top: 2px;
}

/* ---------- Week sections ---------- */

.week-section { margin-bottom: 28px; }
.week-section:last-child { margin-bottom: 0; }

/* ---------- Period cards ---------- */

.card {
  display: flex;
  align-items: stretch;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  margin: 0 10px 11px;
  min-height: 83px;
  overflow: hidden;
  position: relative;
}

.card.lesson { min-height: 124px; }

.card-left {
  flex: 0 0 137px;
  position: relative;
}

.p-label {
  position: absolute;
  top: 14px;
  left: 16px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.p-time {
  position: absolute;
  top: 55px;
  left: 16px;
  font-size: 16px;
  font-weight: 400;
  color: var(--text);
  white-space: nowrap;
}

.accent {
  flex: 0 0 5px;
  background: transparent;
}

.card-right {
  flex: 1;
  min-width: 0;
  padding: 14px 14px 14px 12px;
}

.no-lesson {
  font-size: 16px;
  font-weight: 400;
  color: var(--text);
}

.c-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 16px;
}

.c-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 17px;
  min-height: 20px;
}
.c-row:last-child { margin-bottom: 0; }

.c-row img { display: block; }
.c-row.loc img { width: 13px; height: 17px; }
.c-row.tch img { width: 15px; height: 15px; }

.c-row.loc span {
  font-size: 16px;
  font-weight: 400;
  color: var(--text);
}

.c-row.tch span {
  font-size: 16px;
  font-weight: 400;
  color: var(--muted);
}

/* Inactive week — greyed out like IMG_0306 */

.week-section.inactive .card {
  background: var(--selected);
  border-color: var(--selected);
}

/* ---------- Bottom nav ---------- */

.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(56px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff;
  border-top: 2px solid var(--green);
  z-index: 20;
}

.nav-item {
  position: absolute;
  top: 7px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.nav-home { left: 15%; }
.nav-messages { left: 46.5%; }
.nav-notifications { left: 81.8%; }

.nav-item img { height: 26px; width: auto; display: block; }

.nav-item span {
  font-size: 13px;
  color: var(--nav-grey);
  line-height: 1.15;
}

/* ---------- Hidden edit mode (3 taps on the dots button) ---------- */

body.edit-mode .dots-btn { background: var(--selected); }

.card.editable { cursor: pointer; }
.card.editable:active { filter: brightness(0.96); }

.card.ghost { opacity: 0.45; }
.card.ghost { border-style: dashed; border-color: #b5b5b5; }
