:root {
  --forest: #1f4d43;
  --forest-dark: #163a32;
  --gold: #c99b3f;
  --gold-light: #e8c98a;
  --cream: #f6f3ec;
  --paper: #ffffff;
  --ink: #2b2b26;
  --muted: #736f63;
  --danger: #b8433a;
  --success: #3f7d5a;
  --border: #e3ddcd;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

/* Header / Nav */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--forest);
  color: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 34px; height: 34px;
  background: var(--gold);
  color: var(--forest-dark);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 15px; letter-spacing: 0.2px; }
.brand-text small { font-size: 11px; color: var(--gold-light); }
.menu-toggle {
  background: none; border: none; color: white; font-size: 22px; cursor: pointer;
  display: none;
}
.app-nav {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 0 12px 10px;
}
.app-nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}
.app-nav a.active, .app-nav a:hover { background: rgba(255,255,255,0.14); color: white; }
.app-nav .nav-signout {
  margin-left: auto;
  color: var(--gold-light);
}

@media (max-width: 720px) {
  .menu-toggle { display: block; }
  .app-nav { display: none; flex-direction: column; padding: 8px 12px 12px; }
  .app-nav.open { display: flex; }
  .app-nav .nav-signout { margin-left: 0; }
}

/* Main layout */
.app-main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

.page-title {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.page-title h1 { font-size: 20px; margin: 0; }
.page-title .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* Cards */
.card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.card h2, .card h3 { margin-top: 0; }
.card-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}

.grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid.cols-2 { grid-template-columns: 1fr 1fr; } }

/* Forms */
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 10px 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=tel], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  background: var(--paper);
  color: var(--ink);
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }

.field-row { display: flex; gap: 10px; flex-wrap: wrap; }
.field-row > * { flex: 1; min-width: 140px; }

/* Buttons */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  background: var(--forest);
  color: white;
  text-decoration: none;
}
button:hover, .btn:hover { background: var(--forest-dark); }
button.secondary, .btn.secondary { background: var(--paper); color: var(--forest); border: 1px solid var(--forest); }
button.secondary:hover { background: var(--cream); }
button.danger, .btn.danger { background: var(--danger); }
button.gold, .btn.gold { background: var(--gold); color: var(--forest-dark); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.block { width: 100%; }
button.small, .btn.small { padding: 6px 10px; font-size: 13px; }

/* Badges */
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.badge.pending { background: #f1e6c9; color: #8a6a1a; }
.badge.in_progress { background: #dcebff; color: #24578c; }
.badge.completed { background: #dbeee0; color: var(--success); }
.badge.issue { background: #f7dad7; color: var(--danger); }
.badge.role-admin { background: #e6ddf6; color: #5a3d99; }
.badge.role-field { background: #d9f0e6; color: #1f6b4b; }

/* Lists */
.list-item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
}
.list-item .meta { color: var(--muted); font-size: 13px; }

/* Checklist */
.checklist-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}
.checklist-item .item-head {
  display: flex; align-items: flex-start; gap: 10px;
}
.checklist-item input[type=checkbox] { width: 22px; height: 22px; margin-top: 2px; }
.checklist-item .item-text { flex: 1; font-size: 15px; font-weight: 600; }
.photo-required-tag { font-size: 11px; color: var(--gold); font-weight: 700; text-transform: uppercase; }
.photo-input-wrap { margin-top: 10px; }
.photo-preview { max-width: 140px; border-radius: 8px; margin-top: 8px; display: block; }

.linen-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.linen-row:last-child { border-bottom: none; }
.linen-row .linen-name { flex: 2; font-size: 14px; }
.linen-row .linen-par { flex: 1; font-size: 12px; color: var(--muted); }
.linen-row input[type=number] { width: 80px; flex: none; }

/* Login */
.login-wrap {
  max-width: 380px; margin: 60px auto; padding: 0 16px;
}
.login-wrap .card { padding: 28px 24px; }
.login-logo { text-align: center; margin-bottom: 18px; }
.login-logo .brand-mark { width: 48px; height: 48px; font-size: 24px; margin: 0 auto 8px; }

.helper-text { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.error-text { color: var(--danger); font-size: 13.5px; margin-top: 8px; }

.toast {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  background: var(--forest-dark); color: white; padding: 10px 18px; border-radius: 8px;
  font-size: 14px; z-index: 999; opacity: 0; pointer-events: none; transition: opacity 0.2s;
  max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; }
.toast.error { background: var(--danger); }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase; }

.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); }

.pill-group { display: flex; gap: 6px; flex-wrap: wrap; }
.pill-group .pill {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); font-size: 13px; cursor: pointer; background: var(--paper);
}
.pill-group .pill.active { background: var(--forest); color: white; border-color: var(--forest); }
