:root {
  color-scheme: light;
  --bg: #f5f2ec;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #20242b;
  --muted: #69717c;
  --line: #d8d3ca;
  --teal: #1f7a73;
  --teal-dark: #13514d;
  --amber: #b26a00;
  --blue: #3867a8;
  --red: #b54747;
  --shadow: 0 18px 45px rgba(43, 36, 28, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.public-landing {
  background:
    linear-gradient(160deg, rgba(31, 122, 115, 0.08), rgba(56, 103, 168, 0.10)),
    #f7fafc;
}

.public-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.public-nav {
  width: min(1180px, calc(100% - 32px));
  min-height: 86px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.public-brand img {
  width: clamp(150px, 20vw, 240px);
  height: auto;
  display: block;
}

.public-nav-actions,
.public-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.public-hero {
  width: min(1180px, calc(100% - 32px));
  min-height: min(650px, calc(100vh - 190px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  background:
    linear-gradient(90deg, rgba(247, 250, 252, 0.98) 0%, rgba(247, 250, 252, 0.84) 45%, rgba(247, 250, 252, 0.24) 100%),
    url("assets/crewflow-mark.png") right 8% center / min(46vw, 520px) auto no-repeat;
}

.public-hero-copy {
  width: min(660px, 100%);
  padding: 56px 0;
}

.public-hero h1 {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 5.1rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.public-hero p:not(.eyebrow) {
  max-width: 640px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
}

.public-actions {
  margin-top: 30px;
}

.primary-link,
.secondary-link,
.ghost-link {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 0 16px;
  color: inherit;
  font-weight: 800;
  text-decoration: none;
}

.primary-link {
  background: var(--teal);
  color: #ffffff;
}

.secondary-link,
.ghost-link {
  background: rgba(255, 255, 255, 0.82);
  border-color: var(--line);
}

.primary-link.large,
.secondary-link.large {
  min-height: 50px;
  padding-inline: 20px;
}

.public-feature-band {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 40px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.public-feature-band article {
  min-height: 180px;
  border-top: 1px solid var(--line);
  padding: 20px 0 0;
}

.public-feature-band span {
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 900;
}

.public-feature-band h2 {
  margin: 8px 0 6px;
  font-size: 1.2rem;
}

.public-feature-band p {
  margin: 0;
  color: var(--muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(31, 122, 115, 0.12), rgba(56, 103, 168, 0.12)),
    var(--bg);
}

.landing-layout {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(280px, 380px) minmax(280px, 380px);
  gap: 18px;
  align-items: stretch;
}

.landing-intro,
.login-panel,
.register-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 24px;
}

.landing-intro {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  background: linear-gradient(160deg, #f8fbfa, #e8f1ef);
}

.landing-logo {
  width: min(100%, 520px);
  height: auto;
  display: block;
}

.login-panel,
.register-panel {
  display: grid;
  gap: 16px;
  align-content: start;
}

.landing-intro h1 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  letter-spacing: 0;
}

.login-panel h2,
.register-panel h2 {
  margin: 0;
  font-size: 1.45rem;
  letter-spacing: 0;
}

.login-copy,
.helper-text,
.error-message,
.success-message {
  margin: 0;
}

.login-copy,
.helper-text {
  color: var(--muted);
}

.helper-text {
  font-size: 0.85rem;
}

.error-message {
  min-height: 20px;
  color: var(--red);
  font-weight: 800;
}

.success-message {
  min-height: 20px;
  color: var(--teal-dark);
  font-weight: 800;
}

.topbar,
.summary-grid,
.banks-band,
.workbench,
.admin-band,
.admin-workbench {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.topbar-brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 16px;
}

.topbar-logo {
  width: clamp(132px, 18vw, 220px);
  height: auto;
  display: block;
}

.topbar h1,
.section-header h2,
.status-copy h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(1.7rem, 3vw, 2.35rem);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal-dark);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.storage-status {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.topbar-actions,
.status-actions,
.section-header,
.form-toggles,
.row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-button,
.primary-button,
.secondary-button,
.ghost-button {
  min-height: 42px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 800;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.icon-button:hover,
.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ebe6dc;
  border-color: var(--line);
  color: var(--ink);
}

.file-action {
  position: relative;
  overflow: hidden;
}

.file-action input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

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

.secondary-button {
  background: var(--surface-strong);
  color: var(--teal-dark);
  border-color: #aebeb9;
}

.ghost-button {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.summary-band {
  padding: 16px 0 28px;
}

.summary-grid {
  display: grid;
  grid-template-columns: minmax(340px, 1.5fr) repeat(3, minmax(160px, 1fr));
  gap: 14px;
}

.status-panel,
.metric-card,
.bank-card,
.entry-form,
.log-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.status-panel {
  min-height: 180px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  padding: 22px;
}

.status-copy p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
}

.clock-face {
  width: 146px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  align-content: center;
  border: 8px solid #d9ebe7;
  border-right-color: var(--teal);
  border-bottom-color: #f0c979;
  border-radius: 50%;
  background: var(--surface-strong);
}

.clock-face span {
  font-size: 1.55rem;
  font-weight: 900;
}

.clock-face small {
  color: var(--muted);
  font-weight: 800;
}

.status-actions {
  grid-column: 1 / -1;
  flex-wrap: wrap;
}

.metric-card {
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  overflow: hidden;
}

.metric-card span,
.bank-card span,
label span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.metric-card strong {
  font-size: clamp(1.65rem, 3vw, 2.2rem);
  letter-spacing: 0;
}

.metric-card small,
.bank-card small {
  color: var(--muted);
}

.bank-card .input-label {
  margin-top: 4px;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 800;
}

.accent-teal {
  border-top: 5px solid var(--teal);
}

.accent-amber {
  border-top: 5px solid var(--amber);
}

.accent-blue {
  border-top: 5px solid var(--blue);
}

.banks-band {
  padding: 4px 0 28px;
}

.section-header {
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-header.tight {
  margin-bottom: 18px;
}

.bank-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.bank-card {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.bank-card strong {
  font-size: 1.55rem;
  letter-spacing: 0;
}

.bank-card input,
.field-grid input,
.field-grid select,
.wide-field input,
.month-filter input,
.login-panel input,
.register-panel input,
.admin-filters input,
.admin-filters select,
.admin-workbench input,
.admin-workbench select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--ink);
  padding: 8px 10px;
}

.bank-card input {
  font-size: 0.96rem;
  font-weight: 900;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding-bottom: 38px;
}

.admin-band {
  padding: 16px 0 28px;
}

.admin-workbench {
  display: grid;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding-bottom: 38px;
}

.admin-filters {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-filters label {
  min-width: 150px;
}

.admin-table table {
  min-width: 900px;
}

.users-table table {
  min-width: 1380px;
}

.compact-input {
  min-width: 92px;
}

.schedule-input {
  min-width: 170px;
}

input:disabled,
select:disabled {
  background: #eeece6;
  color: var(--muted);
  cursor: not-allowed;
}

.calendar-panel {
  padding-bottom: 20px;
}

.calendar-legend {
  width: min(1180px, calc(100% - 32px));
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 0 auto 14px;
  color: var(--muted);
  font-weight: 800;
}

.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.calendar-legend i {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: inline-block;
  border: 1px solid var(--line);
}

.legend-scheduled {
  background: #e7f4ef;
}

.legend-off {
  background: #f0eee8;
}

.legend-pending {
  background: #f7e8c8;
}

.legend-approved {
  background: #dcefed;
}

.calendar-grid {
  width: min(1180px, calc(100% - 32px));
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin: 0 auto;
}

.log-panel .calendar-grid {
  width: 100%;
  margin-bottom: 16px;
}

.calendar-head {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.calendar-day {
  min-height: 92px;
  display: grid;
  align-content: start;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  background: var(--surface-strong);
}

.calendar-day strong {
  font-size: 1rem;
}

.calendar-day small {
  color: var(--muted);
  font-weight: 800;
}

.calendar-day.is-scheduled {
  background: #e7f4ef;
}

.calendar-day.is-off {
  background: #f0eee8;
}

.calendar-day.is-stat {
  background: #e8edf8;
}

.calendar-day.is-admin-empty {
  background: var(--surface-strong);
}

.calendar-day.has-time-off {
  background: #fff8e8;
}

.calendar-day.has-pending {
  border-color: var(--amber);
}

.calendar-day.has-approved {
  border-color: var(--teal);
}

.calendar-day.is-empty {
  visibility: hidden;
}

.calendar-tag,
.status-pill {
  display: inline-flex;
  width: fit-content;
  min-height: 22px;
  align-items: center;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 0.72rem;
  font-weight: 900;
}

.status-pending {
  background: #f7e8c8;
  color: #7a4b00;
}

.status-approved {
  background: #dcefed;
  color: var(--teal-dark);
}

.status-denied {
  background: #f5dddd;
  color: #833131;
}

.status-stat {
  background: #dce5f8;
  color: #284f8c;
}

.entry-form,
.log-panel {
  padding: 18px;
}

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

label {
  display: grid;
  gap: 6px;
}

.wide-field {
  margin-top: 12px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 0;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.entry-preview {
  margin: 14px 0;
  padding: 12px;
  border-radius: var(--radius);
  background: #eef5f3;
  color: var(--teal-dark);
  font-weight: 900;
}

.full-width {
  width: 100%;
}

.month-filter {
  min-width: 160px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

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

td {
  font-size: 0.92rem;
}

.type-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  background: #ece8df;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
}

.type-work {
  background: #dcefed;
  color: var(--teal-dark);
}

.type-sick {
  background: #f5dddd;
  color: #833131;
}

.type-vacation {
  background: #e3e8f5;
  color: #284f8c;
}

.type-stat {
  background: #dce5f8;
  color: #284f8c;
}

.type-banked-overtime-used,
.type-adjustment {
  background: #f7e8c8;
  color: #7a4b00;
}

.row-actions {
  justify-content: flex-end;
}

.row-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--muted);
  font-weight: 800;
}

.row-actions .danger {
  color: var(--red);
}

.empty-state {
  display: none;
  padding: 34px 0;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

.empty-state.visible {
  display: block;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .public-hero {
    min-height: auto;
    background:
      linear-gradient(180deg, rgba(247, 250, 252, 0.97), rgba(247, 250, 252, 0.84)),
      url("assets/crewflow-mark.png") right 0 top 18px / 250px auto no-repeat;
  }

  .public-hero-copy {
    padding: 84px 0 42px;
  }

  .public-feature-band {
    grid-template-columns: 1fr;
  }

  .landing-layout {
    grid-template-columns: 1fr 1fr;
  }

  .landing-intro {
    grid-column: 1 / -1;
  }

  .summary-grid,
  .workbench,
  .admin-workbench {
    grid-template-columns: 1fr;
  }

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

  .status-panel {
    grid-column: 1 / -1;
  }

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

@media (max-width: 700px) {
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .public-nav {
    min-height: auto;
    padding: 18px 0;
    align-items: flex-start;
    flex-direction: column;
  }

  .public-nav-actions {
    width: 100%;
  }

  .public-nav-actions a,
  .public-actions a {
    width: 100%;
  }

  .login-view {
    align-items: start;
    padding: 16px;
  }

  .landing-layout {
    grid-template-columns: 1fr;
  }

  .landing-intro,
  .login-panel,
  .register-panel {
    padding: 18px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    align-items: flex-start;
    flex-direction: column;
    width: 100%;
    padding: 14px 16px;
    background: rgba(246, 242, 234, 0.96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
  }

  .topbar-brand {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .topbar-logo {
    width: min(220px, 72vw);
  }

  .topbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: flex-start;
  }

  .topbar-actions .icon-button {
    width: 100%;
  }

  .summary-grid,
  .bank-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .status-panel {
    grid-template-columns: 1fr;
  }

  .status-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .status-actions button,
  .entry-form .primary-button {
    min-height: 52px;
  }

  .clock-face {
    width: 132px;
  }

  .section-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .month-filter {
    width: 100%;
  }

  .calendar-grid {
    width: calc(100% - 16px);
    gap: 4px;
  }

  .calendar-day {
    min-height: 78px;
    padding: 6px;
  }

  .calendar-tag,
  .status-pill {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
