:root {
  --font-sans: "Inter", "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Monaco, Consolas, monospace;

  --bg: #f4f6fb;
  --bg-soft: #eef2fa;
  --surface: #ffffff;
  --surface-muted: #f8faff;
  --surface-glass: rgba(255, 255, 255, 0.74);

  --text: #0e1729;
  --text-strong: #060f22;
  --text-muted: #5f6d87;

  --accent: #0a4b9a;
  --accent-strong: #003976;
  --accent-soft: #e7f0ff;
  --accent-2: #ffc82e;

  --success: #067647;
  --warning: #b54708;
  --danger: #b42318;

  --border: #d6deeb;
  --border-strong: #bcc8de;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --shadow-xs: 0 3px 10px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 12px 24px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 22px 46px rgba(15, 23, 42, 0.13);

  --transition-fast: 160ms ease;
  --transition-base: 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

html.dark-mode {
  --bg: #111827;
  --bg-soft: #1f2937;
  --surface: #172033;
  --surface-muted: #202b42;
  --surface-glass: rgba(23, 32, 51, 0.78);
  --text: #e5edf9;
  --text-strong: #f8fbff;
  --text-muted: #a9b7cc;
  --accent: #69a8ff;
  --accent-strong: #9dc6ff;
  --accent-soft: rgba(105, 168, 255, 0.18);
  --accent-2: #ffd45c;
  --border: #34435c;
  --border-strong: #4d5f7d;
}

html.dark-mode body {
  background:
    radial-gradient(circle at 8% -12%, rgba(105, 168, 255, 0.16) 0%, rgba(105, 168, 255, 0) 36%),
    radial-gradient(circle at 112% 16%, rgba(255, 212, 92, 0.14) 0%, rgba(255, 212, 92, 0) 34%),
    linear-gradient(180deg, #0f172a 0%, #111827 100%);
}

html.dark-mode body::before {
  background-image: radial-gradient(rgba(229, 237, 249, 0.08) 0.6px, transparent 0.6px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  color: var(--text);
  line-height: 1.45;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% -12%, rgba(10, 75, 154, 0.12) 0%, rgba(10, 75, 154, 0) 36%),
    radial-gradient(circle at 112% 16%, rgba(255, 200, 46, 0.2) 0%, rgba(255, 200, 46, 0) 34%),
    linear-gradient(180deg, #f7f9fd 0%, #edf2fa 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(10, 34, 79, 0.05) 0.6px, transparent 0.6px);
  background-size: 18px 18px;
  opacity: 0.36;
  z-index: -2;
}

::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(10, 75, 154, 0.58) 0%, rgba(10, 75, 154, 0.34) 100%);
  background-clip: padding-box;
}

::-webkit-scrollbar-track {
  background: rgba(216, 226, 242, 0.42);
  border-radius: 999px;
}

a {
  color: inherit;
}

svg {
  display: block;
}

:focus-visible {
  outline: 3px solid rgba(10, 75, 154, 0.35);
  outline-offset: 1px;
}

.hidden {
  display: none !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(10, 53, 116, 0.2);
  background:
    linear-gradient(120deg, rgba(3, 35, 82, 0.9) 0%, rgba(0, 57, 118, 0.9) 64%, rgba(17, 95, 171, 0.82) 100%);
  backdrop-filter: blur(16px) saturate(130%);
  box-shadow: var(--shadow-sm);
}

.topbar::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 2px;
  background: linear-gradient(90deg, rgba(255, 200, 46, 0), rgba(255, 200, 46, 0.85), rgba(255, 200, 46, 0));
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  filter: drop-shadow(0 6px 10px rgba(4, 16, 34, 0.28));
}

