@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: optional;
  src: url("../fonts/poppins-600-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700;
  font-display: optional;
  src: url("../fonts/poppins-700-latin.woff2") format("woff2");
}

:root {
  --bg: #020617;
  --panel: rgba(15, 23, 42, .97);
  --panel-soft: #334155;
  --text: #f8fafc;
  --muted: #cbd5e1;
  --accent: #7dd3fc;
  --danger: #fda4af;
  --border: rgba(255, 255, 255, .18);
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: radial-gradient(circle at top, #243b5a, var(--bg) 72%);
  color: var(--text);
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: clamp(14px, 2vw, 24px);
  background: rgba(3, 7, 18, .96);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .28);
}

.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

header h1 {
  margin: 0;
  font-size: clamp(22px, 4vw, 30px);
}

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

.menu-toggle {
  display: none;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

nav a,
.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border);
  cursor: pointer;
  font: inherit;
}

.button,
button {
  font-family: var(--font-display);
  font-weight: 600;
}

nav .inline-form {
  display: contents;
}

nav a:hover,
.button:hover,
button:hover {
  background: var(--accent);
  color: #082f49;
}

main {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 4vw, 34px);
}

h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(28px, 6vw, 46px);
  margin: 8px 0 24px;
}

h3 {
  font-family: var(--font-display);
  font-weight: 600;
  margin-top: 0;
}

header h1,
.login-box h1,
.button,
button,
.badge,
.card p,
.total-row td {
  font-family: var(--font-display);
}

.cards,
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: clamp(14px, 2vw, 20px);
}

.card,
form,
table {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: clamp(18px, 3vw, 26px);
  box-shadow: 0 24px 80px rgba(0,0,0,.25);
}

.card {
  padding: clamp(18px, 3vw, 24px);
  overflow: hidden;
}

.card p {
  font-size: clamp(18px, 4vw, 30px);
  font-weight: 800;
  margin: 10px 0 0;
  word-break: break-word;
}

form {
  padding: clamp(18px, 3vw, 24px);
  margin-bottom: 24px;
}

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

input,
select,
textarea {
  width: 100%;
  max-width: 100%;
  padding: 13px 15px;
  margin: 8px 0 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #07101f;
  color: var(--text);
  outline: none;
  font: inherit;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(125, 211, 252, .3);
}

input::placeholder,
textarea::placeholder {
  color: #aebed2;
  opacity: 1;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}

.summary-section {
  margin: 28px 0;
}

.summary-section h3,
.listing-title {
  margin-bottom: 14px;
}

.summary-table {
  max-width: 760px;
}

.summary-table td:nth-child(2),
.summary-table th:nth-child(2) {
  text-align: center;
}

.summary-table td:last-child,
.summary-table th:last-child {
  text-align: right;
}

.listing-title {
  margin-top: 32px;
}

.listing-kpis {
  margin: 28px 0 0;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  border-radius: clamp(18px, 3vw, 26px);
}

.listing-table {
  min-width: 960px;
  font-size: 14px;
}

.listing-table th,
.listing-table td {
  padding: 14px 12px;
  vertical-align: top;
}

.listing-table small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  white-space: nowrap;
}

.cell-notes {
  min-width: 190px;
  max-width: 280px;
  white-space: normal;
}

.amount-negative {
  color: var(--danger);
  font-weight: 700;
}

th,
td {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

th {
  color: var(--muted);
  font-weight: 600;
}

td a {
  color: var(--accent);
}

tr:last-child td {
  border-bottom: 0;
}

.total-row td {
  font-weight: 800;
  color: #f0f9ff;
  background: rgba(14, 116, 144, .24);
  border-top: 2px solid rgba(125, 211, 252, .55);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 22px 0;
}

.actions a {
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border);
}

