:root {
  color-scheme: light;
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-soft: #edf6f4;
  --text: #17211f;
  --muted: #60706c;
  --line: #d9e2df;
  --brand: #0f8f7a;
  --brand-dark: #0a6b5b;
  --blue: #2563eb;
  --red: #c2413a;
  --amber: #a15c07;
  --green: #12805c;
  --shadow: 0 10px 28px rgba(23, 33, 31, .08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

a {
  color: inherit;
}

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

.loading-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 14px;
  color: var(--muted);
  text-align: center;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 440px;
}

.auth-visual {
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(0deg, rgba(15, 143, 122, .08), rgba(15, 143, 122, .08)),
    var(--surface);
  border-right: 1px solid var(--line);
}

.brand-line {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 22px;
}

.brand-line img {
  width: 42px;
  height: 42px;
}

.auth-copy {
  max-width: 620px;
}

.auth-copy h1 {
  margin: 0 0 18px;
  font-size: 44px;
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: 0;
}

.auth-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.auth-panel {
  padding: 40px;
  display: flex;
  align-items: center;
  background: var(--surface);
}

.auth-card {
  width: 100%;
}

.auth-card h2 {
  margin: 0 0 8px;
  font-size: 25px;
}

.auth-card .muted {
  margin: 0 0 26px;
}

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

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: #31403d;
  font-weight: 700;
  font-size: 13px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
  outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 143, 122, .13);
}

.button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  color: var(--text);
  background: #fff;
}

.button.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.button.primary:hover {
  background: var(--brand-dark);
}

.button.ghost {
  border-color: var(--line);
  background: #fff;
}

.button.danger {
  border-color: rgba(194, 65, 58, .2);
  color: var(--red);
  background: #fff6f5;
}

.button.small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
}

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

.error-box,
.warning-box,
.empty-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
  color: var(--muted);
}

.error-box {
  border-color: rgba(194, 65, 58, .28);
  background: #fff8f7;
  color: #7c2d27;
}

.warning-box {
  border-color: rgba(161, 92, 7, .24);
  background: #fff8e8;
  color: #744404;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px 12px;
}

.nav-brand img {
  width: 36px;
  height: 36px;
}

.nav-brand strong {
  display: block;
  font-size: 17px;
}

.nav-brand span {
  display: block;
  max-width: 170px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-button {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 10px 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  color: #2f3e3b;
  text-align: left;
  font-weight: 750;
}

.nav-button:hover {
  background: #f0f5f4;
}

.nav-button.active {
  color: var(--brand-dark);
  background: var(--surface-soft);
}

.nav-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.signed-in {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.signed-in span,
.signed-in strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signed-in span {
  color: var(--muted);
  font-size: 12px;
}

.content {
  min-width: 0;
}

.topbar {
  min-height: 74px;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: rgba(246, 248, 247, .9);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
  backdrop-filter: blur(10px);
}

.page-title h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.page-title p {
  margin: 4px 0 0;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.main {
  padding: 28px;
  display: grid;
  gap: 22px;
}

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

.metric {
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 17px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric span {
  display: block;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
  line-height: 1;
}

.section {
  display: grid;
  gap: 12px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
}

.section-header h2 {
  margin: 0;
  font-size: 18px;
}

.section-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.search {
  min-width: 230px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 11px;
  outline: none;
  background: #fff;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.segment {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  padding: 6px 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segment.active {
  background: var(--brand);
  color: #fff;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.schedule-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.schedule-table {
  min-width: 920px;
  table-layout: fixed;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .02em;
  background: #fbfdfc;
}

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

.schedule-table th:first-child {
  width: 78px;
}

.schedule-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.schedule-table tbody th {
  color: #40504d;
  font-size: 12px;
  background: #fbfdfc;
  white-space: nowrap;
}

.schedule-cell {
  height: 58px;
  padding: 7px;
  background: #fbfdfc;
}

.schedule-cell.free {
  background:
    linear-gradient(135deg, rgba(217, 226, 223, .38) 25%, transparent 25%) 0 0 / 12px 12px,
    #fbfdfc;
}

.schedule-cell.busy {
  background: #fff;
}

.schedule-chip {
  display: grid;
  gap: 2px;
  min-height: 42px;
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  padding: 7px 8px;
  background: var(--surface-soft);
  overflow: hidden;
}

.schedule-chip + .schedule-chip {
  margin-top: 6px;
}

.schedule-chip strong,
.schedule-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-chip strong {
  font-size: 12px;
}

.schedule-chip span {
  color: var(--muted);
  font-size: 11px;
}

.schedule-chip.pending {
  border-left-color: var(--amber);
  background: #fff7e6;
}

.schedule-chip.approved {
  border-left-color: var(--brand);
  background: #e7f7f3;
}

.schedule-chip.completed {
  border-left-color: var(--blue);
  background: #ecf3ff;
}

.schedule-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--brand);
}

.legend-dot.pending {
  background: var(--amber);
}

.legend-dot.approved {
  background: var(--brand);
}

.legend-dot.completed {
  background: var(--blue);
}

.cell-main {
  display: grid;
  gap: 3px;
}

.cell-main strong {
  font-size: 14px;
}

.cell-main span {
  color: var(--muted);
  font-size: 13px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.status.pending {
  color: #7a4200;
  background: #fff2d8;
}

.status.approved {
  color: #0b5d4f;
  background: #dcf7ef;
}

.status.completed {
  color: #1f4f9d;
  background: #e6efff;
}

.status.cancelled,
.status.rejected {
  color: #8a2e28;
  background: #ffe7e4;
}

.status.inactive {
  color: #65716f;
  background: #edf1f0;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

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

.service-item,
.info-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.service-item h3,
.info-panel h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.service-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: #fbfdfc;
  color: #40504d;
  font-size: 12px;
  font-weight: 800;
}

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

.kv {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.kv:last-child {
  border-bottom: 0;
}

.kv span {
  color: var(--muted);
  font-weight: 700;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  border-radius: 8px;
  padding: 12px 14px;
  color: #fff;
  background: #17312c;
  box-shadow: var(--shadow);
  z-index: 10;
}

.mobile-nav-toggle {
  display: none;
}

@media (max-width: 1100px) {
  .metrics-grid,
  .service-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .auth-page {
    grid-template-columns: 1fr;
  }

  .auth-visual {
    min-height: auto;
    padding: 28px;
    gap: 42px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .auth-copy h1 {
    font-size: 32px;
  }

  .auth-panel {
    padding: 28px;
  }

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

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

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

  .nav-footer {
    margin-top: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .topbar {
    position: static;
    padding: 18px;
    align-items: flex-start;
    flex-direction: column;
  }

  .main {
    padding: 18px;
  }
}

@media (max-width: 620px) {
  body {
    font-size: 14px;
  }

  .metrics-grid,
  .service-grid,
  .details-grid {
    grid-template-columns: 1fr;
  }

  .nav-list {
    grid-template-columns: 1fr;
  }

  .nav-footer {
    grid-template-columns: 1fr;
  }

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

  .toolbar,
  .topbar-actions {
    width: 100%;
  }

  .search,
  .button,
  .segmented {
    width: 100%;
  }

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

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