.brand h1 {
  margin: 0;
  color: #f8fbff;
  font-size: clamp(1rem, 1.2vw, 1.22rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 2px 0 0;
  color: rgba(235, 245, 255, 0.86);
  font-size: 0.82rem;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.container {
  width: min(1400px, calc(100vw - 44px));
  margin: 24px auto 50px;
  display: grid;
  grid-template-columns: 254px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.tabs {
  position: sticky;
  top: 90px;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(138, 162, 204, 0.48);
  border-radius: var(--radius-lg);
  background: var(--surface-glass);
  backdrop-filter: blur(10px) saturate(125%);
  box-shadow: var(--shadow-xs);
}

.tabs-meta {
  margin: 2px 2px 4px;
  padding: 8px 10px;
  border: 1px solid rgba(10, 75, 154, 0.18);
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(10, 75, 154, 0.08) 0%, rgba(10, 75, 154, 0.02) 100%);
  display: grid;
  gap: 2px;
}

.tabs-meta small {
  color: #5f79a2;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.tabs-meta strong {
  color: #133c73;
  font-size: 0.8rem;
  letter-spacing: 0.01em;
}

.tab {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #224678;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  font: 600 0.88rem/1.2 var(--font-sans);
  cursor: pointer;
  transition: transform var(--transition-fast), background-color var(--transition-base), color var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
}

.tab:hover {
  background: rgba(10, 75, 154, 0.08);
  border-color: rgba(10, 75, 154, 0.26);
  transform: translateX(2px);
}

.tab.active {
  background: linear-gradient(180deg, rgba(10, 75, 154, 0.18) 0%, rgba(10, 75, 154, 0.11) 100%);
  border-color: rgba(10, 75, 154, 0.36);
  color: #0c2f61;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.tab-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  border: 1px solid rgba(10, 75, 154, 0.2);
  background: #f3f8ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tab.active .tab-icon {
  border-color: rgba(10, 75, 154, 0.32);
  background: #e8f2ff;
}

.tab-icon svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.panel {
  grid-column: 2;
  display: none;
  gap: 16px;
}

.panel.active {
  display: grid;
  animation: panelIn var(--transition-base);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  position: relative;
  overflow: hidden;
  padding: 14px;
  border: 1px solid rgba(184, 198, 224, 0.72);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition-fast), box-shadow var(--transition-base), border-color var(--transition-base);
}

.metric-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: -24%;
  width: 56%;
  height: 100%;
  background: linear-gradient(120deg, rgba(10, 75, 154, 0.16), rgba(10, 75, 154, 0));
  transform: skewX(-22deg);
  opacity: 0.48;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.metric-card span {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.metric-card strong {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 8px;
  font-size: clamp(1.18rem, 1.4vw, 1.44rem);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--text-strong);
}

.metric-card.success {
  border-color: rgba(6, 118, 71, 0.35);
}

.metric-card.success strong {
  color: var(--success);
}

.metric-card.warning {
  border-color: rgba(181, 71, 8, 0.36);
}

.metric-card.warning strong {
  color: var(--warning);
}

.metric-card.danger {
  border-color: rgba(180, 35, 24, 0.34);
}

.metric-card.danger strong {
  color: var(--danger);
}

.card {
  position: relative;
  border: 1px solid rgba(176, 192, 220, 0.72);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97) 0%, rgba(249, 251, 255, 0.97) 100%);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  overflow: hidden;
}

.card:hover {
  border-color: rgba(124, 154, 204, 0.74);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.12);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 100% 0%, rgba(10, 75, 154, 0.08), transparent 40%),
    radial-gradient(circle at 0% 100%, rgba(255, 200, 46, 0.14), transparent 36%);
  opacity: 0.72;
}

.card > * {
  position: relative;
  z-index: 1;
}

.card h2,
.card h3 {
  margin: 0;
  color: #102448;
  letter-spacing: -0.015em;
}

.card h2 {
  font-size: 1.02rem;
  font-weight: 700;
}

.card h3 {
  font-size: 0.95rem;
  font-weight: 700;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.card-header h2 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.title-icon {
  width: 23px;
  height: 23px;
  border-radius: 8px;
  border: 1px solid rgba(10, 75, 154, 0.25);
  background: #edf4ff;
  color: #174986;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.title-icon svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.hint {
  margin: 8px 0 12px;
  color: var(--text-muted);
  font-size: 0.83rem;
}

.split-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.compact-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 5px;
  color: #32496f;
  font-size: 0.8rem;
  font-weight: 600;
}

label.inline {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #223a5f;
}

