:root {
  color-scheme: light;
  --paper: #faf6f5;
  --surface: #fffdfb;
  --ink: #332c31;
  --muted: #746970;
  --line: #e8dde1;
  --gold: #c69a67;
  --gold-dark: #644951;
  --gold-soft: #f3e5d6;
  --orange: #c97f8b;
  --red: #a64f5c;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Montserrat', 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a {
  color: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 76px;
  padding: 12px max(20px, calc((100% - 1120px) / 2));
  background: var(--gold-dark);
  color: #fffefa;
}

.brand {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  color: var(--gold-soft);
  line-height: 1;
  text-decoration: none;
}

.brand-kicker {
  margin-bottom: 5px;
  font-family: 'Montserrat', 'Segoe UI', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.brand-kicker::after {
  display: block;
  width: 28px;
  height: 1px;
  margin-top: 5px;
  background: currentColor;
  content: "";
  opacity: 0.65;
}

.brand-name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 29px;
  font-weight: 700;
}

.brand-initial {
  position: relative;
  display: inline-block;
  padding-left: 22px;
}

.brand-ring {
  position: absolute;
  top: -1px;
  left: 0;
  width: 26px;
  height: 37px;
  overflow: visible;
  pointer-events: none;
  transform: rotate(-14deg);
  transform-origin: 50% 0;
}

.navigation {
  display: flex;
  align-items: center;
  gap: 8px;
}

.navigation a {
  padding: 9px 12px;
  border-radius: 6px;
  color: #eee8d8;
  font-size: 14px;
  text-decoration: none;
}

.navigation button {
  min-height: 38px;
  padding: 8px 12px;
  background: transparent;
  color: #eee8d8;
  font-size: 14px;
  font-weight: 400;
}

.navigation a:hover,
.navigation a[aria-current="page"],
.navigation button:hover,
.navigation button.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.navigation .logout,
.navigation button.logout {
  color: var(--gold-soft);
}

.container {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 38px 0 56px;
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--gold-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  color: var(--ink);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 600;
}

h1 {
  font-size: 38px;
  line-height: 1.1;
}

h2 {
  font-size: 25px;
}

.section-heading {
  margin-bottom: 16px;
}

