:root {
  --safe-area-inset-top: env(safe-area-inset-top, 0px);
  --safe-area-inset-right: env(safe-area-inset-right, 0px);
  --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-inset-left: env(safe-area-inset-left, 0px);

  --sidebar-bg: #1c1917;
  --sidebar-bg-hover: #292524;
  --accent: #c8893a;
  --accent-dark: #a86e28;
  --content-bg: #f7f6f3;
  --content-border: #e5e2da;
  --text-primary: #1a1917;
  --text-muted: #6b6560;
}

* { box-sizing: border-box; }
.hidden { display: none !important; }

body {
  font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
  background: var(--content-bg);
  padding-bottom: var(--safe-area-inset-bottom);
  padding-top: var(--safe-area-inset-top);
  margin: 0;
  color: var(--text-primary);
}

/* Layout */
#app-shell {
  display: flex;
  min-height: 100vh;
}

#sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 50;
  padding-top: var(--safe-area-inset-top);
  padding-bottom: var(--safe-area-inset-bottom);
}

#content-area {
  margin-left: 220px;
  flex: 1;
  min-height: 100vh;
  padding: 2.5rem 2.5rem;
  max-width: 960px;
}

/* Sidebar */
.sidebar-wordmark {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-wordmark .store-name {
  font-family: 'Playfair Display', Georgia, serif;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.3;
  text-transform: uppercase;
}

.sidebar-wordmark .portal-label {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.38);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 0.25rem;
}

.sidebar-nav {
  padding: 1rem 0.75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: block;
  padding: 0.55rem 0.85rem;
  color: rgba(255,255,255,0.62);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  border-radius: 5px;
  transition: color 120ms, background 120ms;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255,255,255,0.07);
}

.nav-item.active {
  color: var(--accent);
  background: rgba(200, 137, 58, 0.12);
  font-weight: 600;
}

.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.45);
  margin-bottom: 0.6rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user strong {
  display: block;
  color: rgba(255,255,255,0.75);
  font-weight: 600;
  font-size: 0.8rem;
}

.btn-logout {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.35);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: color 120ms;
}

.btn-logout:hover {
  color: rgba(255,255,255,0.7);
}

/* Page headings */
.page-heading {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.25rem;
}

.page-subheading {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0 0 1.75rem;
}

.section-divider {
  border: none;
  border-top: 1px solid var(--content-border);
  margin: 1.75rem 0;
}

/* Cards */
.card {
  background: #fff;
  border: 1px solid var(--content-border);
  border-radius: 6px;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--content-border);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: opacity 120ms, background 120ms;
  font-family: inherit;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-dark);
}

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--content-border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--content-bg);
  color: var(--text-primary);
}

.btn-danger {
  background: transparent;
  color: #b91c1c;
  border: 1px solid #fecaca;
  font-size: 0.8rem;
}

.btn-danger:hover:not(:disabled) {
  background: #fef2f2;
}

.btn-ghost {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  border-radius: 3px;
  font-family: inherit;
  transition: color 120ms, background 120ms;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--content-bg);
}

.btn-ghost.danger:hover {
  color: #b91c1c;
}

/* Form inputs */
.input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d6d3cc;
  border-radius: 4px;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text-primary);
  background: #fff;
  transition: border-color 120ms;
  outline: none;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(200, 137, 58, 0.15);
}

label.field-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge-open {
  background: #fef3c7;
  color: #92400e;
}

.badge-claimed {
  background: #f0fdf4;
  color: #166534;
}

.badge-coming-soon {
  background: #f3f4f6;
  color: #6b7280;
}

/* Inline status messages */
.status-msg {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.status-msg.success { color: #166534; }
.status-msg.error { color: #b91c1c; }

/* Auth modal */
#auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 12, 10, 0.82);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

#auth-card {
  background: #fff;
  width: 100%;
  max-width: 360px;
  border-radius: 6px;
  padding: 2.5rem 2.25rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}

.auth-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.25rem;
}

.auth-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 1.5rem;
  letter-spacing: 0.02em;
}

.auth-error {
  font-size: 0.8rem;
  color: #b91c1c;
  min-height: 1.2rem;
  margin: 0.25rem 0 0;
}

.auth-toggle {
  font-size: 0.8rem;
  text-align: center;
  color: var(--text-muted);
  margin-top: 1.25rem;
}

.auth-toggle button {
  background: none;
  border: none;
  color: var(--accent-dark);
  font-weight: 600;
  cursor: pointer;
  font-size: inherit;
  padding: 0;
  font-family: inherit;
}

.auth-toggle button:hover {
  text-decoration: underline;
}

/* Page transitions */
.page-enter {
  animation: pageEnter 0.18s ease-out;
}

@keyframes pageEnter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Feed / posts */
.feed-post {
  background: #fff;
  border: 1px solid var(--content-border);
  border-radius: 6px;
  padding: 1.1rem 1.25rem;
}

.feed-post + .feed-post {
  margin-top: 0.75rem;
}

