/* ==========================================
   ADMIN STANDALONE BASE
   Shared dark-theme shell for admin pages
   ========================================== */

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

:root {
  --bg: #181818;
  --card-bg: #1e1e1e;
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.10);
  --text-primary: #e5e7eb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --radius: 14px;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  line-height: 1.6;
}

a {
  color: inherit;
}

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

.ui-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.topbar {
  position: sticky;
  top: 0;
  height: 56px;
  background: #202020;
  border-bottom: 1px solid rgba(59,130,246,0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.topbar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: calc(0.95rem + 2px);
  color: var(--text-primary);
}

.topbar-title .ui-icon {
  width: 22px;
  height: 22px;
}

.topbar-text {
  color: var(--text-primary);
}

.topbar-action {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: color 150ms, border-color 150ms, background 150ms;
  background: transparent;
}

.topbar-action:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: rgba(255,255,255,0.04);
}

.topbar-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.standalone-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 28px 48px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.page-eyebrow {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.page-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.page-subtitle {
  margin: 6px 0 0;
  font-size: 0.92rem;
  color: var(--text-secondary);
  max-width: 720px;
}

.content-section {
  display: block;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.card-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  flex-shrink: 0;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 10px;
  border: 1.5px solid;
  background: transparent;
  font-weight: 600;
  font-size: 0.875rem;
  color: inherit;
  cursor: pointer;
  transition: background 180ms, box-shadow 180ms, transform 150ms, border-color 180ms, color 180ms;
}

.btn-action:active {
  transform: translateY(1px);
}

.btn-save {
  background: rgba(59, 130, 246, 0.10);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.35);
}

.btn-save:hover {
  background: rgba(59, 130, 246, 0.18);
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.2);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.10);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.35);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.18);
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.2);
}

input,
select,
textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 0.875rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color 150ms, background 150ms;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(59, 130, 246, 0.04);
}

select {
  color-scheme: dark;
}

select option {
  background: #1e1e1e;
  color: var(--text-primary);
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #60a5fa;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

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

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.checkbox-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  z-index: 1000;
}

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

.modal-content {
  width: min(640px, 100%);
  background: #161616;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
}

.modal-header {
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 1rem;
}

.modal-close {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 150ms, color 150ms, border-color 150ms;
}

.modal-close:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-hover);
}

.modal-body {
  padding: 22px;
  display: grid;
  gap: 16px;
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.modal-grid .form-group--full {
  grid-column: 1 / -1;
}

.modal-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

.empty-state {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
}

.empty-state-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.empty-state-title {
  font-size: 1rem;
  font-weight: 600;
}

.empty-state-description {
  margin-top: 6px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.empty-state-action {
  margin-top: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.10);
  color: #60a5fa;
  cursor: pointer;
}

.empty-state-action-icon {
  font-weight: 700;
}

.system-clock {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
}

.clock-time-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.clock-time {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.clock-meta,
.clock-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

@media (max-width: 980px) {
  .page-header {
    flex-direction: column;
  }

  .topbar-left {
    flex: 1.3;
  }

  .topbar-center {
    display: none;
  }

  .topbar-right {
    flex: 0 0 auto;
  }
}

@media (max-width: 768px) {
  .standalone-shell {
    padding: 76px 16px 28px;
  }

  .topbar {
    padding: 0 14px;
  }

  .topbar-context {
    display: none;
  }

  .topbar-meta {
    display: none;
  }

  .modal-grid {
    grid-template-columns: 1fr;
  }
}
