:root {
  --bg: #12181f;
  --bg-accent: #21333b;
  --panel: #1b232c;
  --border: #2d3a49;
  --text: #e9eef5;
  --muted: #b0bdcc;
  --accent: #12c29c;
  --accent-strong: #0d9a7d;
  --danger: #9f1d1d;
  --input-bg: #121821;
  --input-text: #e9eef5;
  --panel-shadow: rgba(0, 0, 0, 0.35);
  --tab-bg: #243244;
  --tab-active-bg: #355a66;
  --tab-active-border: #5a9fb2;
  --button-secondary-bg: #2f4f7a;
  --button-secondary-hover: #3b6192;
  --button-filter-bg: #2d7ff0;
  --button-filter-hover: #1f63c3;
  --button-filter-active: #12c29c;
  --message-bg: #203036;
  --message-error-bg: #3a1f23;
}

body.theme-light {
  --bg: #f4f7fb;
  --bg-accent: #deefe9;
  --panel: #ffffff;
  --border: #d5dce6;
  --text: #172236;
  --muted: #53637a;
  --input-bg: #ffffff;
  --input-text: #172236;
  --panel-shadow: rgba(18, 40, 72, 0.08);
  --tab-bg: #f2f6fb;
  --tab-active-bg: #dbeee8;
  --tab-active-border: #9ec9bb;
  --button-secondary-bg: #6d7989;
  --button-secondary-hover: #5a6573;
  --button-filter-bg: #2f7b8a;
  --button-filter-hover: #215a66;
  --button-filter-active: #0a7a62;
  --message-bg: #f6fbfa;
  --message-error-bg: #fff5f5;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--text);
  min-height: 100vh;
  background-color: var(--bg);
  background-image: radial-gradient(circle at top right, var(--bg-accent), transparent 40%);
  background-repeat: no-repeat;
  background-size: 100vw 100vh;
  background-attachment: fixed;
}

.notification-center {
  position: fixed;
  top: 10px;
  right: 16px;
  z-index: 1200;
}

.notification-bell {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  width: 42px;
  height: 42px;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 8px 20px var(--panel-shadow);
}

.notification-bell-icon {
  width: 22px;
  height: 22px;
  display: block;
  margin: 0 auto;
}

.notification-bell.unread-info {
  color: #1d9a46;
}

.notification-bell.unread-error {
  color: #c03535;
}

.notification-drawer {
  margin-top: 8px;
  width: min(520px, 92vw);
  max-height: 70vh;
  overflow: auto;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 20px var(--panel-shadow);
}

.notification-list {
  display: grid;
  gap: 8px;
}

.notification-item {
  border-left: 4px solid var(--accent);
  background: var(--message-bg);
  padding: 8px;
}

.notification-item.error {
  border-left-color: var(--danger);
  background: var(--message-error-bg);
}

.notification-time {
  font-size: 0.75rem;
  margin-bottom: 4px;
}

.shell {
  width: 90vw;
  max-width: 1800px;
  margin: 0 auto;
  padding: 24px;
}

.hero,
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 8px 20px var(--panel-shadow);
}

.hero {
  position: relative;
}

.hero-layout {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.hero-main {
  flex: 1;
  min-width: 260px;
}

.hero-top-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.hero-credentials {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--tab-bg);
  min-width: 300px;
}

.hero-credentials h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.hero-credentials p {
  margin: 4px 0;
  font-size: 0.9rem;
}

.hero-tabs-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.version-indicator {
  position: absolute;
  right: 20px;
  bottom: 12px;
  font-size: 0.78rem;
  font-weight: 600;
}

h1,
h2 {
  margin-top: 0;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
}

.tab-button {
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  padding: 10px 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.tab-button + .tab-button {
  border-left: 1px solid var(--border);
}

.tab-button.active {
  background: var(--tab-active-bg);
  border-bottom-color: var(--tab-active-border);
  color: var(--text);
}

.tab-button:hover {
  background: var(--tab-bg);
}

.button {
  display: inline-block;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  text-decoration: none;
  color: #ffffff;
  background: var(--accent);
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
}

.button:hover {
  background: var(--accent-strong);
}

.button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.button-secondary {
  background: var(--button-secondary-bg);
}

.button-secondary:hover {
  background: var(--button-secondary-hover);
}

.button-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
}

.button-icon-remove {
  background: #8e2f2f;
}

.button-icon-remove:hover {
  background: #722020;
}