.repeat-controls {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.repeat-days-field {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 145px;
}

.repeat-days-field.is-disabled {
  opacity: 0.58;
}

.repeat-days-field select:disabled {
  cursor: not-allowed;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  padding: 10px 11px;
  font: 500 0.87rem/1.35 var(--font-sans);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

input:not([type="checkbox"]):not([type="radio"]):hover,
select:hover,
textarea:hover {
  border-color: var(--border-strong);
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(10, 75, 154, 0.62);
  box-shadow: 0 0 0 3px rgba(10, 75, 154, 0.17);
}

input[type="checkbox"] {
  appearance: none;
  width: 17px;
  height: 17px;
  border-radius: 5px;
  border: 1px solid #9fb3d8;
  background: #ffffff;
  display: inline-grid;
  place-items: center;
  margin: 0;
  cursor: pointer;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

input[type="checkbox"]::before {
  content: "";
  width: 10px;
  height: 10px;
  transform: scale(0);
  transition: transform 110ms ease;
  clip-path: polygon(14% 44%, 0 64%, 50% 100%, 100% 17%, 79% 0%, 42% 61%);
  background: #fff;
}

input[type="checkbox"]:checked {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

input[type="checkbox"]:checked::before {
  transform: scale(1);
}

textarea {
  resize: vertical;
  min-height: 92px;
}

.btn,
button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 11px;
  background: var(--accent-strong);
  color: #ffffff;
  padding: 9px 13px;
  font: 650 0.86rem/1.2 var(--font-sans);
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.btn:hover,
button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(10, 40, 87, 0.2);
}

.topbar-right .btn,
.topbar-right button {
  min-height: 36px;
}

.btn:active,
button:active {
  transform: translateY(0);
}

.btn.ghost,
button.ghost {
  background: #f1f6ff;
  border-color: #c8d6ee;
  color: #1f4273;
}

.btn.ghost:hover,
button.ghost:hover {
  background: #e9f2ff;
}

.btn.danger,
button.danger {
  background: #fff5f5;
  border-color: #f5c3c2;
  color: var(--danger);
}

.btn.danger:hover,
button.danger:hover {
  background: #ffeded;
}

.btn:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
  transform: none;
}

.btn.is-loading,
button.is-loading {
  position: relative;
  padding-left: 31px;
}

.btn.is-loading::before,
button.is-loading::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  width: 13px;
  height: 13px;
  margin-top: -7px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: rgba(255, 255, 255, 0.96);
  animation: spin 700ms linear infinite;
}

.btn.ghost.is-loading::before,
button.ghost.is-loading::before,
.btn.danger.is-loading::before,
button.danger.is-loading::before {
  border-color: rgba(10, 56, 121, 0.3);
  border-top-color: rgba(10, 56, 121, 0.9);
}

[data-requires-unlock="true"][disabled] {
  filter: grayscale(0.2);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.profile-admin-actions {
  justify-content: space-between;
  margin-bottom: 12px;
}

.inline-grid {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
}

.submit-preview {
  border: 1px solid rgba(10, 75, 154, 0.26);
  border-radius: 12px;
  background: linear-gradient(180deg, #f7fbff 0%, #edf5ff 100%);
  padding: 11px;
  display: grid;
  gap: 5px;
}

.submit-preview strong {
  font-size: 0.86rem;
  color: #163f76;
}

.submit-preview small {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #1a4f99;
}

.submit-preview small.warning {
  color: var(--warning);
}

.submit-preview small.late {
  color: var(--danger);
}

.conflict-warning {
  border: 1px solid rgba(180, 35, 24, 0.3);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff8f7 0%, #fff0ef 100%);
  color: #7d2720;
  padding: 11px;
}

.conflict-warning p {
  margin: 0 0 9px;
  font-weight: 600;
  font-size: 0.83rem;
}

.search-box {
  position: relative;
  margin-bottom: 10px;
}

.history-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  fill: #7390bc;
  pointer-events: none;
}

.search-input {
  padding-left: 36px !important;
}

.table-wrap {
  border: 1px solid rgba(186, 198, 221, 0.75);
  border-radius: 12px;
  overflow: auto;
  background: #fff;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid #edf2fa;
  text-align: left;
  vertical-align: middle;
  font-size: 0.83rem;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, #f6f9ff 0%, #edf3ff 100%);
  color: #47608a;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.045em;
  font-weight: 700;
}

tbody tr {
  transition: background-color var(--transition-fast);
}

tbody tr:nth-child(even) {
  background: rgba(242, 247, 255, 0.6);
}

tbody tr:hover {
  background: #f8fbff;
}

.job-title {
  display: grid;
  gap: 3px;
}

.job-title strong {
  font-size: 0.83rem;
  color: #0f2f5b;
}

.job-title small {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.job-submit {
  display: grid;
  gap: 3px;
}

.job-submit strong {
  color: #123f75;
  font-weight: 650;
}

.job-countdown {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #1f4f96;
}

.job-countdown.soon {
  color: var(--warning);
}

.job-countdown.late {
  color: var(--danger);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(10, 75, 154, 0.27);
  background: #edf4ff;
  color: #19447f;
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 24px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid #c9d6eb;
  background: #f2f6fd;
  color: #2b4f85;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.045em;
}

.status-pill.submitted,
.status-pill.authenticated,
.status-pill.approved {
  border-color: rgba(6, 118, 71, 0.35);
  background: #edfcf4;
  color: #106e45;
}

.status-pill.failed,
.status-pill.blocked_reauth_required,
.status-pill.blocked_form_changed,
.status-pill.missed,
.status-pill.cancelled,
.status-pill.reauth_required {
  border-color: rgba(180, 35, 24, 0.3);
  background: #fff0ef;
  color: #9f2a22;
}

.status-pill.scheduled,
.status-pill.preparing,
.status-pill.ready,
.status-pill.submitting,
.status-pill.draft,
.status-pill.unknown,
.status-pill.paused {
  border-color: rgba(10, 75, 154, 0.32);
  background: #eaf2ff;
  color: #164581;
}

.status-pill.pause {
  border-color: rgba(181, 71, 8, 0.32);
  background: #fff5eb;
  color: #a34913;
}

.list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.list li {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 9px 10px;
  background: var(--surface-muted);
  font-size: 0.81rem;
}

.list-item {
  padding-right: 34px;
}

.alert-item {
  border-left: 3px solid #7f9dca;
}

.alert-item.severity-error {
  border-left-color: var(--danger);
  background: linear-gradient(90deg, rgba(180, 35, 24, 0.1) 0%, rgba(180, 35, 24, 0) 38%), var(--surface-muted);
}

.alert-item.severity-warning {
  border-left-color: var(--warning);
  background: linear-gradient(90deg, rgba(181, 71, 8, 0.12) 0%, rgba(181, 71, 8, 0) 40%), var(--surface-muted);
}

.alert-item.severity-info {
  border-left-color: #1b63b8;
  background: linear-gradient(90deg, rgba(27, 99, 184, 0.12) 0%, rgba(27, 99, 184, 0) 40%), var(--surface-muted);
}

.audit-item {
  border-left: 3px solid #2d5fae;
  background: linear-gradient(90deg, rgba(45, 95, 174, 0.08) 0%, rgba(45, 95, 174, 0) 40%), var(--surface-muted);
}

.audit-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.audit-time {
  color: var(--text-muted);
  font-size: 0.73rem;
}

.audit-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 0.73rem;
}

.audit-details {
  margin: 0;
  display: grid;
  gap: 4px;
}

.audit-detail-row {
  display: grid;
  grid-template-columns: minmax(122px, 1fr) 2fr;
  gap: 8px;
}

.audit-detail-row dt {
  margin: 0;
  color: #516a92;
  font-size: 0.73rem;
  font-weight: 700;
}

.audit-detail-row dd {
  margin: 0;
  color: #12284b;
  font-size: 0.78rem;
  line-height: 1.35;
  word-break: break-word;
}

.audit-json {
  margin-top: 8px;
  border: 1px solid #c8d8f0;
  border-radius: 9px;
  background: #f7faff;
  overflow: hidden;
}

.audit-json summary {
  list-style-position: inside;
  cursor: pointer;
  color: #2e5f9c;
  font-size: 0.73rem;
  font-weight: 700;
  padding: 6px 8px;
}

.audit-json pre {
  margin: 0;
  padding: 8px;
  max-height: 180px;
  overflow: auto;
  font: 500 0.71rem/1.4 var(--font-mono);
  color: #193458;
  background: #f0f6ff;
}

.audit-empty,
.audit-inline {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.76rem;
}

.list-empty {
  color: var(--text-muted);
}

.list-clear-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 21px;
  height: 21px;
  border-radius: 999px;
  border: 1px solid #c2cedf;
  background: #fff;
  color: #5a6f91;
  padding: 0;
  min-width: 21px;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1;
}

.list-clear-btn:hover {
  background: #fff0f0;
  border-color: #f4b2b2;
  color: var(--danger);
}

.list-footer {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.list-page-info {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.pager-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pager-btn {
  min-width: 58px;
}

.pager-select {
  min-width: 106px;
  width: auto;
}

.app-tooltip {
  position: fixed;
  z-index: 100;
  max-width: min(320px, calc(100vw - 24px));
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(194, 205, 224, 0.8);
  background: rgba(10, 21, 40, 0.95);
  color: #e9f2ff;
  font-size: 0.75rem;
  line-height: 1.4;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px) scale(0.98);
  transform-origin: top center;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.app-tooltip.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 120;
  max-width: min(360px, calc(100vw - 24px));
  border: 1px solid rgba(165, 184, 216, 0.62);
  border-radius: 12px;
  background: rgba(9, 25, 50, 0.94);
  color: #f1f6ff;
  padding: 11px 13px;
  box-shadow: var(--shadow-md);
  font-size: 0.82rem;
  animation: toastIn 220ms ease;
}

.admin-login-gate {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 0% 0%, rgba(10, 75, 154, 0.45) 0%, rgba(10, 75, 154, 0) 34%),
    radial-gradient(circle at 100% 120%, rgba(255, 200, 46, 0.35) 0%, rgba(255, 200, 46, 0) 40%),
    rgba(4, 15, 35, 0.75);
  backdrop-filter: blur(12px);
}

.admin-login-card {
  width: min(452px, calc(100vw - 40px));
  border-radius: 18px;
  border: 1px solid rgba(187, 206, 236, 0.48);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97) 0%, rgba(245, 250, 255, 0.96) 100%);
  box-shadow: 0 28px 60px rgba(3, 15, 34, 0.32);
  padding: 20px;
  animation: panelIn var(--transition-base);
}

