:root {
  --ink: #12161d;
  --ink-2: #1a2029;
  --paper: #efe9dd;
  --paper-dim: #c9c2b3;
  --brass: #c9a24a;
  --brass-dim: #8f7638;
  --line: rgba(239, 233, 221, 0.14);
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: -apple-system, "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

h1 {
  font-size: 28px;
  margin: 0 0 8px;
}

.sub {
  color: var(--paper-dim);
  margin: 0 0 16px;
}

.limit-note {
  font-size: 14px;
  color: var(--brass);
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: inline-block;
}

.error {
  color: #e0a15c;
  background: rgba(224, 161, 92, 0.1);
  border: 1px solid rgba(224, 161, 92, 0.3);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-top: 10px;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px 22px;
  margin: 20px 0;
}

legend {
  padding: 0 8px;
  font-weight: 600;
  color: var(--brass);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

label {
  display: block;
  margin-bottom: 14px;
  font-size: 13.5px;
  color: var(--paper-dim);
}

label.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--paper);
}

label.checkbox input {
  width: auto;
}

input[type="text"],
input[type="email"],
input[type="date"],
input[type="number"] {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--paper);
  font-size: 14px;
}

.pro-option {
  border-color: var(--brass-dim);
  background: linear-gradient(180deg, rgba(201, 162, 74, 0.06), transparent 60%);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--brass);
  color: var(--ink);
  border: none;
  border-radius: 9px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.wrap-narrow {
  max-width: 420px;
}

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--paper-dim);
  padding: 22px 32px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--ink);
}

.page {
  display: flex;
  align-items: flex-start;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  border-right: 1px solid var(--line);
  min-height: calc(100vh - 70px);
  position: sticky;
  top: 70px;
  display: flex;
  flex-direction: column;
}

.sidebar-section {
  flex: 1;
  padding: 24px 20px;
  overflow-y: auto;
}

.sidebar-section:first-child {
  border-bottom: 1px solid var(--line);
}

.sidebar h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brass);
  margin: 0 0 16px;
}

.invoice-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.invoice-list li {
  margin-bottom: 4px;
}

.invoice-list a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--paper);
  text-decoration: none;
  font-size: 13px;
  word-break: break-word;
}

.invoice-list a:hover {
  background: var(--ink-2);
}

.invoice-list .empty {
  color: var(--paper-dim);
  font-size: 13px;
  padding: 8px 10px;
}

.use-template {
  display: block;
  padding: 2px 10px 8px;
  font-size: 11px;
  color: var(--brass) !important;
  opacity: 0.8;
}

.use-template:hover {
  opacity: 1;
  background: none !important;
}

label.checkbox.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.upgrade-hint {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--paper-dim);
}

.upgrade-hint a {
  color: var(--brass);
  text-decoration: none;
}

.upgrade-hint a:hover {
  text-decoration: underline;
}

.customer-list {
  list-style: none;
  padding: 0;
  margin: 16px 0;
}

.customer-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.customer-list li:last-child {
  border-bottom: none;
}

.customer-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.customer-info strong {
  font-size: 14px;
  color: var(--paper);
}

.customer-info span {
  font-size: 12.5px;
  color: var(--paper-dim);
}

.customer-list .empty {
  color: var(--paper-dim);
  font-size: 13px;
  border-bottom: none;
}

.sidebar-customer-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-customer {
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 2px;
}

.sidebar-customer:hover {
  background: var(--ink-2);
}

.sidebar-customer .customer-info {
  gap: 1px;
}

.sidebar-customer .customer-info strong {
  font-size: 13px;
}

.sidebar-customer .customer-info span {
  font-size: 11.5px;
}

.btn-use-customer {
  display: none;
  width: 100%;
  margin-top: 8px;
  padding: 7px 10px;
  background: var(--brass);
  color: var(--ink);
  border: none;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.sidebar-customer.active .btn-use-customer {
  display: block;
}

.manage-link {
  display: inline-block;
  margin-top: 12px;
  font-size: 12px;
  color: var(--brass);
  text-decoration: none;
}

.manage-link:hover {
  text-decoration: underline;
}

.inline-form {
  display: inline;
}

.add-customer {
  margin-top: 10px;
}

.add-customer summary {
  cursor: pointer;
  color: var(--brass);
  font-size: 13.5px;
  padding: 6px 0;
}

.add-customer form {
  margin-top: 12px;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(201,162,74,0.08), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(111,149,140,0.08), transparent 40%),
    var(--ink);
}

.login-card {
  max-width: 400px;
  width: 100%;
  text-align: center;
  padding: 48px 36px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.login-logo {
  font-family: "Dancing Script", cursive;
  font-weight: 700;
  font-size: 38px;
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
}

.login-logo .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brass);
}

.login-tagline {
  font-size: 14px;
  color: var(--paper-dim);
  line-height: 1.5;
  margin: 0 0 28px;
}

.btn-google-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px;
  background: var(--paper);
  color: var(--ink);
  border-radius: 9px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14.5px;
  transition: filter .15s;
}

.btn-google-login:hover {
  filter: brightness(0.95);
}

.login-switch {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--paper-dim);
}

.login-switch a {
  color: var(--brass);
  text-decoration: none;
  font-weight: 600;
}

