:root {
  color-scheme: dark;
  --bg: #0b1020;
  --panel: #111827;
  --panel-2: #172033;
  --line: #243047;
  --text: #f8fafc;
  --muted: #94a3b8;
  --primary: #7c3aed;
  --primary-2: #8b5cf6;
  --success: #16a34a;
  --warning: #d97706;
  --info: #2563eb;
  --danger: #dc2626;
  --shadow: 0 24px 70px rgba(0, 0, 0, .28);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% -10%, rgba(124, 58, 237, .18), transparent 28rem),
    radial-gradient(circle at 100% 0%, rgba(37, 99, 235, .10), transparent 30rem),
    var(--bg);
}

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

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  min-height: 72px;
  padding: 0 32px;
  border-bottom: 1px solid rgba(148, 163, 184, .12);
  background: rgba(11, 16, 32, .82);
  backdrop-filter: blur(18px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary-2), #4f46e5);
  box-shadow: 0 10px 26px rgba(124, 58, 237, .32);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
}

.brand small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 20px;
  color: #cbd5e1;
  font-size: 14px;
}

.nav a:hover,
.link-button:hover {
  color: #fff;
}
.nav form {
  margin: 0;
}

.link-button {
  padding: 0;
  border: 0;
  color: #cbd5e1;
  background: transparent;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0 60px;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
  border-top: 1px solid rgba(148, 163, 184, .1);
  color: #64748b;
  font-size: 12px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(30px, 5vw, 48px);
  letter-spacing: -.04em;
}
h2 {
  margin-bottom: 6px;
  font-size: 22px;
  letter-spacing: -.02em;
}

.eyebrow {
  margin-bottom: 7px;
  color: #a78bfa;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
}

.muted {
  color: var(--muted);
}

.flash {
  margin-bottom: 20px;
  padding: 14px 16px;
  border: 1px solid;
  border-radius: 12px;
  font-size: 14px;
}

.flash-success {
  border-color: rgba(34, 197, 94, .32);
  background: rgba(34, 197, 94, .12);
  color: #bbf7d0;
}

.flash-error {
  border-color: rgba(239, 68, 68, .34);
  background: rgba(239, 68, 68, .12);
  color: #fecaca;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  align-items: end;
  gap: 28px;
  margin-bottom: 26px;
}
.status-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 92px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(17, 24, 39, .88);
  box-shadow: var(--shadow);
}

.status-card small,
.status-card strong {
  display: block;
}

.status-card small {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.status-card strong {
  font-size: 18px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 99px;
  background: #64748b;
  box-shadow: 0 0 0 6px rgba(100, 116, 139, .12);
}

.status-card.is-active .status-dot {
  background: #22c55e;
  box-shadow: 0 0 0 6px rgba(34, 197, 94, .14);
}

.status-card.is-paused .status-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 6px rgba(245, 158, 11, .14);
}
.status-time {
  color: var(--muted);
  font-size: 13px;
}

.action-panel,
.section-card,
.settings-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(17, 24, 39, .88);
  box-shadow: var(--shadow);
}

.action-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 22px;
  padding: 18px;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: white;
  font-weight: 750;
  transition: transform .15s ease, filter .15s ease, border-color .15s ease;
}

.btn:hover {
  filter: brightness(1.08);
}

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

.btn-block {
  width: 100%;
}

.btn-xl {
  min-height: 58px;
  font-size: 15px;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #5b21b6);
}