.admin-login-logo {
  width: 74px;
  height: 74px;
  border-radius: 16px;
  object-fit: cover;
  display: block;
  margin: 0 auto 12px;
  box-shadow: 0 14px 30px rgba(5, 24, 56, 0.18);
}

.admin-login-card h2 {
  margin: 0;
  text-align: center;
  color: #12325d;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.admin-login-card p {
  margin: 8px 0 14px;
  text-align: center;
  color: #42608b;
  font-size: 0.86rem;
}

.admin-login-form {
  display: grid;
  gap: 10px;
}

.admin-login-form button {
  margin-top: 2px;
}

.admin-login-error {
  margin: 10px 0 0;
  border: 1px solid rgba(180, 35, 24, 0.25);
  border-radius: 10px;
  background: #fff1f0;
  color: #9f2d24;
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 600;
}

.admin-login-note {
  display: block;
  margin-top: 11px;
  text-align: center;
  color: #5a7197;
  font-size: 0.74rem;
}

.admin-login-secondary {
  margin-top: 12px;
  border-top: 1px solid #d6e2f5;
  padding-top: 10px;
  display: grid;
  gap: 8px;
  justify-items: center;
}

.admin-login-secondary p {
  margin: 0;
  color: #516e98;
  font-size: 0.78rem;
}