.button-icon-approve {
  background: #1d9a46;
}

.button-icon-approve:hover {
  background: #177938;
}

.button-icon-deny {
  background: #c03535;
}

.button-icon-deny:hover {
  background: #9e2b2b;
}

.button-icon:disabled {
  opacity: 1;
  background: #9aa5b1;
  color: #e8ecf1;
  border: 1px solid #7f8b98;
  cursor: not-allowed;
}

.button-filter {
  background: var(--button-filter-bg);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.button-filter:hover {
  background: var(--button-filter-hover);
}

.button-filter.active {
  background: var(--button-filter-active);
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  line-height: 1.1;
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.filter-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.scheduled-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.status-filter-buttons {
  display: flex;
  gap: 8px;
  margin-right: 8px;
  flex-wrap: wrap;
}

.scheduled-controls input[type="range"] {
  width: 180px;
}

#refreshBtn {
  margin-left: auto;
}

#refreshLogsBtn {
  margin-left: auto;
}

.controls {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.controls label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.95rem;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.activation-toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.controls input,
table input[type="text"] {
  min-width: 120px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--input-text);
  font-family: inherit;
  font-size: 0.95rem;
}

.controls select,
.scheduled-controls select,
table select,
.scheduled-controls input[type="datetime-local"] {
  min-width: 120px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--tab-bg);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 3px 8px var(--panel-shadow);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
}

.controls select:hover,
.scheduled-controls select:hover,
table select:hover,
.scheduled-controls input[type="datetime-local"]:hover {
  background: var(--tab-active-bg);
}

table input[type="text"] {
  width: 220px;
}

.approval-message-input {
  min-width: 240px;
}

.scope-id {
  display: inline-block;
  max-width: 360px;
  overflow-wrap: anywhere;
}

.source-icon-cell {
  width: 42px;
}

.source-icon {
  width: 24px;
  height: 24px;
  display: block;
}

.scope-controls {
  display: grid;
  gap: 6px;
}

.date-utc {
  font-weight: 600;
}

.date-local {
  margin-top: 2px;
}

.small {
  font-size: 0.8rem;
  margin-top: 4px;
}

.scope-helper-loading {
  color: #b10f0f;
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: 4px;
}

.checkout-duration-cell {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
}

.checkout-duration-cell select {
  min-width: 100px;
}

.loading-cell {
  font-style: italic;
}

.loading-cell::after {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 8px;
  border: 2px solid #7fa0ad;
  border-top-color: transparent;
  border-radius: 999px;
  vertical-align: middle;
  animation: spin-loader 0.8s linear infinite;
}

@keyframes spin-loader {
  to {
    transform: rotate(360deg);
  }
}

.grow {
  flex: 1;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

th,
td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 10px;
  vertical-align: top;
}

.logs-group-row td {
  background: rgba(127, 160, 173, 0.12);
  font-weight: 700;
}

.expired-request-row td {
  background: rgba(192, 53, 53, 0.14);
}

.queued-request-row td {
  box-shadow: inset 0 0 0 9999px rgba(18, 194, 156, 0.08);
}

.queue-status {
  font-weight: 700;
}

.actions {
  margin-top: 12px;
}

.actions-right {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.theme-toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.mode-label {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}

.theme-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #9aa5b1;
  border-radius: 999px;
  transition: background-color 0.2s ease;
}

.theme-switch-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.theme-switch input:checked + .theme-switch-slider {
  background-color: var(--accent);
}

.theme-switch input:checked + .theme-switch-slider::before {
  transform: translateX(22px);
}

.muted {
  color: var(--muted);
}

.hidden {
  display: none;
}

.message {
  border-left: 4px solid var(--accent);
  padding: 10px;
  background: var(--message-bg);
  margin-bottom: 10px;
}

.message.error {
  border-left-color: var(--danger);
  background: var(--message-error-bg);
}

@media (max-width: 720px) {
  .shell {
    padding: 12px;
  }

  .hero,
  .panel {
    padding: 14px;
  }

  .hero-layout {
    flex-direction: column;
  }

  .hero-top-right {
    width: 100%;
    align-items: flex-start;
  }

  .hero-credentials {
    width: 100%;
    min-width: 0;
  }

  .hero-actions {
    width: 100%;
    justify-content: flex-start;
  }

  #refreshBtn {
    width: 100%;
    margin-left: 0;
  }
}
