:root {
  --sidebar-bg: #003433;
  --sidebar-active-bg: rgba(20,232,212,0.15);
  --sidebar-active-border: #14E8D4;
  --teal: #00837E;
  --teal-light: #00D9D2;
  --teal-dark: #003433;
  --page-bg: #F8FAFC;
  --card-bg: #ffffff;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --danger: #EF4444;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page-bg);
  color: var(--text-primary);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

a { color: inherit; text-decoration: none; }

/* ── Layout ── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: 240px;
  padding: 32px 40px;
  min-height: 100vh;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

.page-sub {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 4px;
}

/* ── Sidebar ── */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  padding: 24px 0;
}

.sidebar-logo {
  padding: 0 24px 28px;
}
.sidebar-logo img { height: 32px; }

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 12px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 8px;
  border-left: 3px solid transparent;
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  font-weight: 500;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,0.05);
  color: #fff;
}

.sidebar-nav a.active {
  background: var(--sidebar-active-bg);
  border-left-color: var(--sidebar-active-border);
  color: var(--sidebar-active-border);
}

.sidebar-user {
  padding: 16px 20px 0;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: 12px;
  padding-top: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user-info { min-width: 0; }
.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
}

.sidebar-logout {
  margin-top: 12px;
  padding: 0 20px;
}
.sidebar-logout a {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  padding: 6px 0;
  display: inline-block;
}
.sidebar-logout a:hover { color: #fff; }

/* ── Cards ── */
.card {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
  padding: 20px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
  padding: 20px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-primary);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  background: var(--teal);
  color: #fff;
}
.btn-primary:hover { background: #006D69; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.btn-secondary:hover { background: var(--page-bg); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #DC2626; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; }

/* ── Tables ── */
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table thead th {
  background: var(--page-bg);
  text-align: left;
  padding: 11px 14px;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.data-table tbody tr {
  border-bottom: 1px solid var(--border-light);
}
.data-table tbody tr:hover { background: var(--page-bg); }
.data-table td {
  padding: 12px 14px;
  color: var(--text-primary);
}
.data-table .actions { display: flex; gap: 8px; }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-draft { background: #F1F5F9; color: #64748B; }
.badge-generated { background: #CCFBF1; color: #065F56; }
.badge-full { background: #CCFBF1; color: #065F56; }
.badge-view { background: #E2E8F0; color: #475569; }
.badge-none { background: #FEE2E2; color: #B91C1C; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}
.form-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
}
.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  background: #fff;
}
.form-control:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0,131,126,0.12);
}
textarea.form-control { resize: vertical; min-height: 90px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.radio-row { display: flex; gap: 20px; margin-bottom: 12px; }
.radio-option { display: flex; align-items: center; gap: 6px; font-size: 13px; }

/* ── Wizard ── */
.wizard-steps {
  display: flex;
  align-items: center;
  margin-bottom: 32px;
}
.wizard-step {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}
.wizard-step-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--border);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}
.wizard-step.active .wizard-step-circle,
.wizard-step.done .wizard-step-circle {
  background: var(--teal);
}
.wizard-step.active,
.wizard-step.done { color: var(--text-primary); }
.wizard-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 14px;
}
.wizard-connector.done { background: var(--teal); }

.wizard-panel { display: none; }
.wizard-panel.active { display: block; }

.wizard-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

/* ── Logo layout cards ── */
.layout-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.layout-card {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 18px 12px;
  text-align: center;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.layout-card:hover { border-color: var(--teal-light); }
.layout-card.selected {
  border-color: var(--teal);
  background: rgba(0,131,126,0.06);
  color: var(--teal);
}
.layout-card .layout-icons {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}
.layout-card .icon-dot {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--border);
}

.picker-btn {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-secondary);
  background: #fff;
}
.picker-btn img { max-height: 40px; max-width: 100%; margin-bottom: 6px; }
.picker-btn:hover { border-color: var(--teal); }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #fff;
  border-radius: 12px;
  width: 560px;
  max-width: 92vw;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { margin: 0; font-size: 15px; }
.modal-close { cursor: pointer; color: var(--text-muted); font-size: 18px; background: none; border: none; }
.modal-body { padding: 20px; overflow-y: auto; }
.media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.media-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  text-align: center;
}
.media-item:hover { border-color: var(--teal); }
.media-item img { max-height: 50px; max-width: 100%; margin-bottom: 6px; }
.media-item .media-label { font-size: 11px; color: var(--text-secondary); }

/* ── Login page ── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sidebar-bg);
}
.login-box { text-align: center; }
.login-box img.login-logo { height: 56px; margin-bottom: 40px; }
.btn-microsoft {
  background: var(--teal);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 13px 28px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: inherit;
}
.btn-microsoft:hover { background: #006D69; }

.pending-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--page-bg);
  text-align: center;
  padding: 20px;
}
.pending-box h1 { font-size: 20px; margin-bottom: 10px; }
.pending-box p { color: var(--text-secondary); font-size: 14px; max-width: 380px; }

/* ── Flash ── */
.flash {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 20px;
}
.flash-success { background: #ECFDF5; color: #047857; border: 1px solid #A7F3D0; }
.flash-error { background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }

/* ── Error pages ── */
.error-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
}
.error-code { font-size: 64px; font-weight: 800; color: var(--teal); }
.error-msg { color: var(--text-secondary); margin-top: 8px; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Dropzone ── */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 28px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
}
.dropzone.dragover { border-color: var(--teal); background: rgba(0,131,126,0.04); }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tab-btn {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-family: inherit;
}
.tab-btn.active { color: var(--teal); border-bottom-color: var(--teal); }

/* ── Recipient chip list ── */
.recipient-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--border-light); border-radius: 8px; }
.recipient-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}
.recipient-row:last-child { border-bottom: none; }
.recipient-row .remove-btn { color: var(--danger); cursor: pointer; background: none; border: none; font-size: 15px; }

.select-toggle { display: flex; gap: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; width: fit-content; margin-bottom: 18px; }
.select-toggle button {
  padding: 8px 18px;
  font-size: 12.5px;
  font-weight: 600;
  background: #fff;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-family: inherit;
}
.select-toggle button.active { background: var(--teal); color: #fff; }

/* ── Spinner ── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 4px;
  vertical-align: -2px;
}
