:root {
  --brand-navy: #1f2b6c;
  --brand-orange: #f26a2e;
  --brand-gray: #f4f6fb;
  --text-dark: #1a1a1a;
  --text-muted: #6b7280;
  --card: #ffffff;
  --border: #e5e7eb;
  --success: #1f9d55;
  --danger: #c53030;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text-dark);
  background: var(--brand-gray);
}

a {
  color: var(--brand-navy);
  text-decoration: none;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 60%, #fff7ed 100%);
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--card);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.15);
  border: 1px solid var(--border);
}

.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.auth-logo img {
  width: 160px;
  height: auto;
}

.auth-title {
  font-size: 24px;
  margin: 0;
  color: var(--brand-navy);
}

.form-group {
  margin-bottom: 16px;
}

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

.required-asterisk {
  color: var(--danger);
  font-weight: 700;
}

.logo-cropper {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.logo-cropper-frame {
  width: 180px;
  height: 180px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f8fafc;
  overflow: hidden;
  position: relative;
  touch-action: none;
}

.logo-cropper-frame img {
  position: absolute;
  top: 0;
  left: 0;
  user-select: none;
  -webkit-user-drag: none;
  cursor: grab;
}

.logo-cropper-frame.dragging img {
  cursor: grabbing;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 15px;
  background: #fff;
}

textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 15px;
  background: #fff;
  resize: vertical;
}

input[type="file"] {
  width: 100%;
}

.button {
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border-radius: 10px;
  border: none;
  background: var(--brand-navy);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-section {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #f8fafc;
}

.settings-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 12px;
}

.settings-form .form-row {
  gap: 16px;
}

.settings-form input[type="file"] {
  background: #fff;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px dashed var(--border);
}

.settings-form input:focus,
.settings-form select:focus,
.settings-form textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.image-preview {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  min-height: 90px;
}

.image-preview img {
  max-height: 70px;
  max-width: 160px;
}

.image-preview.small {
  min-height: 70px;
}

.image-preview.small img {
  width: 48px;
  height: 48px;
}

.expense-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #0f766e 100%);
  color: #fff;
  border: none;
}

.expense-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 20px;
}

.expense-hero-title {
  font-size: 20px;
  font-weight: 700;
}

.expense-hero-sub {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
}

.expense-metric {
  margin-top: 16px;
  padding: 14px;
  border-radius: 12px;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: inline-block;
}

.expense-metric-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

.expense-metric-value {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 700;
}

.expense-hero-alert {
  color: #f87171;
}

.expense-filters {
  border: 1px solid #fde68a;
  background: #fffbeb;
}

.expense-table {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.expense-button {
  background: #0f766e;
}

@media (max-width: 900px) {
  .expense-top-grid {
    grid-template-columns: 1fr;
  }
}

.button.full {
  width: 100%;
}

.button.secondary {
  background: #fff;
  color: var(--brand-navy);
  border: 1px solid var(--brand-navy);
}

.button.danger {
  background: #fff;
  color: var(--danger);
  border: 1px solid var(--danger);
}

.inline-link {
  display: block;
  margin-top: 12px;
  text-align: center;
  color: var(--brand-orange);
}

.password-toggle {
  position: relative;
}

.password-toggle button {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  color: var(--brand-navy);
  font-weight: 600;
  cursor: pointer;
}

.alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
}

.alert.success {
  background: #ecfdf3;
  color: #166534;
  border-color: #bbf7d0;
}

.admin-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.admin-main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-appbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}

.appbar-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--brand-navy);
}

.profile-menu {
  position: relative;
}

.profile-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.profile-trigger img {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid var(--border);
}

.dropdown {
  position: absolute;
  right: 0;
  margin-top: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.15);
  min-width: 200px;
  padding: 8px;
  display: none;
}

.dropdown a,
.dropdown button {
  width: 100%;
  text-align: left;
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-dark);
  background: none;
  border: none;
  cursor: pointer;
}

.dropdown a:hover,
.dropdown button:hover {
  background: #f1f5f9;
}

.dropdown.show {
  display: block;
}

.menu-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  margin-right: 10px;
  vertical-align: middle;
  color: #e2e8f0;
}

.admin-sidebar {
  background: #0f172a;
  color: #e2e8f0;
  padding: 24px;
}

.admin-sidebar h2 {
  font-size: 18px;
  margin: 0 0 24px 0;
}

.admin-sidebar a {
  display: block;
  color: #e2e8f0;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 8px;
}

.admin-sidebar a.active,
.admin-sidebar a:hover {
  background: rgba(148, 163, 184, 0.2);
}

.admin-content {
  padding: 32px;
}

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

.card {
  background: var(--card);
  border-radius: 14px;
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge.blocked {
  background: #fee2e2;
  color: #991b1b;
}

.badge.active {
  background: #dcfce7;
  color: #166534;
}

.loader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.loader-overlay.show {
  display: flex;
}

.loader-card {
  background: #ffffff;
  padding: 20px 24px;
  border-radius: 14px;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18);
  font-weight: 600;
  color: var(--brand-navy);
}

.loader-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid #e2e8f0;
  border-top-color: var(--brand-navy);
  border-radius: 999px;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.form-row {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: rgba(15, 23, 42, 0.05);
}

/* Site Detail */
.site-detail {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.site-header h1 {
  font-size: 28px;
  letter-spacing: -0.02em;
}

.site-header p {
  font-size: 14px;
}

.site-summary {
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 60%);
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.site-summary-grid > div {
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  padding: 12px 14px;
}

.site-summary-grid > div div:first-child {
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.site-summary-grid > div div:last-child {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
}

.site-section {
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.site-section-header {
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.35);
}

.site-section-title {
  font-size: 18px;
  letter-spacing: -0.01em;
}

.site-alert {
  border-left-width: 6px;
  font-weight: 600;
}

.site-detail .button {
  height: 38px;
  padding: 0 14px;
  font-size: 13px;
}

.site-detail .button.secondary {
  background: #f1f5f9;
  border-color: #cbd5f5;
}

.site-detail .table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
}

.site-detail .table td {
  font-size: 14px;
}

.site-detail .card h3 {
  color: #0f172a;
}

.site-detail .card [data-currency] {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 800px) {
  .site-detail .button {
    width: 100%;
    justify-content: center;
  }

  .site-section-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

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

  .admin-sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
}
