:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-2: #f4f0ea;
  --border: #e6ded1;
  --text: #1f1a17;
  --text-muted: #6d645c;

  /* McDonald's brand palette. */
  --brand-red: #da291c;
  --brand-red-dark: #b21e14;
  --brand-yellow: #ffc72c;
  --brand-yellow-dark: #e0a800;

  --success-bg: #e9f6ec;
  --success-text: #17693a;
  --error-bg: #fdecea;
  --error-text: #a3181a;
  --info-bg: #eef2fb;
  --info-text: #2c4a8a;
  --warn-bg: #fdf3e0;
  --warn-text: #8a5a00;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(31, 26, 23, 0.05), 0 3px 10px rgba(31, 26, 23, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--brand-red); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- header */
.site-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 1rem;
  background: var(--brand-red);
  color: #fff;
  border-bottom: 4px solid var(--brand-yellow);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  color: #fff;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-name {
  font-weight: 800;
  letter-spacing: 0.01em;
  font-size: 1.15rem;
  color: #fff;
}
.brand-sub {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.86);
  letter-spacing: 0.02em;
}

.nav {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  margin-left: auto;
}
.nav a {
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  color: #fff;
  font-size: 0.9rem;
}
.nav a:hover {
  background: rgba(255, 255, 255, 0.18);
  text-decoration: none;
}

/* --------------------------------------------------------- account menu */
.account-menu { position: relative; }
.account-menu > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary:focus-visible {
  outline: 2px solid var(--brand-yellow);
  outline-offset: 2px;
}
.account-summary .user-name { font-weight: 600; font-size: 0.9rem; }
.account-summary .user-role { font-size: 0.75rem; color: rgba(255, 255, 255, 0.85); }
.account-summary .caret { font-size: 0.7rem; }

.account-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  min-width: 210px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.75rem;
  z-index: 20;
}
.account-meta { margin: 0 0 0.6rem; font-size: 0.9rem; }
.account-logout { margin: 0; }
button.logout-button {
  width: 100%;
  padding: 0.5rem 0.7rem;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid var(--brand-red);
  background: var(--brand-red);
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}
button.logout-button:hover { background: var(--brand-red-dark); }

/* ------------------------------------------------------------------ main */
.site-main {
  flex: 1;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.auth { align-items: center; justify-content: center; }
.auth .site-main { max-width: 440px; margin: 3rem auto; }
.auth-card h1 { margin-top: 0.5rem; }

.brand-lockup { display: flex; flex-direction: column; margin-bottom: 0.5rem; }
.brand-lockup .brand-name { color: var(--brand-red); font-size: 1.25rem; }
.brand-lockup .brand-sub { color: var(--text-muted); font-size: 0.8rem; }

h1 { font-size: 1.4rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.12rem; margin: 0 0 0.75rem; }
h3 { font-size: 1rem; margin: 0 0 0.35rem; }
.sub-head {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.muted { color: var(--text-muted); }
.small { font-size: 0.85rem; }

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0.75rem 0 0.25rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--brand-yellow);
  outline-offset: 1px;
  border-color: var(--brand-red);
}

.password-field {
  position: relative;
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.password-field input { flex: 1; }
.toggle {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
}
.toggle:hover { background: #e9e2d8; }

button.primary {
  margin-top: 1rem;
  width: 100%;
  padding: 0.7rem 1rem;
  background: var(--brand-red);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
button.primary:hover { background: var(--brand-red-dark); }

button.small, .actions button {
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
}
button.small:hover, .actions button:hover { background: var(--surface-2); }
button.danger {
  color: var(--error-text);
  border-color: #f1c4c4;
  background: var(--error-bg);
}
button.danger:hover { background: #fbdada; }

/* ---------------------------------------------------------------- alerts */
.alert {
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}
.alert ul { margin: 0; padding-left: 1.1rem; }
.alert-error { background: var(--error-bg); color: var(--error-text); }
.alert-success { background: var(--success-bg); color: var(--success-text); }
.alert-info { background: var(--info-bg); color: var(--info-text); }

/* --------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table.directory {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.directory th, table.directory td {
  text-align: left;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.directory th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
}
table.directory code {
  font-family: var(--mono);
  font-size: 0.8rem;
  background: var(--surface-2);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}
tr.row-muted td { opacity: 0.62; }

.actions { display: flex; gap: 0.35rem; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

/* --------------------------------------------------------------- badges */
.badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--surface-2);
  color: var(--text-muted);
}
.badge-ok { background: var(--success-bg); color: var(--success-text); }
.badge-draft { background: var(--warn-bg); color: var(--warn-text); }
.badge-warn { background: var(--error-bg); color: var(--error-text); }

/* ---------------------------------------------------------- empty state */
.empty-state {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  text-align: center;
  background: var(--surface-2);
}
.empty-state p { margin: 0.25rem 0; }

.facts { list-style: none; padding: 0; margin: 0 0 0.75rem; display: grid; gap: 0.25rem; }
.facts li { font-size: 0.9rem; }

/* ----------------------------------------------------------- activities */
.activity-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.75rem; }
.activity-item {
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand-yellow);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  background: var(--surface);
}
.activity-head { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.activity-head h3 { margin: 0; }
.activity-summary { margin: 0.35rem 0 0; color: var(--text-muted); }
.activity-body { margin-top: 0.5rem; }
.activity-body summary { cursor: pointer; color: var(--brand-red); font-weight: 600; }
.activity-content { margin-top: 0.5rem; }
.activity-content p { margin: 0.4rem 0; }

/* -------------------------------------------------- bulk / confirmation */
.bulk-bar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.check-grid {
  display: grid;
  gap: 0.3rem;
  margin: 0.5rem 0;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem;
  background: var(--surface-2);
}
.check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-weight: 400;
  margin: 0;
}
.check-row input { width: auto; margin-top: 0.25rem; }

.stack { margin-bottom: 0.75rem; }

.confirm-list {
  margin: 0.5rem 0 1rem;
  padding-left: 1.2rem;
  max-height: 320px;
  overflow-y: auto;
}
.confirm-list li { margin: 0.15rem 0; }

/* -------------------------------------------------------------- filters */
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.5rem 0.75rem;
  align-items: end;
  margin-bottom: 0.75rem;
}
.filters label { margin-top: 0; }

.pager { display: flex; gap: 1rem; margin-top: 0.75rem; }

/* --------------------------------------------------------------- footer */
.site-footer {
  padding: 1rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 3px solid var(--brand-yellow);
  background: var(--surface);
}
.site-footer p { margin: 0 auto; max-width: 720px; }

@media (max-width: 600px) {
  .site-main { padding: 1rem 0.75rem 1.5rem; }
  .card { padding: 1rem; }
  .site-header { padding: 0.6rem 0.75rem; gap: 0.5rem; }
  .nav { margin-left: 0; width: 100%; }
  .account-panel { right: auto; left: 0; }
  table.directory th:nth-child(5), table.directory td:nth-child(5) { display: none; }
}
