/* Reset */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  background: #f5fcff;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: #0f172a;
}

.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 20px;
}

.header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 16px;
  margin-bottom: 12px;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.hl-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.hl-brand-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.hl-brand-name {
  font-size: 14px;
  font-weight: 700;
  color: #0b2a43;
  letter-spacing: -0.02em;
}

.title {
  margin: 0 0 6px 0;
  font-size: 20px;
}

.subtitle {
  margin: 0;
  font-size: 12px;
  color: #475569;
}

.freshness {
  font-size: 12px;
  color: #475569;
  text-align: right;
  white-space: nowrap;
}

.signout-btn {
  font-family: inherit;
  font-size: 12px;
  color: #475569;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.signout-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.disclaimer {
  font-size: 12px;
  color: #475569;
  margin: 0 0 14px 0;
}

.freshness .stale {
  color: #991b1b;
  font-weight: 600;
}

.legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0 14px 0;
}

.legend-item {
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 4px;
  background: #fff;
  cursor: default;
  user-select: none;
}

.legend-total {
  background: #fef3c7;
}

.legend-over {
  background: #fecaca;
}

.legend-weekend {
  background: #d1d5db;
}

.legend-timeoff {
  background: #dbeafe;
}

.legend-soft {
  background-color: #fff7ed;
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 5px,
    rgba(234, 88, 12, 0.4) 5px,
    rgba(234, 88, 12, 0.4) 7px
  );
}

.grid-toolbar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 8px;
}

.format-toggle {
  display: inline-flex;
  background: #e2e8f0;
  border-radius: 20px;
  padding: 3px;
}

.format-toggle__btn {
  border: none;
  padding: 4px 12px;
  font-size: 12px;
  font-family: inherit;
  border-radius: 16px;
  cursor: pointer;
  user-select: none;
  background: transparent;
  color: #64748b;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}

.format-toggle__btn:hover:not([aria-pressed="true"]) {
  color: #0f172a;
}

.format-toggle__btn[aria-pressed="true"] {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.state {
  font-size: 14px;
  color: #334155;
}

.user-bar {
  background: #0b2a43;
  color: #fff;
  padding: 6px 10px;
  font-weight: 600;
  font-size: 12px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
}

.table-wrap {
  overflow: auto;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.04);
}

.table {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
}

.table th,
.table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 6px 8px;
  font-size: 12px;
  text-align: center;
  min-width: 45px;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table th:first-child,
.table td:first-child {
  position: sticky;
  left: 0;
  background: #fff;
  text-align: left;
  min-width: 220px;
  max-width: 220px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  z-index: 2;
}

.table thead th {
  background: #f8fafc;
  font-weight: 600;
  vertical-align: bottom;
}

.table thead th.weekend {
  background: #d1d5db;
}

.table td.weekend {
  background: #f3f4f6;
}

.row-timeoff td:first-child {
  background: #dbeafe;
  font-weight: 600;
}

.row-total td:first-child {
  background: #fef9e7;
  font-weight: 700;
}

.row-total td.total-cell {
  background: #fef9e7;
  font-weight: 700;
}

.row-total td.over {
  background: #fecaca;
}

.soft-alloc {
  background-color: #fff7ed;
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 5px,
    rgba(234, 88, 12, 0.4) 5px,
    rgba(234, 88, 12, 0.4) 7px
  );
}

.page-footer {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
}

/* Mobile */
@media (max-width: 640px) {
  .header {
    flex-direction: column;
    gap: 12px;
  }

  .header-right {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }

  .freshness {
    text-align: left;
    white-space: normal;
  }

  .table th:first-child,
  .table td:first-child {
    min-width: 140px;
    max-width: 160px;
  }
}
