:root {
  --nova: #071018;
  --nova-soft: #0d1921;
  --gold: #c99a42;
  --gold-bright: #efc66f;
  --gold-pale: #f4ead6;
  --paper: #f4f1ea;
  --surface: #fffefa;
  --ink: #17201d;
  --muted: #707a75;
  --line: #e6e0d5;
  --success: #668b74;
  --shadow: 0 18px 55px rgba(19, 27, 24, .07);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Aptos", "Trebuchet MS", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  padding: 28px 22px 24px;
  background:
    radial-gradient(320px 260px at -15% 10%, rgba(201,154,66,.16), transparent 70%),
    var(--nova);
  color: #fff;
}
.nova-brand { display: flex; align-items: center; gap: 12px; }
.nova-mark {
  width: 55px; height: 55px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1px solid rgba(239,198,111,.55); border-radius: 15px;
  background: linear-gradient(145deg, rgba(201,154,66,.25), rgba(201,154,66,.04));
  box-shadow: inset 0 0 30px rgba(201,154,66,.08), 0 0 32px rgba(201,154,66,.08);
  color: var(--gold-bright);
}
.nova-mark b { font-size: 25px; line-height: .85; font-weight: 950; letter-spacing: -.09em; }
.nova-mark small { margin-top: 6px; font-size: 6px; font-weight: 850; letter-spacing: .15em; }
.nova-copy strong, .nova-copy small { display: block; }
.nova-copy strong { font-size: 16px; letter-spacing: .22em; }
.nova-copy small { margin-top: 4px; color: #7f8d94; font-size: 7px; letter-spacing: .17em; }

.sidebar nav { display: grid; gap: 7px; margin-top: 54px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 13px;
  min-height: 46px; padding: 0 13px;
  border: 1px solid transparent; border-radius: 12px;
  color: #849199; text-decoration: none; font-size: 12px; font-weight: 700;
  transition: .2s ease;
}
.sidebar nav a span { color: #52616a; font-size: 8px; letter-spacing: .08em; }
.sidebar nav a:hover, .sidebar nav a.active {
  border-color: rgba(239,198,111,.18);
  background: rgba(201,154,66,.09);
  color: #f5e4c3;
}
.sidebar nav a.active span { color: var(--gold-bright); }
.property-card {
  margin-top: auto; overflow: hidden; padding: 18px;
  border: 1px solid rgba(255,255,255,.09); border-radius: 17px;
  background: linear-gradient(145deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
}
.property-card img { display: block; width: 110px; height: 54px; object-fit: contain; object-position: left center; }
.property-card p { margin: 13px 0 0; color: #839098; font-size: 9px; line-height: 1.55; }
.system-state { display: flex; align-items: center; gap: 8px; margin-top: 18px; color: #718087; font-size: 8px; letter-spacing: .1em; text-transform: uppercase; }
.system-state i, .status-dot { width: 7px; height: 7px; border-radius: 50%; background: #78b68f; box-shadow: 0 0 12px rgba(120,182,143,.65); }

.workspace { grid-column: 2; min-width: 0; padding: 0 34px 40px; }
.topbar {
  height: 88px; max-width: 1420px; margin: auto;
  display: flex; align-items: center; justify-content: space-between; gap: 22px;
}
.topbar p { margin: 0 0 5px; color: var(--gold); font-size: 8px; font-weight: 900; letter-spacing: .18em; }
.topbar h1 { margin: 0; font-family: Georgia, serif; font-size: 24px; font-weight: 500; letter-spacing: -.03em; }
.topbar-meta { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 10px; }
.topbar-meta b { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 11px; background: var(--nova); color: var(--gold-bright); font-size: 10px; }

.hero {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 315px; max-width: 1420px; margin: 0 auto 20px; padding: 48px 52px;
  display: flex; align-items: center; justify-content: space-between; gap: 30px;
  border-radius: 27px;
  background: var(--nova) url('/static/cadoro-portada.jpg') center 47% / cover no-repeat;
  color: #fff; box-shadow: 0 22px 70px rgba(7,16,24,.18);
}
.hero::before { content: ""; position: absolute; z-index: -1; inset: 0; background: linear-gradient(90deg, rgba(7,16,24,.98) 0%, rgba(7,16,24,.88) 43%, rgba(7,16,24,.25) 78%, rgba(7,16,24,.32)); }
.hero::after { content: ""; position: absolute; z-index: -1; width: 430px; height: 430px; left: -120px; top: -250px; border: 1px solid rgba(239,198,111,.18); border-radius: 50%; box-shadow: 0 0 0 70px rgba(239,198,111,.025); }
.hero-copy { max-width: 640px; }
.eyebrow { display: inline-flex; padding: 7px 10px; border: 1px solid rgba(239,198,111,.35); border-radius: 999px; color: var(--gold-bright); font-size: 8px; font-weight: 900; letter-spacing: .16em; }
.hero h2 { margin: 19px 0 15px; font-family: Georgia, serif; font-size: clamp(38px, 4.2vw, 62px); font-weight: 400; line-height: .98; letter-spacing: -.045em; }
.hero h2 em { color: var(--gold-bright); font-style: normal; }
.hero p { max-width: 530px; margin: 0; color: #aeb9bd; font-size: 14px; line-height: 1.6; }
.hero-logo { width: min(27vw, 250px); height: 150px; object-fit: contain; filter: drop-shadow(0 12px 30px rgba(0,0,0,.25)); }

.overview-grid { max-width: 1420px; margin: auto; display: grid; grid-template-columns: 1.45fr .75fr; gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.totals-card, .import-card, .detail-card, .imports-card { padding: 25px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.section-title span { display: block; margin-bottom: 6px; color: var(--gold); font-size: 7px; font-weight: 900; letter-spacing: .18em; }
.section-title h3 { margin: 0; font-family: Georgia, serif; font-size: 21px; font-weight: 500; letter-spacing: -.02em; }
.totals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.totals p { min-height: 90px; margin: 0; padding: 16px; display: flex; flex-direction: column; justify-content: flex-end; border: 1px solid var(--line); border-radius: 14px; background: #f8f5ef; color: var(--muted); font-size: 8px; }
.totals p strong { order: 2; display: block; margin-top: 8px; color: var(--ink); font-family: Georgia, serif; font-size: clamp(17px, 1.7vw, 25px); font-weight: 500; }
.totals p:nth-child(3) { background: var(--nova); border-color: var(--nova); color: #88959a; }
.totals p:nth-child(3) strong { color: var(--gold-bright); }
.totals .loading { grid-column: 1/-1; }

.import-card { background: linear-gradient(145deg, #fffefa, #faf5eb); }
.import-card > p { margin: -6px 0 16px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.import-card form { display: grid; gap: 8px; }
.file-field { min-height: 42px; padding: 0 12px; display: flex; align-items: center; border: 1px dashed #d7c6a8; border-radius: 10px; background: #fff; color: #887f70; font-size: 9px; cursor: pointer; }
.file-field input { width: 1px; height: 1px; position: absolute; opacity: 0; }
.import-card button { height: 42px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; border: 0; border-radius: 10px; background: var(--gold); color: #fff; font-size: 9px; font-weight: 850; }
.import-card button:hover { background: #b98934; }
.muted { color: var(--muted); font-size: 9px; }
pre { display: none; }

.clients-card, .detail-card, .imports-card { max-width: 1420px; margin: 20px auto 0; }
.clients-card { overflow: hidden; }
.clients-heading { padding: 25px 25px 18px; margin: 0; }
.search-field { width: min(300px, 45%); height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: #faf8f3; }
.search-field span { margin: 0; color: var(--gold); font-size: 16px; }
.search-field input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 10px; }
.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 18px; background: #f2efe8; color: #858b87; text-align: left; text-transform: uppercase; font-size: 7px; letter-spacing: .11em; white-space: nowrap; }
td { padding: 15px 18px; border-top: 1px solid #efebe3; color: #56605b; font-size: 10px; white-space: nowrap; }
td:first-child { color: var(--ink); font-weight: 800; }
td:nth-child(4) { color: var(--ink); font-weight: 850; }
td button.open { width: auto; margin: 0; padding: 7px 11px; border: 1px solid #d9c6a3; border-radius: 8px; background: transparent; color: #9b722e; font-size: 8px; font-weight: 800; }
td button.open:hover { background: var(--gold-pale); }

.empty-state { padding: 25px; border: 1px dashed #dcd4c6; border-radius: 13px; background: #faf8f3; color: #8a918d; text-align: center; font-size: 10px; }
#clientData h3 { margin: 8px 0; font-family: Georgia, serif; font-size: 28px; font-weight: 500; }
#clientData > p { padding: 13px 15px; border-radius: 11px; background: var(--nova); color: #d5dad8; font-size: 10px; }
#clientData > p strong { color: var(--gold-bright); }
#clientData h4 { margin: 24px 0 10px; color: var(--gold); font-size: 8px; letter-spacing: .14em; text-transform: uppercase; }
#clientData input { height: 40px; margin: 5px 5px 5px 0; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: #fbfaf6; outline: 0; font-size: 10px; }
#clientData input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,154,66,.1); }
#savePayment { height: 40px; padding: 0 16px; border: 0; border-radius: 9px; background: var(--gold); color: #fff; font-size: 9px; font-weight: 800; }
.imports-card ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.imports-card li { padding: 12px 14px; border-radius: 10px; background: #f7f4ee; color: #68716d; font-size: 9px; }
footer { max-width: 1420px; margin: 30px auto 0; display: flex; justify-content: space-between; color: #8c938f; font-size: 8px; letter-spacing: .08em; text-transform: uppercase; }
footer span { color: #9d7837; font-weight: 850; }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 84px minmax(0,1fr); }
  .sidebar { width: 84px; padding-inline: 14px; align-items: center; }
  .nova-copy, .sidebar nav a:not(.active) { display: none; }
  .sidebar nav a.active { width: 55px; justify-content: center; padding: 0; font-size: 0; }
  .sidebar nav a.active span { font-size: 8px; }
  .property-card { display: none; }
  .system-state span { display: none; }
  .workspace { grid-column: 2; padding-inline: 22px; }
  .overview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: 74px; padding: 10px 15px; flex-direction: row; justify-content: space-between; }
  .nova-mark { width: 49px; height: 49px; }
  .nova-copy { display: block; }
  .sidebar nav { display: none; }
  .system-state { margin: 0; }
  .system-state span { display: block; }
  .workspace { padding: 0 13px 30px; }
  .topbar { height: 76px; }
  .topbar-meta span { display: none; }
  .hero { min-height: 330px; padding: 34px 25px; align-items: flex-end; }
  .hero::before { background: linear-gradient(0deg, rgba(7,16,24,.98), rgba(7,16,24,.25) 100%); }
  .hero h2 { font-size: 38px; }
  .hero-logo { display: none; }
  .totals { grid-template-columns: 1fr 1fr; }
  .totals p strong { font-size: 19px; }
  .clients-heading { align-items: flex-start; flex-direction: column; }
  .search-field { width: 100%; }
  .detail-card, .imports-card, .totals-card, .import-card { padding: 19px; }
  footer { padding-inline: 5px; }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-copy { animation: reveal .55s ease both; }
  .overview-grid .card { animation: reveal .55s .12s ease both; }
  @keyframes reveal { from { opacity: 0; transform: translateY(12px); } }
}