.login-switch a:hover {
  text-decoration: underline;
}

.login-features {
  list-style: none;
  padding: 0;
  margin: 28px 0 0;
  text-align: left;
}

.login-features li {
  font-size: 13px;
  color: var(--paper-dim);
  padding: 6px 0 6px 22px;
  position: relative;
}

.login-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--brass);
}

.reg-page {
  background: var(--ink);
  color: var(--paper);
}

.reg-nav {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 28px 0;
}

.reg-hero {
  max-width: 720px;
  margin: 0 auto;
  padding: 60px 28px 20px;
  text-align: center;
}

.reg-hero .eyebrow {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px;
  color: var(--brass);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 18px;
}

.reg-hero h1 {
  font-family: "Fraunces", serif;
  font-weight: 560;
  font-size: clamp(28px, 4.6vw, 44px);
  line-height: 1.15;
  margin: 0 0 20px;
  letter-spacing: -0.01em;
}

.reg-sub {
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--paper-dim);
  max-width: 56ch;
  margin: 0 auto 30px;
}

.reg-sub em {
  color: var(--paper);
  font-style: normal;
  font-weight: 600;
}

.btn-hero {
  max-width: 340px;
  margin: 0 auto;
}

.reg-animation {
  max-width: 700px;
  margin: 10px auto 20px;
  padding: 0 28px;
}

.reg-animation svg {
  width: 100%;
  height: auto;
}

.reg-why {
  max-width: 900px;
  margin: 30px auto 0;
  padding: 50px 28px;
  border-top: 1px solid var(--line);
}

.reg-why h2 {
  font-family: "Fraunces", serif;
  font-weight: 560;
  font-size: 24px;
  text-align: center;
  margin: 0 0 36px;
}

.why-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.why-item {
  padding: 22px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--ink-2);
}

.why-num {
  font-family: "IBM Plex Mono", monospace;
  color: var(--brass);
  font-size: 12px;
  margin-bottom: 10px;
}

.why-item h4 {
  font-size: 14.5px;
  margin: 0 0 8px;
}

.why-item p {
  font-size: 13px;
  color: var(--paper-dim);
  line-height: 1.5;
  margin: 0;
}

.reg-features {
  max-width: 420px;
  margin: 0 auto;
  padding: 40px 28px 70px;
  text-align: center;
}

.login-features.centered {
  text-align: left;
  margin-bottom: 26px;
}

@media (max-width: 700px) {
  .why-grid { grid-template-columns: 1fr; }
}

.legal-footer {
  margin-top: 50px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 20px;
  font-size: 12.5px;
}

.legal-footer a {
  color: var(--paper-dim);
  text-decoration: none;
}

.legal-footer a:hover {
  color: var(--brass);
}

.legal-page {
  padding-top: 20px;
  padding-bottom: 60px;
  max-width: 720px;
}

.legal-page h1 {
  font-family: "Fraunces", serif;
  font-size: 32px;
  margin: 30px 0 6px;
}

.legal-page h2 {
  font-size: 17px;
  margin: 32px 0 10px;
  color: var(--brass);
}

.legal-page p {
  font-size: 14px;
  line-height: 1.65;
  color: var(--paper-dim);
}

.legal-page a {
  color: var(--brass);
}

.legal-note {
  margin-top: 40px;
  padding: 14px 16px;
  border: 1px dashed var(--line-strong, var(--line));
  border-radius: 10px;
  font-size: 12.5px;
}

.field-hint {
  font-weight: 400;
  font-size: 11.5px;
  color: var(--paper-dim);
  opacity: 0.75;
}

select {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--paper);
  font-size: 14px;
}

input[type="text"]:read-only,
input[type="email"]:read-only {
  opacity: 0.6;
  cursor: not-allowed;
}

.item-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 10px;
  margin-bottom: 10px;
  align-items: center;
}

.btn-remove-row {
  background: var(--ink-2);
  border: 1px solid var(--line);
  color: var(--paper-dim);
  border-radius: 7px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 13px;
}

.btn-remove-row:hover {
  border-color: var(--brass-dim);
  color: var(--paper);
}

.btn-add-row {
  background: none;
  border: 1px dashed var(--line-strong, var(--line));
  color: var(--brass);
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 13px;
  margin-top: 4px;
}

.btn-add-row:hover {
  border-color: var(--brass);
}

.logo {
  font-family: "Dancing Script", cursive;
  font-weight: 700;
  font-size: 30px;
  color: var(--paper);
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brass);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-email {
  color: var(--paper-dim);
}

.top-nav a {
  color: var(--brass);
  text-decoration: none;
}

.top-nav a:hover {
  text-decoration: underline;
}

.save-company {
  margin-top: 4px;
  font-size: 13px;
}

.btn-google {
  display: block;
  text-align: center;
  text-decoration: none;
  margin-top: 10px;
}

.success-banner {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  background: var(--brass);
  border: none;
  border-radius: var(--radius);
  padding: 14px 18px;
  text-align: center;
}

@media (max-width: 600px) {
  .item-row { grid-template-columns: 1fr; }
  .top-nav { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page { flex-direction: column; }
  .sidebar {
    width: 100%;
    min-height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
}

