:root {
  color-scheme: light;
  --ink: #102033;
  --muted: #64748b;
  --line: #dce4ec;
  --surface: #ffffff;
  --canvas: #f4f7f9;
  --navy: #153a5b;
  --navy-dark: #0d2b45;
  --teal: #159a9c;
  --teal-soft: #e6f6f5;
  --red: #b42318;
  --shadow: 0 18px 50px rgba(15, 32, 51, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

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

.brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 20px;
  border-radius: 16px;
  background: linear-gradient(145deg, var(--teal), var(--navy));
  color: white;
  place-items: center;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.brand-mark--small { width: 42px; height: 42px; margin: 0; border-radius: 12px; }

.login-shell {
  min-height: 100vh;
  display: grid;
  padding: 24px;
  background:
    radial-gradient(circle at 10% 0%, rgba(21, 154, 156, 0.2), transparent 34rem),
    linear-gradient(145deg, #f8fbfc, #eaf1f5);
  place-items: center;
}

.login-card {
  width: min(100%, 430px);
  padding: 42px;
  border: 1px solid rgba(220, 228, 236, 0.9);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.login-card h1 { margin: 0; font-size: clamp(1.75rem, 5vw, 2.25rem); letter-spacing: -0.04em; }
.login-card > .muted { margin: 12px 0 28px; line-height: 1.55; }
.login-form { display: grid; gap: 18px; }
label { display: grid; gap: 7px; color: #30445a; font-size: 0.85rem; font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1px solid #cbd7e2;
  border-radius: 10px;
  background: white;
  color: var(--ink);
  outline: none;
  transition: border-color 150ms, box-shadow 150ms;
}
input, select { min-height: 44px; padding: 0 12px; }
textarea { padding: 12px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(21, 154, 156, 0.14);
}

.button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 750;
}
.button:disabled { cursor: not-allowed; opacity: 0.55; }
.button--primary { background: var(--navy); color: white; }
.button--primary:hover { background: var(--navy-dark); }
.button--secondary { border-color: var(--line); background: white; color: var(--navy); }
.button--quiet { background: transparent; color: #dce8ef; border-color: rgba(255,255,255,.2); }

.form-message { min-height: 1.25rem; margin: 0; color: var(--teal); font-size: .85rem; }
.form-message--error { color: var(--red); }

.app-header {
  min-height: 82px;
  padding: 16px clamp(20px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--navy-dark);
  color: white;
}
.app-header__brand { display: flex; align-items: center; gap: 14px; }
.app-header h1 { margin: 0; font-size: 1.25rem; letter-spacing: -.025em; }
.account { display: flex; align-items: center; gap: 14px; color: #c7d6e2; font-size: .85rem; }
.role-pill { margin-left: 6px; padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,.14); text-transform: capitalize; }

.dashboard { width: min(100% - 40px, 1420px); margin: 34px auto 70px; }
.operations-alert { margin-bottom: 16px; padding: 13px 16px; border: 1px solid #f2c78f; border-radius: 10px; background: #fff7e8; color: #7c4a08; font-weight: 700; }
.summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 20px; }
.feed-tabs { display: flex; gap: 10px; margin-bottom: 16px; }
.feed-tabs .is-active { background: var(--navy); color: white; }
.summary-card {
  min-height: 100px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-top: 4px solid #94a3b8;
  border-radius: 14px;
  background: var(--surface);
  color: var(--muted);
  text-align: left;
}
.summary-card strong { color: var(--ink); font-size: 1.9rem; letter-spacing: -.04em; }
.summary-card--new { border-top-color: #db8d22; }
.summary-card--contacted { border-top-color: #3b82f6; }
.summary-card--scheduled { border-top-color: var(--teal); }
.summary-card--closed { border-top-color: #64748b; }
.summary-card.is-active { box-shadow: 0 0 0 3px rgba(21,154,156,.16); border-color: var(--teal); }

.requests-panel { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 10px 35px rgba(16,32,51,.05); overflow: hidden; }
.panel-heading { padding: 24px 26px 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel-heading h2 { margin: 0; font-size: 1.45rem; }
.filters { padding: 0 26px 22px; display: grid; grid-template-columns: minmax(260px, 1fr) 190px 190px auto; gap: 10px; }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 18px; background: #f8fafc; color: #52667a; font-size: .71rem; letter-spacing: .07em; text-align: left; text-transform: uppercase; }
td { padding: 17px 18px; border-top: 1px solid #edf1f5; vertical-align: top; font-size: .88rem; }
tbody tr { transition: background 120ms; }
tbody tr:hover { background: #f8fbfc; }
.cell-primary { display: block; margin-bottom: 4px; color: var(--ink); font-weight: 750; }
.cell-secondary { display: block; color: var(--muted); font-size: .8rem; }
.row-open { border: 0; background: transparent; color: var(--teal); font-weight: 800; }
.row-actions { min-width: 116px; }
.row-actions > * { margin: 0 6px 6px 0; }
.button--small { min-height: 32px; padding-inline: 11px; font-size: .78rem; }
.inline-status { min-width: 118px; }
.inline-notes { min-width: 210px; min-height: 64px; }

.badge { display: inline-flex; min-height: 25px; padding: 3px 9px; align-items: center; border-radius: 999px; background: #eef2f6; color: #52667a; font-size: .72rem; font-weight: 800; text-transform: capitalize; }
.badge--new { background: #fff4df; color: #995b09; }
.badge--contacted { background: #e9f2ff; color: #1d5dba; }
.badge--scheduled, .badge--sent { background: var(--teal-soft); color: #087477; }
.badge--closed { background: #eef2f6; color: #52667a; }
.badge--failed, .badge--not_configured { background: #fff0ee; color: var(--red); }

.loading-state, .empty-state, .error-state { padding: 56px 24px; color: var(--muted); text-align: center; }
.empty-state h3 { margin: 0 0 8px; color: var(--ink); }
.empty-state p { margin: 0; }
.error-state { color: var(--red); }
.pagination { padding: 18px 26px; display: flex; align-items: center; justify-content: flex-end; gap: 15px; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }

.request-dialog { width: min(760px, calc(100% - 28px)); max-height: calc(100vh - 28px); padding: 0; border: 0; border-radius: 20px; color: var(--ink); box-shadow: 0 30px 90px rgba(10,28,43,.32); }
.request-dialog::backdrop { background: rgba(8,24,38,.6); backdrop-filter: blur(2px); }
.dialog-shell { max-height: calc(100vh - 28px); overflow-y: auto; }
.dialog-header { position: sticky; top: 0; z-index: 2; padding: 24px 26px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.97); }
.dialog-header h2 { margin: 0; font-size: 1.55rem; letter-spacing: -.03em; }
.dialog-header .muted { margin: 6px 0 0; font-size: .82rem; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: white; color: var(--ink); font-size: 1.6rem; line-height: 1; }
.detail-section { padding: 24px 26px; border-bottom: 1px solid var(--line); }
.detail-section:last-child { border: 0; }
.detail-section h3 { margin: 0 0 18px; font-size: 1rem; }
.detail-grid { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 18px 28px; }
.detail-pair { min-width: 0; }
.detail-pair--wide { grid-column: 1 / -1; }
.detail-pair dt { margin-bottom: 5px; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.detail-pair dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; line-height: 1.5; }
.detail-pair a { color: var(--navy); }
.upload-gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.upload-card { display: grid; gap: 7px; color: var(--navy); font-size: .78rem; overflow-wrap: anywhere; }
.upload-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border: 1px solid var(--line); border-radius: 10px; background: #f3f6f8; }
.update-form { display: grid; gap: 17px; }
.update-actions { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.button-group { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.button--danger { border-color: #b42318; background: #b42318; color: white; }
.activity-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 14px; }
.activity-item { padding-left: 18px; border-left: 3px solid var(--line); }
.activity-item strong { display: block; font-size: .86rem; }
.activity-item span { color: var(--muted); font-size: .78rem; }
.activity-item p { margin: 6px 0 0; white-space: pre-wrap; font-size: .84rem; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 20; max-width: 360px; padding: 13px 17px; border-radius: 10px; background: var(--navy-dark); color: white; box-shadow: var(--shadow); }
.staff-panel { margin-top: 20px; }
.notification-panel { margin-top: 20px; }
.settings-help { margin: -8px 26px 18px; color: var(--muted); }
.notification-settings { padding: 0 26px 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.notification-setting { display: grid; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
.notification-setting label { display: grid; gap: 8px; font-weight: 750; }
.notification-setting .button { justify-self: start; }
#notification-message { padding: 0 26px 22px; }
.staff-create-form { padding: 0 26px 22px; display: grid; grid-template-columns: 1fr 1fr 150px auto; gap: 12px; align-items: end; }
.staff-create-form .form-message { grid-column: 1 / -1; }
.staff-users { border-top: 1px solid var(--line); }
.staff-user { padding: 14px 26px; display: grid; grid-template-columns: minmax(220px, 1fr) 130px auto auto minmax(180px, .8fr) auto; gap: 12px; align-items: center; border-top: 1px solid #edf1f5; }
.staff-user:first-child { border-top: 0; }
.staff-user strong, .staff-user span { display: block; }
.staff-user span { margin-top: 3px; color: var(--muted); font-size: .78rem; }

@media (max-width: 900px) {
  .summary { grid-template-columns: repeat(2, 1fr); }
  .summary-card--all { grid-column: 1 / -1; }
  .filters { grid-template-columns: 1fr 180px 180px; }
  .filters .button { grid-column: 1 / -1; }
  .staff-create-form, .staff-user { grid-template-columns: 1fr 1fr; }
  .notification-settings { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .login-card { padding: 30px 24px; }
  .app-header { align-items: flex-start; }
  .account { flex-direction: column; align-items: flex-end; }
  #account-email { display: none; }
  .dashboard { width: min(100% - 24px, 1420px); margin-top: 20px; }
  .summary { gap: 9px; }
  .summary-card { min-height: 86px; padding: 14px; }
  .filters { grid-template-columns: 1fr; padding-inline: 16px; }
  .filters .button { grid-column: auto; }
  .panel-heading { padding-inline: 16px; }
  th { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  tr { position: relative; padding: 15px 48px 15px 16px; border-top: 1px solid var(--line); }
  td { padding: 4px 0; border: 0; }
  td:nth-child(1), td:nth-child(6) { display: none; }
  td:last-child { position: static; transform: none; }
  .inline-notes { min-width: 0; }
  .detail-grid { grid-template-columns: 1fr; }
  .upload-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-pair--wide { grid-column: auto; }
  .dialog-header, .detail-section { padding-inline: 19px; }
  .pagination { justify-content: space-between; padding-inline: 16px; }
  .staff-create-form, .staff-user { grid-template-columns: 1fr; padding-inline: 16px; }
}