.admin-login-secondary-btn {
  text-decoration: none;
}

.affiliation-note {
  display: block;
  width: min(900px, calc(100vw - 44px));
  margin: -28px auto 28px;
  color: var(--text-muted);
  font-size: 0.74rem;
  text-align: center;
}

.affiliation-note.compact {
  width: auto;
  margin: 12px auto 0;
  line-height: 1.35;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 1260px) {
  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .container {
    grid-template-columns: 1fr;
    gap: 16px;
    width: min(1200px, calc(100vw - 28px));
  }

  .tabs {
    position: static;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: auto;
  }

  .tab {
    justify-content: center;
  }

  .tab span:last-child {
    white-space: nowrap;
  }

  .panel {
    grid-column: 1;
  }

  .split-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .topbar {
    padding: 12px 14px;
    flex-wrap: wrap;
  }

  .brand {
    width: 100%;
  }

  .brand-logo {
    width: 142px;
  }

  .topbar-right {
    width: 100%;
    justify-content: flex-end;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid,
  .compact-form {
    grid-template-columns: 1fr;
  }

  .list-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .audit-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .audit-detail-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

@media (max-width: 640px) {
  .tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 13px;
  }

  th,
  td {
    padding: 8px;
    font-size: 0.79rem;
  }

  .toast {
    right: 10px;
    left: 10px;
    max-width: none;
  }
}


/* --- ENTERPRISE RESPONSIVENESS & NOTAM STYLING --- */
/* Base responsive helpers */
@media (max-width: 768px) {
  body {
    -webkit-text-size-adjust: 100%;
  }
  
  .topbar, .portal-topbar {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
    gap: 1rem;
  }
  
  .topbar .brand, .portal-topbar .brand {
    margin-bottom: 0.5rem;
  }

  header nav, .tabs {
    flex-wrap: wrap;
    width: 100%;
  }

  .tab, .btn {
    flex: 1 1 auto;
    text-align: center;
    justify-content: center;
  }

  /* Prevent overlapping in stats and cards */
  .stats-grid, .card-grid, .settings-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  /* Make forms stack cleanly */
  form label {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
  
  form label.inline {
    flex-direction: row;
    align-items: center;
  }

  /* Tables must scroll */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
  }
  
  table {
    min-width: 700px; /* Force table to maintain readability and scroll */
    border: none; /* Let the wrapper handle the border */
  }

  /* Fix modal overlaps */
  .modal-content, .panel, .card {
    padding: 1rem;
    width: 100%;
    box-sizing: border-box;
  }
}


/* --- NEW NOTAM BANNER RESPONSIVE CSS --- */
.notam-banner {
  background-color: #fff4e5;
  border-bottom: 1px solid #f5c070;
  color: #5c3b00;
  position: relative;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  font-family: var(--font-sans, "Inter", sans-serif);
}

.notam-content {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.warning-icon {
  margin-top: 2px;
}

.notam-content p {
  margin: 0;
  line-height: 1.5;
  font-size: 0.95rem;
  color: #5c3b00;
}

.notam-content strong {
  font-weight: 600;
  color: #4a2f00;
}

.notam-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.notam-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #8c5a00;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.notam-checkbox-label:hover {
  background-color: rgba(245, 192, 112, 0.2);
}

.notam-checkbox-label input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
  width: 1.1rem;
  height: 1.1rem;
  accent-color: #ca7600; /* Styles native checkboxes elegantly in modern browsers */
}