.panel {
  margin-bottom: 24px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 12px;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.form-grid.orders-form {
  grid-template-columns: 1.5fr 0.7fr 1fr auto;
}

.form-grid.sale-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid.expense-form {
  grid-template-columns: 1.5fr 0.8fr 0.8fr auto;
}

.form-grid.shopping-form {
  grid-template-columns: 1fr 1fr auto;
}

.form-grid.debtor-form {
  grid-template-columns: 1fr 1.4fr 0.8fr 1fr auto;
}

.debtor-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.period-field {
  width: min(220px, 100%);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.summary-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.summary-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.summary-card strong {
  overflow-wrap: anywhere;
  font-size: 20px;
}

.summary-card.highlight {
  border-color: #e6cdd3;
  background: #fbf2f4;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

input:focus,
select:focus {
  outline: 3px solid rgba(184, 134, 11, 0.2);
  border-color: var(--gold);
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 15px;
  border: 0;
  border-radius: 9px;
  background: var(--gold);
  color: #211b0d;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button:hover {
  background: var(--gold-dark);
  color: #fffefa;
}

.button.secondary,
button.secondary {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.button.danger,
button.danger {
  border: 1px solid #e7c7c3;
  background: #fff8f6;
  color: var(--red);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.actions form {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.status {
  display: inline-block;
  padding: 4px 9px;
  border-radius: 99px;
  background: var(--gold-soft);
  color: var(--gold-dark);
  font-size: 12px;
  font-weight: 700;
}

.shopping-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.shopping-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.shopping-item label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.shopping-item input {
  width: 18px;
  min-height: 18px;
  margin-top: 3px;
  accent-color: var(--gold);
}

.shopping-item label span {
  display: grid;
  gap: 2px;
}

.shopping-item small {
  color: var(--muted);
}

.shopping-item.done strong {
  color: var(--muted);
  text-decoration: line-through;
}

.empty-state {
  margin: 8px 0 0;
  color: var(--muted);
}

.flash {
  width: min(1120px, calc(100% - 40px));
  margin: 18px auto 0;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.flash.ok {
  border-color: #ddc887;
  color: var(--gold-dark);
}

.flash.erro {
  border-color: #e7c7c3;
  color: var(--red);
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 40px 24px;
  background: var(--gold-dark);
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(320px, 420px);
  align-items: center;
  gap: clamp(24px, 6vw, 76px);
  width: min(940px, 100%);
}

.login-art {
  display: grid;
  justify-items: center;
  color: var(--gold-soft);
  text-align: center;
}

.jewel-illustration {
  width: min(280px, 100%);
  overflow: visible;
}

.jewel-halo {
  fill: rgba(242, 226, 182, 0.06);
  stroke: rgba(242, 226, 182, 0.18);
  stroke-width: 1.5;
}

.jewel-band-shadow {
  fill: none;
  stroke: #8d5b39;
  stroke-linecap: round;
  stroke-width: 17;
}

.jewel-band {
  fill: none;
  stroke: #d7ae69;
  stroke-linecap: round;
  stroke-width: 11;
}

.jewel-band-light {
  fill: none;
  stroke: #fae7bd;
  stroke-linecap: round;
  stroke-width: 2;
}

.jewel-setting {
  fill: #d7ae69;
  stroke: #fae7bd;
  stroke-linejoin: round;
  stroke-width: 2;
}

.jewel-stone {
  fill: #d98caa;
  stroke: #ffe4ed;
  stroke-linejoin: round;
  stroke-width: 2;
}

.jewel-stone-shine {
  fill: #f5bfd0;
  opacity: 0.9;
}

.jewel-sparkle {
  fill: none;
  stroke: #fae7bd;
  stroke-linecap: round;
  stroke-width: 2;
}

.login-art-caption {
  margin: -5px 0 0;
  color: #ead9ae;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 23px;
  line-height: 1.2;
}

.login-box {
  width: min(420px, 100%);
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  background: var(--surface);
}

.login-box .brand {
  margin-bottom: 22px;
  color: var(--gold-dark);
}

.login-box .brand-kicker {
  font-size: 11px;
}

.login-box .brand-name {
  font-size: 36px;
}

.demo-notice {
  margin: 14px 0;
  padding: 10px 12px;
  border: 1px solid #e6cdd3;
  border-radius: 9px;
  background: #fbf2f4;
  color: var(--gold-dark);
  font-size: 13px;
}

.login-box .field {
  margin: 16px 0;
}

.login-message {
  margin: 14px 0;
  color: var(--red);
  font-size: 14px;
}

.login-box button {
  width: 100%;
  margin-top: 8px;
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    padding: 12px 20px;
  }

  .navigation {
    width: 100%;
    flex-wrap: wrap;
  }

  .navigation a {
    padding: 8px 10px;
  }

  .navigation button {
    padding: 8px 10px;
  }

  .login-layout {
    grid-template-columns: 1fr;
    gap: 12px;
    max-width: 420px;
  }

  .login-art {
    grid-template-columns: 100px 1fr;
    justify-items: start;
    gap: 12px;
    text-align: left;
  }

  .jewel-illustration {
    width: 100px;
  }

  .login-art-caption {
    margin: 0;
    font-size: 20px;
  }

  .container {
    width: min(100% - 28px, 1120px);
    padding-top: 27px;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-grid,
  .form-grid.orders-form,
  .form-grid.sale-form,
  .form-grid.expense-form,
  .form-grid.shopping-form,
  .form-grid.debtor-form {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-card:last-child {
    grid-column: 1 / -1;
  }

  .panel {
    padding: 17px;
  }

  th,
  td {
    padding: 11px 9px;
  }
}

