:root {
  color-scheme: light;
  --bg: #f7f2e8;
  --bg-strong: #ebe0cd;
  --panel: rgba(255, 251, 245, 0.95);
  --panel-strong: rgba(252, 247, 239, 0.98);
  --ink: #1b2636;
  --muted: #606b7c;
  --line: rgba(151, 124, 81, 0.28);
  --accent: #153a5a;
  --accent-strong: #0b2438;
  --accent-soft: #d8e5f0;
  --accent-2: #ab8348;
  --accent-2-soft: #f3e4ce;
  --danger: #9a2d2a;
  --danger-soft: #f8e1db;
  --shadow: 0 24px 70px rgba(12, 24, 40, 0.16);
  --shadow-soft: 0 12px 32px rgba(12, 24, 40, 0.09);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(21, 58, 90, 0.16), transparent 26%),
    radial-gradient(circle at top right, rgba(171, 131, 72, 0.14), transparent 32%),
    linear-gradient(180deg, #fefbf6 0%, #f6eee2 44%, #f0e4d1 100%);
  min-height: 100vh;
}

.shell {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  padding: 20px;
}

.app-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.side-nav {
  padding: 20px;
  position: sticky;
  top: 20px;
}

.side-nav-head {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.side-tabs {
  display: grid;
  gap: 10px;
}

.side-tabs .tab {
  width: 100%;
  text-align: left;
}

.app-main {
  min-width: 0;
  display: grid;
  gap: 20px;
}


.hero {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: stretch;
  margin-bottom: 28px;
  padding: 28px 30px;
  border: 1px solid rgba(141, 118, 78, 0.2);
  border-radius: 2;
  background:
    linear-gradient(135deg, rgba(1, 42, 81, 0.96), rgba(0, 72, 173, 0.92) 52%, rgba(255, 153, 0, 0.74) 100%);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, transparent 0 48%, rgba(255, 255, 255, 0.06) 48% 52%, transparent 52%),
    repeating-linear-gradient(
      90deg,
      transparent 0 36px,
      rgba(255, 255, 255, 0.04) 36px 37px
    );
  pointer-events: none;
}

.hero-copy {
  display: grid;
  gap: 12px;
  align-content: end;
  position: relative;
  z-index: 1;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.72rem;
  color: rgba(244, 230, 203, 0.88);
}

h1 {
  margin: 0;
  font-family: "Cormorant Garamond", "Palatino Linotype", "Book Antiqua", serif;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 0.95;
  letter-spacing: 0.01em;
  max-width: 760px;
  color: #fff8ed;
}

.subhead {
  margin: 0;
  max-width: 760px;
  color: var(--muted);
  line-height: 1.55;
}

.hero .subhead {
  color: rgba(255, 246, 234, 0.84);
  font-size: 1.02rem;
}

.user-pill {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 241, 219, 0.18);
  border-radius: 2;
  background: rgba(255, 249, 239, 0.1);
  color: #fff8ed;
  box-shadow: none;
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 1;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(151, 124, 81, 0.2);
  border-radius: 2;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(8px);
}

.stack {
  display: grid;
  gap: 22px;
}

.hidden { display: none !important; }

.auth-wrap {
  max-width: 520px;
  margin: 48px auto 0;
  padding: 30px;
}

.auth-grid {
  display: grid;
  gap: 14px;
}

.auth-grid h2 {
  margin: 0;
  font-family: "Cormorant Garamond", "Palatino Linotype", "Book Antiqua", serif;
  font-size: 2rem;
  color: var(--accent-strong);
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

input, select, textarea, button {
  font: inherit;
}

input, select, textarea {
  width: 100%;
  padding: 13px 15px;
  border-radius: 2;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(21, 58, 90, 0.2);
  outline-offset: 1px;
  border-color: rgba(21, 58, 90, 0.38);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

button {
  border: 0;
  border-radius: 2;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition:
    transform 0.16s ease,
    opacity 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(24, 35, 31, 0.12);
}

button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
}

button.secondary {
  background: linear-gradient(180deg, #f5ecdd, #e8dbc8);
  color: var(--ink);
}

button.warn {
  background: linear-gradient(180deg, #f3dfbf, #e9cfaa);
  color: var(--accent-2);
}

button.danger {
  background: linear-gradient(180deg, #fbe8e2, #f4d2c8);
  color: var(--danger);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  margin-bottom: 20px;
}

.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab {
  background: linear-gradient(180deg, #f5ecdd, #e9decd);
  color: var(--ink);
}

.tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
}

.status {
  min-height: 1.2rem;
  color: var(--muted);
  padding: 0 20px 18px;
  font-size: 0.95rem;
}

.panel-body {
  padding: 0 22px 22px;
}

.grid {
  display: grid;
  gap: 18px;
}

.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  padding: 20px;
  margin-bottom: 20px;
}

.label-wide {
  grid-column: 1 / -1;
}

.inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--ink);
}

.inline-toggle input[type="checkbox"] {
  width: auto;
}

.card {
  border-top: 1px solid rgba(141, 118, 78, 0.14);
  padding: 24px 20px;
}

.card:first-child { border-top: 0; }

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.card h2, .card h3 {
  margin: 0 0 6px;
  font-family: "Cormorant Garamond", "Palatino Linotype", "Book Antiqua", serif;
  font-size: 2rem;
  color: var(--accent-strong);
}

.meta, .files, .permissions {
  display: grid;
  gap: 10px;
}

.meta {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 2;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.84rem;
  margin-right: 8px;
  border: 1px solid rgba(21, 58, 90, 0.14);
}

.badge.revoked, .badge.disabled {
  background: var(--danger-soft);
  color: var(--danger);
}

.endpoint-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex-wrap: wrap;
}