.inline-form {
  display: inline;
  padding: 0;
  margin: 0;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.actions .inline-form button {
  min-height: auto;
  padding: 10px 14px;
}

.danger-button {
  color: #fff1f2;
  background: #881337;
  border-color: #fb7185;
}

.danger-button:hover {
  color: white;
  background: #be123c;
}

.actions a:hover {
  background: var(--accent);
  color: #020617;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 12px;
  align-items: end;
}

.filters select,
.filters button,
.filters .button {
  width: 100%;
  margin: 0;
}

.dashboard-grid {
  margin-top: 24px;
}

.chart-card {
  min-height: clamp(300px, 45vw, 420px);
}

.chart-card canvas {
  width: 100% !important;
  max-height: 320px;
}

.badge {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.badge-orange { background: #7c2d12; color: #ffedd5; }
.badge-blue { background: #075985; color: #e0f2fe; }
.badge-green { background: #14532d; color: #dcfce7; }
.badge-red { background: #7f1d1d; color: #fee2e2; }
.badge-gray { background: #334155; color: #f8fafc; }
.badge-yellow { background: #ffc107; color: #343a40; }
.badge-purple { background: #581c87; color: #f3e8ff; }
.badge-dark-green { background: #14532d; color: #dcfce7; }

footer {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 20px;
}

.login-box {
  width: min(380px, 100%);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 18px;
  color: var(--text);
  cursor: pointer;
}

.checkbox-row input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--accent);
  flex: 0 0 auto;
}

.checkbox-row span {
  line-height: 1.35;
}

.error {
  color: var(--danger);
}

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

  header {
    position: sticky;
    padding: 12px 14px;
    background: #070d1a;
  }

  .header-bar {
    margin-bottom: 0;
  }

  .menu-toggle {
    display: inline-flex;
    width: auto;
    min-width: 92px;
    min-height: 44px;
    padding: 8px 16px;
  }

  .main-nav {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }

  .main-nav.is-open {
    display: grid;
  }

  nav a,
  .button,
  button {
    width: 100%;
    min-height: 44px;
    font-size: 14px;
  }

  .menu-toggle {
    width: auto;
  }

  main {
    padding: 18px 10px 42px;
  }

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

  table {
    display: block;
    width: 100%;
    background: transparent;
    box-shadow: none;
    border: 0;
    overflow: visible;
  }

  .table-scroll {
    overflow: visible;
  }

  .listing-table,
  .summary-table {
    min-width: 0;
    max-width: none;
  }

  .summary-table td:nth-child(2),
  .summary-table th:nth-child(2),
  .summary-table td:last-child,
  .summary-table th:last-child {
    text-align: left;
  }

  tbody,
  tfoot,
  tr,
  td {
    display: block;
    width: 100%;
  }

  thead,
  th {
    display: none;
  }

  tr {
    background: #0f172a;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 12px 14px;
    margin-bottom: 12px;
    box-shadow: 0 18px 50px rgba(0,0,0,.22);
  }

  td {
    display: grid;
    grid-template-columns: minmax(100px, .75fr) minmax(0, 1.25fr);
    align-items: start;
    gap: 12px;
    padding: 9px 0;
    border: 0;
    font-size: 15px;
    overflow-wrap: anywhere;
  }

  td::before {
    content: attr(data-label);
    color: #dbeafe;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin: 2px 0 0;
  }

  td:empty {
    display: none;
  }

  .total-row td {
    background: transparent;
    border-top: 0;
  }

  .total-row td:first-child {
    padding-top: 4px;
    color: var(--accent);
  }

  td[data-label="Actions"] {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 10px;
  }

  td[data-label="Actions"]::before {
    margin-bottom: 2px;
  }

  td[data-label="Actions"] a {
    display: flex;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 999px;
    background: var(--panel-soft);
    color: var(--text);
    text-decoration: none;
    border: 1px solid var(--border);
  }

  td[data-label="Actions"] .inline-form,
  td[data-label="Actions"] .inline-form button {
    display: flex;
    width: 100%;
  }

  .actions {
    margin: 8px 0;
  }

  .listing-title {
    margin-top: 26px;
  }

  .summary-section {
    margin-top: 30px;
  }

  .summary-table td,
  .listing-table td {
    white-space: normal;
  }

  .listing-table small {
    grid-column: 2;
    margin-top: -8px;
    white-space: normal;
  }

  .cell-notes {
    min-width: 0;
    max-width: none;
  }

  .card {
    border-radius: 18px;
  }

  .card p {
    font-size: 24px;
  }

  .filters {
    padding: 14px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .main-nav {
    grid-template-columns: 1fr;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .actions a,
  .button,
  button {
    width: 100%;
  }
}

.upload-container{
    margin-top:8px;
}

.selected-file{

    margin-top:12px;

    display:flex;
    align-items:center;
    justify-content:space-between;

    padding:10px 14px;

    background:var(--panel-soft);

    border-radius:14px;
}

.selected-file span{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.remove-file {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;

    padding: 0;
    margin: 0;

    border: none;
    border-radius: 50%;

    background: var(--danger);
    color: white;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;
    aspect-ratio: 1 / 1;
}

.remove-file:hover{
    filter:brightness(1.1);
    background: var(--danger);
}