.post-author {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.post-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.post-content {
  font-size: 0.9rem;
  line-height: 1.55;
  margin: 0.5rem 0 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.post-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.6rem;
  align-items: center;
}

.post-replies {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--content-border);
  padding-left: 1rem;
}

.reply-post {
  background: var(--content-bg);
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin-top: 0.5rem;
}

/* Shift cards */
.shift-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--content-border);
}

.shift-card:last-child {
  border-bottom: none;
}

.shift-date-block {
  background: var(--content-bg);
  border: 1px solid var(--content-border);
  border-radius: 5px;
  width: 52px;
  height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 1rem;
}

.shift-date-block .month {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.shift-date-block .day {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
}

.shift-date-block .weekday {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

/* Resource cards */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.resource-card {
  background: #fff;
  border: 1px solid var(--content-border);
  border-radius: 6px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.resource-card.disabled {
  opacity: 0.6;
}

.resource-card-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.resource-card-desc {
  font-size: 0.825rem;
  color: var(--text-muted);
  line-height: 1.45;
  flex: 1;
  margin-bottom: 1rem;
}

.resource-card-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-dark);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.resource-card-link:hover {
  text-decoration: underline;
}

/* Roster cards */
.roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.875rem;
}

.roster-card {
  background: #fff;
  border: 1px solid var(--content-border);
  border-radius: 6px;
  padding: 1rem 1.1rem;
}

.roster-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.roster-detail {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Composer */
.composer {
  background: #fff;
  border: 1px solid var(--content-border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.composer textarea {
  width: 100%;
  resize: vertical;
  min-height: 72px;
  border: 1px solid #d6d3cc;
  border-radius: 4px;
  padding: 0.6rem 0.75rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
  transition: border-color 120ms;
}

.composer textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(200, 137, 58, 0.15);
}

/* Profile sections */
.profile-section {
  background: #fff;
  border: 1px solid var(--content-border);
  border-radius: 6px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.profile-section-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--content-border);
}

.read-only-field {
  padding: 0.5rem 0.75rem;
  background: var(--content-bg);
  border: 1px solid var(--content-border);
  border-radius: 4px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Empty states */
.empty-state {
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--text-muted);
}

.empty-state-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.empty-state-desc {
  font-size: 0.825rem;
}

/* Approvals */
.approval-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border: 1px solid var(--content-border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.625rem;
}

/* Hamburger / mobile */
#mobile-menu-btn {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 100;
  background: var(--sidebar-bg);
  color: rgba(255,255,255,0.75);
  border: none;
  border-radius: 4px;
  width: 38px;
  height: 38px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 40;
}

/* Hours tracker */
.hours-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.25rem;
  align-items: start;
}

.hours-main {
  min-width: 0;
}

.hours-sidebar {
  position: sticky;
  top: 1.5rem;
}

.hours-summary-stats {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.summary-stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.6rem 0.75rem;
  background: var(--content-bg);
  border-radius: 4px;
  border: 1px solid var(--content-border);
}

.summary-stat-accent {
  background: rgba(200, 137, 58, 0.06);
  border-color: rgba(200, 137, 58, 0.25);
}

.summary-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.summary-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.summary-stat-accent .summary-value {
  color: var(--accent-dark);
}

/* Hour entry rows */
.hours-entry-row {
  display: grid;
  grid-template-columns: 130px 140px 70px 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--content-border);
  font-size: 0.85rem;
}

.hours-entry-row:last-child {
  border-bottom: none;
}

.hours-entry-date {
  font-weight: 600;
  color: var(--text-primary);
}

.hours-entry-time {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.hours-entry-duration {
  font-weight: 700;
  color: var(--accent-dark);
  font-size: 0.82rem;
}

.hours-entry-notes {
  color: var(--text-muted);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hours-entry-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  justify-content: flex-end;
}

/* Breakdown rows */
.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.65rem 1.25rem;
  border-bottom: 1px solid var(--content-border);
  font-size: 0.83rem;
}

.breakdown-row:last-child {
  border-bottom: none;
}

.breakdown-date {
  color: var(--text-primary);
  font-weight: 500;
}

.breakdown-hours {
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

@media (max-width: 768px) {
  #sidebar {
    transform: translateX(-100%);
    transition: transform 220ms ease;
  }

  #sidebar.open {
    transform: translateX(0);
  }

  #sidebar-overlay.open {
    display: block;
  }

  #mobile-menu-btn {
    display: flex;
  }

  #content-area {
    margin-left: 0;
    padding: 1.25rem 1rem;
    padding-top: 4rem;
  }

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

  .hours-sidebar {
    position: static;
  }

  .hours-entry-row {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    row-gap: 0.25rem;
  }

  .hours-entry-time { grid-column: 2; }
  .hours-entry-duration { grid-column: 1; }
  .hours-entry-notes { grid-column: 1 / span 2; }
  .hours-entry-actions { grid-column: 2; grid-row: 2; }
}