.close-notam {
  background: transparent;
  border: none;
  font-size: 1.75rem;
  line-height: 1;
  color: #a36a00;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-family: sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-notam:hover {
  background-color: rgba(245, 192, 112, 0.3);
  color: #5c3b00;
}

/* DESKTOP EXPLICIT */
@media (min-width: 769px) {
  .notam-banner {
    padding: 0.65rem 1.5rem 0.65rem 1.25rem;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  
  .notam-content {
    align-items: center;
  }
  
  .warning-icon {
    margin-top: 0;
  }
  
  .notam-actions {
    gap: 0.75rem;
    margin-left: 2rem;
  }
  
  .close-notam {
    padding: 0.25rem 0.5rem;
    margin-left: 0.5rem;
  }
}

/* MOBILE EXPLICIT */
@media (max-width: 768px) {
  .notam-banner {
    padding: 1rem;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .notam-actions {
    justify-content: space-between; /* Spread checkbox and X to opposite ends */
    width: 100%;
    border-top: 1px solid rgba(245, 192, 112, 0.4);
    padding-top: 0.75rem;
  }
  
  .notam-checkbox-label {
    font-size: 0.95rem; /* Larger font for mobile readability */
    padding: 0.4rem 0; /* Align perfectly with left edge */
  }

  .notam-checkbox-label input[type="checkbox"] {
    width: 1.35rem; /* Fat finger friendly touch target */
    height: 1.35rem;
  }
  
  .close-notam {
    padding: 0.35rem 0.75rem;
    background-color: rgba(245, 192, 112, 0.15); /* More prominent as a button on mobile */
  }
}


  .close-notam {
    position: relative;
    z-index: 9999;
    pointer-events: auto;
    touch-action: manipulation;
  }

@media (max-width: 960px) {
  body:not(.sidebar-open) .portal-layout, .portal-layout {
    grid-template-columns: 1fr !important;
  }
}

.admin-login-logo, .friend-login-logo {
  filter: none;
}

