:root {
  --bg: #0b0b0f;
  --bg-soft: #14141b;
  --card: #171720;
  --card-2: #1f1f2a;
  --text: #f5f1e8;
  --muted: #b6b0a3;
  --primary: #f0b429;
  --primary-dark: #d89b12;
  --accent: #ff6b35;
  --accent-dark: #e65a28;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #22c55e;
  --border: rgba(240, 180, 41, 0.18);
  --sidebar: #0f0f15;
  --glow: rgba(240, 180, 41, 0.18);
}

* {
  box-sizing: border-box;
  min-width: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background:
    radial-gradient(circle at top right, rgba(255, 107, 53, 0.12), transparent 30%),
    radial-gradient(circle at top left, rgba(240, 180, 41, 0.12), transparent 25%),
    linear-gradient(180deg, #0b0b0f 0%, #111118 100%);
  color: var(--text);
}

img,
svg,
canvas,
video {
  max-width: 100%;
  height: auto;
}

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

/* LOGIN */
.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 16px;
  background:
    radial-gradient(circle at 20% 20%, rgba(240, 180, 41, 0.18), transparent 22%),
    radial-gradient(circle at 80% 0%, rgba(255, 107, 53, 0.18), transparent 24%),
    linear-gradient(160deg, #09090d 0%, #12121a 55%, #1a1210 100%);
}

.login-card {
  width: 100%;
  max-width: 460px;
  background: linear-gradient(180deg, rgba(23, 23, 32, 0.96), rgba(18, 18, 26, 0.98));
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 34px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(240, 180, 41, 0.05) inset;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--primary), var(--accent));
}

.login-card h1 {
  margin-top: 0;
  margin-bottom: 8px;
  color: #fff7e6;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.login-hint {
  margin-top: 0;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

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

.sidebar {
  background: linear-gradient(180deg, rgba(11, 11, 15, 0.98), rgba(18, 18, 26, 0.98));
  color: white;
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--border);
}

.brand {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 24px;
  color: #fff7e6;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sidebar nav {
  display: grid;
  gap: 8px;
}

.sidebar nav a {
  padding: 12px 14px;
  border-radius: 12px;
  color: #f0e6d2;
  border: 1px solid transparent;
  transition: 0.2s ease;
}

.sidebar nav a:hover {
  background: rgba(240, 180, 41, 0.08);
  border-color: rgba(240, 180, 41, 0.14);
  color: #fff8ea;
}

.content {
  padding: 20px;
  width: 100%;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.topbar h1 {
  margin: 0;
  color: #fff7e6;
}

/* GRID / CARDS */
.grid {
  display: grid;
  gap: 16px;
}

.cards {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.two-col {
  grid-template-columns: 1fr 1.3fr;
}

.card {
  background: linear-gradient(180deg, rgba(23, 23, 32, 0.96), rgba(18, 18, 26, 0.98));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.22),
    0 0 0 1px rgba(240, 180, 41, 0.03) inset;
  margin-bottom: 16px;
  overflow: hidden;
}

.card-header,
.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.metric {
  margin: 6px 0;
  line-height: 1.4;
}

/* DASHBOARD VALUES */
.dashboard-big-value {
  margin-top: 8px;
  font-size: 1.65rem;
  font-weight: 800;
  color: #fff7e6 !important;
  line-height: 1.2;
  display: block;
}

.dashboard-stat-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(240, 180, 41, 0.08);
}

.dashboard-stat-row:last-of-type {
  border-bottom: 0;
}

.dashboard-stat-label {
  color: #f1e6cb !important;
  font-weight: 600;
}

.dashboard-stat-value {
  color: #fff7e6 !important;
  font-weight: 800;
  white-space: nowrap;
  display: inline-block;
}

/* PROGRESS */
.progress {
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  box-shadow: 0 0 18px var(--glow);
}

/* FORMS */
.form-grid {
  display: grid;
  gap: 10px;
}

label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff2d8;
}