.endpoint-summary h2 {
  margin: 0;
}

.endpoint-actions {
  justify-content: flex-end;
}

.endpoint-info-shell {
  width: min(960px, 100%);
}

.endpoint-info-grid {
  display: grid;
  gap: 14px;
}

.endpoint-info-meta {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

.file-row, .scope-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-radius: 2;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(250, 243, 233, 0.86));
  border: 1px solid rgba(141, 118, 78, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.file-row > :first-child,
.scope-row > :first-child {
  flex: 1 1 260px;
  min-width: 0;
}

.file-row > :last-child,
.scope-row > :last-child {
  flex: 1 1 280px;
  min-width: 0;
}

.endpoint-agent-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  width: 100%;
  align-items: start;
}

.endpoint-agent-controls button {
  width: 100%;
}

.explorer-link {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  font-weight: bold;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.15em;
}

.explorer-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(17, 27, 24, 0.58);
  z-index: 100;
  backdrop-filter: blur(10px);
}

.explorer-modal.open {
  display: flex;
}

.explorer-shell {
  width: min(980px, 100%);
  max-height: 88vh;
  display: grid;
  grid-template-rows: auto auto 1fr;
  overflow: hidden;
  background: var(--panel-strong);
  border: 1px solid rgba(141, 118, 78, 0.24);
  border-radius: 2;
  box-shadow: var(--shadow);
}

.report-shell {
  width: min(75vw, 1400px);
  max-width: 100%;
  grid-template-rows: auto auto 1fr;
}

.monthly-shell {
  width: min(760px, 100%);
  grid-template-rows: auto 1fr;
}

.explorer-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  padding: 22px 22px 14px;
  border-bottom: 1px solid rgba(141, 118, 78, 0.14);
}

.explorer-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px 22px;
  border-bottom: 1px solid rgba(141, 118, 78, 0.14);
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.crumb {
  border: 0;
  border-radius: 2;
  background: linear-gradient(180deg, #f5ecdd, #e9decd);
  color: var(--ink);
  padding: 8px 12px;
  cursor: pointer;
}

.explorer-body {
  overflow: auto;
  padding: 0 22px 22px;
  min-height: 0;
}

.explorer-list {
  display: grid;
  gap: 10px;
  padding-top: 16px;
}

.explorer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 2;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 240, 229, 0.88));
  border: 1px solid rgba(141, 118, 78, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.explorer-row-title {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.explorer-kind {
  font-size: 0.82rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.explorer-path {
  color: var(--muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.explorer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: end;
}

.empty {
  color: var(--muted);
  font-style: italic;
}

.report-body {
  display: grid;
  gap: 18px;
  padding-bottom: 20px;
}

.monthly-list {
  display: grid;
  gap: 12px;
  padding-top: 16px;
  padding-bottom: 20px;
}

.monthly-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: 2;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(214, 198, 177, 0.65);
}

.report-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.report-meta-card,
.report-section {
  border: 1px solid rgba(141, 118, 78, 0.16);
  border-radius: 2;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 240, 229, 0.86));
  padding: 16px;
}

.report-meta-card strong,
.report-section strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-strong);
}

.report-section {
  display: grid;
  gap: 12px;
}

.report-section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: baseline;
}

.report-table-wrap {
  overflow: auto;
  border: 1px solid rgba(141, 118, 78, 0.14);
  border-radius: 2;
  background: rgba(255, 255, 255, 0.76);
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 480px;
}

.report-table th,
.report-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(141, 118, 78, 0.14);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.report-table th {
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, #efe1c9, #e5d1b1);
  color: var(--accent-strong);
}

.report-table tr:last-child td {
  border-bottom: 0;
}

.checkbox-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 2;
  background: rgba(255, 255, 255, 0.84);
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.checkbox-item input {
  width: auto;
  margin: 0;
}

code {
  background: rgba(21, 58, 90, 0.08);
  padding: 2px 6px;
  border-radius: 2;
  overflow-wrap: anywhere;
}

a {
  color: var(--accent-strong);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.15em;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 720px) {
  .hero {
    align-items: start;
    flex-direction: column;
    padding: 24px 22px;
  }

  .toolbar {
    padding-bottom: 14px;
  }

  .user-pill {
    width: 100%;
    justify-content: space-between;
  }

  .explorer-row,
  .monthly-row {
    grid-template-columns: 1fr;
  }

  .explorer-actions {
    justify-content: start;
  }

  .card-head {
    align-items: stretch;
  }

  .endpoint-actions {
    justify-content: flex-start;
  }

  .report-shell {
    width: 100%;
  }
}
