:root {
  --bg: #0a0a0c;
  --surface: #131418;
  --surface-2: #1a1c22;
  --border: #26282f;
  --text: #f2f3f5;
  --text-muted: #8b8d96;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, .55);
  --ok: #2fd97a;
  --ok-bg: rgba(47, 217, 122, .12);
  --warn: #f0a93a;
  --warn-bg: rgba(240, 169, 58, .12);
  --danger: #ff4d5e;
  --danger-bg: rgba(255, 77, 94, .12);
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  background-image: radial-gradient(circle at 20% 0%, rgba(59,130,246,.08), transparent 45%);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -.01em;
  margin-bottom: 24px;
}

.brand .tagline {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: normal;
  margin-left: 2px;
}

.brand .dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  animation: pulse-glow 2.4s ease-in-out infinite;
}

.auth-card h1 {
  font-size: 18px;
  margin: 0 0 20px;
  font-weight: 600;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 14px 0 6px;
  color: var(--text-muted);
}

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface-2);
  color: var(--text);
}

input::placeholder { color: #55575f; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
}

button, .btn {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  padding: 9px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  transition: background .12s ease, border-color .12s ease, opacity .12s ease, transform .08s ease, box-shadow .12s ease;
}
button:active, .btn:active { transform: scale(.96); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 2px 10px var(--accent-glow); }

.btn-secondary {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-secondary:hover { border-color: #3a3c44; background: var(--surface); }

.btn-danger { background: var(--danger); color: #1a0507; }
.btn-danger:hover { opacity: .88; }
.btn-ok { background: var(--ok); color: #04220f; }
.btn-ok:hover { opacity: .88; }

.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }

/* Full-width form-submit buttons opt in explicitly instead of every .btn
   defaulting to width:100% — that default was forcing small inline actions
   (Check Certificate, Confirm, Download) to stretch edge-to-edge and look
   oversized, which every one of them had to fight with an inline
   style="margin-top:0" override instead of just not inheriting it. */
.btn-block {
  width: 100%;
  margin-top: 20px;
}

.form-error {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-top: 14px;
  display: none;
}
.form-error.visible { display: block; }

.auth-footer {
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}
.auth-footer a { color: var(--accent); text-decoration: none; font-weight: 600; }
.auth-footer a:hover { text-decoration: underline; }

/* App shell */
.app-shell {
  display: grid;
  grid-template-columns: 224px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
}

.sidebar .brand { padding: 0 8px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
  line-height: 1.3;
}
.nav-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: .8;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--surface-2); color: var(--accent); }
.nav-link.active svg { opacity: 1; }

.nav-link.disabled {
  opacity: .55;
  cursor: default;
  pointer-events: none;
}
.nav-soon-badge {
  margin-left: auto;
  font-size: 9.5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warn);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  flex-shrink: 0;
}

.sidebar-footer {
  margin-top: auto;
  padding: 10px 8px;
  border-top: 1px solid var(--border);
}

.user-chip {
  font-size: 13px;
  margin-bottom: 8px;
}
.user-chip .name { font-weight: 600; }
.user-chip .role { color: var(--text-muted); text-transform: capitalize; }

.main {
  padding: 28px 36px;
  max-width: 1100px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.page-header h1 { font-size: 22px; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.page-header p { color: var(--text-muted); margin: 4px 0 0; font-size: 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 12px 16px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
}
th { color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-pending { background: var(--warn-bg); color: var(--warn); }
.badge-active { background: var(--ok-bg); color: var(--ok); }
.badge-rejected, .badge-open { background: var(--danger-bg); color: var(--danger); }
.badge-admin { background: rgba(157,124,255,.14); color: #b199ff; }
.badge-employee { background: var(--surface-2); color: var(--text-muted); }
.badge-in_progress { background: var(--warn-bg); color: var(--warn); }
.badge-done { background: var(--ok-bg); color: var(--ok); }

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}
.modal h2 { margin: 0 0 16px; font-size: 17px; font-weight: 700; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }

.made-with {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 12px;
  letter-spacing: .02em;
}
.made-with .heart {
  display: inline-block;
  color: var(--accent);
  animation: heartbeat 1.6s ease-in-out infinite;
}
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  20% { transform: scale(1.3); }
  35% { transform: scale(1); }
  50% { transform: scale(1.22); }
  70% { transform: scale(1); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 12px var(--accent-glow); opacity: 1; }
  50% { box-shadow: 0 0 18px var(--accent-glow); opacity: .7; }
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.card { animation: fade-in-up .25s ease-out; }
tbody tr { animation: fade-in-up .2s ease-out; }

.recall-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}
.recall-item .recall-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.recall-item .campaign {
  font-weight: 700;
  font-size: 13.5px;
}
.recall-item .field {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
}
.recall-item .field b { color: var(--text); font-weight: 600; }

.access-badge {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 55;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.access-badge-expired {
  color: var(--danger);
  border-color: var(--danger);
}

.telegram-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.telegram-fab .tg-tooltip {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.4;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-width: 220px;
  opacity: 0;
  transform: translateX(8px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}
.telegram-fab:hover .tg-tooltip,
.telegram-fab .tg-tooltip.tg-auto-show {
  opacity: 1;
  transform: translateX(0);
}
.telegram-fab .tg-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #229ED9;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(34,158,217,.45);
  animation: tg-pulse 2.2s ease-in-out infinite, tg-wiggle 4s ease-in-out infinite;
  flex-shrink: 0;
}
.telegram-fab .tg-btn svg { width: 26px; height: 26px; }
@keyframes tg-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,158,217,.5), 0 4px 16px rgba(34,158,217,.45); }
  50% { box-shadow: 0 0 0 9px rgba(34,158,217,0), 0 4px 16px rgba(34,158,217,.45); }
}
@keyframes tg-wiggle {
  0%, 60%, 100% { transform: rotate(0deg) scale(1); }
  65% { transform: rotate(-12deg) scale(1.08); }
  72% { transform: rotate(10deg) scale(1.08); }
  79% { transform: rotate(-8deg) scale(1.05); }
  86% { transform: rotate(6deg) scale(1.03); }
  93% { transform: rotate(0deg) scale(1); }
}

.package-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
}
.package-option:hover { border-color: var(--text-muted); }
.package-option.selected {
  border-color: var(--accent);
  background: var(--surface-2);
}
.package-option .package-name { font-weight: 600; flex: 1; }
.package-option .package-price { color: var(--text-muted); font-weight: 600; }
.package-option.selected .package-price { color: var(--accent); }

.pending-banner {
  background: var(--warn-bg);
  color: var(--warn);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 20px;
}