input,
select,
textarea {
  width: 100%;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(240, 180, 41, 0.15);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 15px;
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: #9f998d;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(240, 180, 41, 0.45);
  box-shadow: 0 0 0 4px rgba(240, 180, 41, 0.12);
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background:
    linear-gradient(180deg, rgba(23, 23, 32, 0.96), rgba(18, 18, 26, 0.98));
  color: var(--text);
  padding-right: 40px;
  background-image:
    linear-gradient(45deg, transparent 50%, #f0b429 50%),
    linear-gradient(135deg, #f0b429 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

select option {
  background: #171720;
  color: #f5f1e8;
}

select option:checked,
select option:hover {
  background: #2a2a38;
  color: #fff7e6;
}

textarea {
  resize: vertical;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.checkbox input {
  width: auto;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  text-align: center;
  min-height: 38px;
  transition: 0.2s ease;
  font-size: 0.9rem;
}

.btn-primary {
  background: linear-gradient(90deg, var(--accent), var(--primary));
  color: #160f06;
  box-shadow: 0 10px 24px rgba(240, 180, 41, 0.18);
}

.btn-primary:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(240, 180, 41, 0.09);
  color: #ffe9b3;
  border: 1px solid rgba(240, 180, 41, 0.18);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.14);
  color: #ffc3c3;
  border: 1px solid rgba(239, 68, 68, 0.18);
}

.btn-light {
  background: rgba(255, 255, 255, 0.06);
  color: #f8f2e7;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ALERTS */
.alert {
  padding: 10px 12px;
  border-radius: 12px;
  margin: 10px 0;
  border: 1px solid transparent;
}

.alert-success {
  background: rgba(34, 197, 94, 0.12);
  color: #b7f7cb;
  border-color: rgba(34, 197, 94, 0.18);
}

.alert-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #ffc6c6;
  border-color: rgba(239, 68, 68, 0.16);
}

.alert-warning {
  background: rgba(245, 158, 11, 0.12);
  color: #ffe2a5;
  border-color: rgba(245, 158, 11, 0.18);
}

/* BADGE */
.badge {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(240, 180, 41, 0.12);
  color: #ffe4a3;
  border: 1px solid rgba(240, 180, 41, 0.14);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

/* TABLES */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
}

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

th,
td {
  text-align: left;
  padding: 8px 8px;
  border-bottom: 1px solid rgba(240, 180, 41, 0.08);
  vertical-align: top;
  line-height: 1.25;
}

th {
  background: rgba(255, 255, 255, 0.03);
  color: #ffecc0;
  font-size: 0.8rem;
}

/* FILTERS */
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.filters input,
.filters select,
.filters .btn {
  min-width: 150px;
}

.filter-dropdown {
  margin: 10px 0 14px;
  border: 1px solid rgba(240, 180, 41, 0.14);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(23, 23, 32, 0.96), rgba(18, 18, 26, 0.98));
  overflow: hidden;
}

.filter-dropdown-summary {
  list-style: none;
  cursor: pointer;
  padding: 11px 14px;
  font-weight: 800;
  color: #fff7e6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  font-size: 0.95rem;
}

.filter-dropdown-summary::-webkit-details-marker {
  display: none;
}

.filter-dropdown-summary::after {
  content: "?";
  font-size: 1rem;
  color: #f0b429;
  transition: transform 0.2s ease;
}

.filter-dropdown[open] .filter-dropdown-summary::after {
  transform: rotate(180deg);
}

.filter-dropdown-body {
  padding: 0 14px 14px;
  border-top: 1px solid rgba(240, 180, 41, 0.08);
}

.filter-dropdown .filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 12px 0 0;
}

.filter-dropdown .filters label {
  font-size: 0.82rem;
  margin-bottom: 3px;
}

.filter-dropdown .filters input,
.filter-dropdown .filters select {
  padding: 9px 10px;
  font-size: 0.9rem;
}

.filter-dropdown .filters .btn {
  align-self: end;
  min-height: 38px;
}

/* MISC */
.muted {
  color: var(--muted);
}

.footer-vat-note {
  margin-top: 12px;
  margin-bottom: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  color: #160f06;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 10px 24px rgba(240, 180, 41, 0.18);
  font-size: 0.88rem;
}