.btn-success {
  background: linear-gradient(135deg, #16a34a, #15803d);
}

.btn-warning {
  background: linear-gradient(135deg, #d97706, #b45309);
}

.btn-info {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.btn-secondary {
  background: linear-gradient(135deg, #0f766e, #115e59);
}

.btn-ghost {
  border-color: var(--line);
  background: #172033;
  color: #dbeafe;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(17, 24, 39, .78);
}

.stat-card span,
.stat-card small,
.stat-card strong {
  display: block;
}
.stat-card span {
  color: var(--muted);
  font-size: 12px;
}

.stat-card strong {
  margin: 8px 0 4px;
  font-size: 26px;
  letter-spacing: -.03em;
}

.stat-card small {
  color: #64748b;
  font-size: 11px;
}

.positive {
  color: #4ade80 !important;
}

.negative {
  color: #f87171 !important;
}

.section-card {
  padding: 22px;
}

.section-head,
.report-toolbar,
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.section-head {
  margin-bottom: 18px;
}

.section-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.month-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #334155;
  border-radius: 10px;
  outline: none;
  background: #0f172a;
  color: #f8fafc;
}
input {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  padding: 11px 12px;
  resize: vertical;
}

select {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #334155;
  border-radius: 10px;
  outline: none;
  background: #0f172a;
  color: #f8fafc;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, .12);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.summary-strip > div {
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.summary-strip > div:last-child {
  border-right: 0;
}

.summary-strip span,
.summary-strip strong {
  display: block;
}

.summary-strip span {
  color: var(--muted);
  font-size: 11px;
}

.summary-strip strong {
  margin-top: 5px;
  font-size: 17px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}
table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid rgba(51, 65, 85, .65);
  text-align: left;
  white-space: nowrap;
}

th {
  background: #172033;
  color: #94a3b8;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

td {
  font-size: 13px;
}

td small {
  display: block;
  margin-top: 3px;
  color: #64748b;
}

tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover {
  background: rgba(148, 163, 184, .04);
}

.note-cell {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-row {
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #cbd5e1;
  font-size: 22px;
}

.icon-button:hover {
  background: rgba(148, 163, 184, .09);
}

.danger-text {
  color: #f87171;
}

.dialog {
  width: min(680px, calc(100% - 24px));
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: transparent;
  color: var(--text);
}

.dialog::backdrop {
  background: rgba(2, 6, 23, .75);
  backdrop-filter: blur(5px);
}

.dialog-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #111827;
  box-shadow: var(--shadow);
}

.dialog-head {
  margin-bottom: 18px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.span-2 {
  grid-column: span 2;
}

label span,
label small {
  display: block;
}

label span {
  margin-bottom: 7px;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 650;
}

label small {
  margin-top: 6px;
  color: #64748b;
  font-size: 11px;
}

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

.auth-wrap {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 210px);
}

.auth-card {
  width: min(440px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(17, 24, 39, .92);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  font-size: 36px;
}

.auth-register {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.auth-card-wide {
  width: min(520px, 100%);
}

.auth-note {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: #64748b;
  font-size: 11px;
}

.settings-page {
  max-width: 1000px;
  margin: 0 auto;
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.settings-card {
  padding: 20px;
  box-shadow: none;
}

.report-toolbar {
  margin-bottom: 18px;
}

.print-sheet {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  color: #0f172a;
}

.print-title,
.report-person,
.signature-row {
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.print-title {
  align-items: end;
  padding-bottom: 18px;
  border-bottom: 2px solid #0f172a;
}

.print-title h1 {
  margin-bottom: 0;
  font-size: 34px;
}

.print-meta span,
.print-meta strong,
.report-person span,
.report-person strong {
  display: block;
}
.print-meta,
.report-person span {
  color: #64748b;
  font-size: 12px;
}

.report-person {
  padding: 18px 0;
}

.report-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 22px;
  border: 1px solid #cbd5e1;
}

.report-kpis > div {
  padding: 12px;
  border-right: 1px solid #cbd5e1;
}

.report-kpis > div:last-child {
  border-right: 0;
}

.report-kpis span,
.report-kpis strong {
  display: block;
}

.report-kpis span {
  color: #64748b;
  font-size: 11px;
}

.report-kpis strong {
  margin-top: 3px;
  font-size: 18px;
}

.report-table th {
  background: #0f172a;
  color: #fff;
  border-color: #cbd5e1;
  font-size: 11px;
}

.report-table td {
  border-color: #cbd5e1;
  color: #0f172a;
  font-size: 11px;
}

.signature-row {
  margin-top: 46px;
}

.signature-row > div {
  width: 44%;
}

.signature-row span {
  color: #64748b;
  font-size: 11px;
}

.signature-line {
  margin-top: 28px;
  border-bottom: 1px solid #0f172a;
}

@media (max-width: 900px) {
  .hero-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid,
  .summary-strip {
    grid-template-columns: 1fr 1fr;
  }

  .nav a {
    display: none;
  }
}

@media (max-width: 620px) {
  .topbar {
    padding: 0 16px;
  }

  .page-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 26px;
  }

  .footer {
    width: min(100% - 20px, 1180px);
    flex-direction: column;
  }

  .action-grid,
  .form-grid,
  .stats-grid,
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .section-head,
  .report-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-actions {
    width: 100%;
  }

  .month-form {
    width: 100%;
  }

  .month-form input {
    flex: 1;
  }
}

@media print {
  :root {
    color-scheme: light;
  }

  body {
    background: #fff !important;
  }

  .topbar,
  .footer,
  .no-print {
    display: none !important;
  }

  .page-shell {
    width: 100%;
    padding: 0;
  }
  .print-sheet {
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .print-sheet,
  .print-sheet * {
    color: #000 !important;
  }

  .report-kpis,
  .report-kpis > div,
  .report-table td,
  .report-table th {
    border-color: #777 !important;
  }

  .report-table th {
    background: #eee !important;
    color: #000 !important;
  }

  @page {
    size: A4 portrait;
    margin: 12mm;
  }
}

.admin-link {
  color: #c4b5fd !important;
  font-weight: 700;
}

.admin-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 24px;
  margin-bottom: 22px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(17, 24, 39, .84);
}

.admin-stats > div {
  min-width: 95px;
  padding: 16px;
  border-right: 1px solid var(--line);
  text-align: center;
}

.admin-stats > div:last-child {
  border-right: 0;
}

.admin-stats span,
.admin-stats strong {
  display: block;
}

.admin-stats span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.admin-stats strong {
  margin-top: 4px;
  font-size: 22px;
}

.admin-create-card {
  margin-bottom: 22px;
}

.admin-create-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
}

.admin-create-submit {
  display: flex;
  align-items: end;
}

.admin-user-list {
  display: grid;
  gap: 12px;
}

.admin-user-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(15, 23, 42, .58);
}

.admin-user-card.pending-user {
  border-color: rgba(245, 158, 11, .38);
  background: rgba(120, 53, 15, .08);
}

.admin-user-main {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 14px;
}
.user-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  font-size: 18px;
  font-weight: 850;
}

.user-identity {
  min-width: 0;
}

.user-name-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.user-name-line > strong {
  font-size: 16px;
}

.user-handle {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
}

.badge-admin {
  background: rgba(124, 58, 237, .17);
  color: #c4b5fd;
}

.badge-active {
  background: rgba(34, 197, 94, .14);
  color: #86efac;
}
.badge-pending {
  background: rgba(245, 158, 11, .15);
  color: #fcd34d;
}

.user-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 10px;
  color: #64748b;
  font-size: 11px;
}

.user-meta strong {
  color: #cbd5e1;
  font-weight: 650;
}

.admin-user-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-user-actions form {
  margin: 0;
}

.password-reset {
  position: relative;
}

.password-reset > summary {
  list-style: none;
}

.password-reset > summary::-webkit-details-marker {
  display: none;
}

.password-reset[open] form {
  position: absolute;
  z-index: 10;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  grid-template-columns: 220px auto;
  gap: 8px;
  width: max-content;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #111827;
  box-shadow: var(--shadow);
}
@media (max-width: 1050px) {
  .admin-create-grid {
    grid-template-columns: 1fr 1fr;
  }

  .admin-create-submit {
    grid-column: span 2;
  }

  .admin-user-card {
    grid-template-columns: 1fr;
  }

  .admin-user-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .admin-hero {
    grid-template-columns: 1fr;
  }

  .admin-stats {
    grid-template-columns: 1fr 1fr;
  }

  .admin-stats > div:nth-child(2) {
    border-right: 0;
  }

  .admin-stats > div:nth-child(-n+2) {
    border-bottom: 1px solid var(--line);
  }

  .admin-create-grid {
    grid-template-columns: 1fr;
  }

  .admin-create-submit {
    grid-column: auto;
  }

  .password-reset[open] form {
    position: fixed;
    inset: auto 12px 12px 12px;
    grid-template-columns: 1fr;
    width: auto;
  }
}