.amount-inline {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  align-items: baseline;
  line-height: 1.1;
  white-space: nowrap;
}

.amount-note {
  font-size: 0.62em;
  color: var(--muted);
  white-space: nowrap;
}

/* EXPENSES TABLE COMPACT */
.expenses-table {
  table-layout: fixed;
  min-width: 1080px;
  font-size: 0.88rem;
}

.expenses-table th,
.expenses-table td {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.expenses-table th:nth-child(1),
.expenses-table td:nth-child(1) {
  width: 90px;
}

.expenses-table th:nth-child(2),
.expenses-table td:nth-child(2) {
  width: 110px;
}

.expenses-table th:nth-child(3),
.expenses-table td:nth-child(3) {
  width: 145px;
}

.expenses-table th:nth-child(4),
.expenses-table td:nth-child(4) {
  width: 125px;
}

.expenses-table th:nth-child(5),
.expenses-table td:nth-child(5) {
  width: 90px;
}

.expenses-table th:nth-child(6),
.expenses-table td:nth-child(6) {
  width: 95px;
}

.expenses-table th:nth-child(7),
.expenses-table td:nth-child(7),
.expenses-table th:nth-child(8),
.expenses-table td:nth-child(8) {
  width: 100px;
}

.expenses-table th:nth-child(9),
.expenses-table td:nth-child(9) {
  width: 70px;
}

.expenses-table th:nth-child(10),
.expenses-table td:nth-child(10),
.expenses-table th:nth-child(11),
.expenses-table td:nth-child(11),
.expenses-table th:nth-child(12),
.expenses-table td:nth-child(12) {
  width: 100px;
}

.expenses-table th:nth-child(13),
.expenses-table td:nth-child(13) {
  width: 100px;
}

.expenses-table th:nth-child(14),
.expenses-table td:nth-child(14) {
  width: 175px;
}

.expenses-table th:nth-child(15),
.expenses-table td:nth-child(15) {
  width: 115px;
}

.table-wrap .btn {
  padding: 5px 8px;
  min-height: 30px;
  font-size: 0.76rem;
  border-radius: 9px;
}

.expenses-table td .btn.btn-light {
  justify-content: flex-start;
  padding: 4px 7px;
  min-height: 28px;
  font-size: 0.74rem;
}

/* ACTIONS */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.actions form {
  margin: 0;
}

/* RESPONSIVE */
@media (max-width: 1400px) {
  .content {
    padding: 16px;
  }

  .card {
    padding: 14px;
  }

  .expenses-table {
    min-width: 980px;
    font-size: 0.84rem;
  }

  .expenses-table th,
  .expenses-table td {
    padding: 7px 6px;
  }
}

@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

  .sidebar nav {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .content {
    padding: 14px;
  }

  .two-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .login-card {
    padding: 22px;
    border-radius: 16px;
  }

  .content {
    padding: 12px;
  }

  .card {
    padding: 14px;
    border-radius: 16px;
  }

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

  .topbar {
    margin-bottom: 12px;
  }

  .card-header,
  .actions,
  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .actions form {
    width: 100%;
  }

  .actions .btn,
  .actions a,
  .filters .btn,
  .filters input,
  .filters select {
    width: 100%;
    min-width: 0;
  }

  .dashboard-stat-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-stat-value {
    white-space: normal;
  }

  .filter-dropdown .filters {
    grid-template-columns: 1fr;
  }

  .footer-vat-note {
    font-size: 0.82rem;
    padding: 9px 12px;
  }

  .expenses-table {
    min-width: 980px;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 15px;
  }

  .brand {
    font-size: 1.1rem;
    margin-bottom: 16px;
  }

  .login-body {
    padding: 12px;
  }

  .login-card {
    padding: 18px;
  }

  .content {
    padding: 10px;
  }

  .card {
    padding: 12px;
    margin-bottom: 12px;
  }

  h1 {
    font-size: 1.35rem;
  }

  h3 {
    font-size: 1.02rem;
  }

  .btn {
    padding: 11px;
    font-size: 0.9rem;
  }

  input,
  select,
  textarea {
    padding: 11px;
    border-radius: 10px;
  }
}