:root {
  --bg: #f4f5f2;
  --ink: #19342e;
  --muted: #718079;
  --line: #e1e6df;
  --accent: #216c53;
  --gold: #c4a56b;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Noto Sans TC",
    "Microsoft JhengHei",
    sans-serif;
  font-size: 14px;
}
a {
  color: var(--accent);
  text-decoration: none;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  padding: 10px 15px;
  border-radius: 7px;
}
button:hover {
  background: #edf3ed;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.primary:hover {
  background: #18533f;
}
.danger {
  color: #a44339;
}
.muted,
small {
  color: var(--muted);
}
small {
  font-size: 12px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  font-weight: 600;
  color: var(--muted);
}
h1 {
  font-size: 30px;
  letter-spacing: -0.8px;
  margin: 8px 0 12px;
}
h2 {
  font-size: 19px;
  margin: 0;
}
h3 {
  font-size: 15px;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #f9f6ed;
  font-family: Georgia, serif;
  font-size: 29px;
  width: 42px;
  height: 44px;
  border-radius: 10px;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 244px;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 650;
  margin-bottom: 35px;
}
.brand small {
  display: block;
  font-weight: 400;
  margin-top: 5px;
  font-size: 11px;
}
.sidebar > .eyebrow {
  padding-left: 14px;
}
.sidebar nav button {
  display: block;
  width: 100%;
  text-align: left;
  margin: 6px 0;
  border: 0;
  padding: 13px 15px;
  background: none;
  color: #64716b;
}
.sidebar nav button.active {
  background: #eaf2ec;
  color: var(--accent);
  font-weight: 600;
}
.sidebar nav .eyebrow {
  margin: 32px 14px 15px;
}
.sidebar-foot {
  margin-top: auto;
  padding: 16px 10px 0;
  border-top: 1px solid var(--line);
}
.sidebar-foot small {
  display: block;
  margin: 5px 0 15px;
}
.sidebar-foot button {
  font-size: 12px;
  padding: 7px 9px;
  margin-right: 4px;
}
.workspace {
  margin-left: 244px;
  padding: 0 46px;
}
.topbar {
  height: 76px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1px;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 35px 0 26px;
  gap: 15px;
}
.page-head p {
  color: var(--muted);
  line-height: 1.6;
}
.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}
.card,
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 23px;
}
.card .amount {
  display: block;
  font-size: 27px;
  font-weight: 600;
  margin: 18px 0 10px;
  letter-spacing: -0.7px;
}
.card.feature {
  background: #214c3d;
  color: white;
  border: 0;
}
.card.feature small {
  color: #bfd2c6;
}
.card .mini-label {
  font-size: 11px;
  color: var(--muted);
}
.split {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: 24px;
}
.panel h2 {
  margin-bottom: 20px;
}
.table-wrap {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}
th {
  text-align: left;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  background: #f8f9f6;
}
td,
th {
  padding: 15px 13px;
  border-bottom: 1px solid var(--line);
}
td {
  font-size: 13px;
}
td small {
  display: block;
  margin-top: 6px;
}
table button {
  font-size: 11px;
  padding: 6px 9px;
  margin: 2px;
}
.badge {
  display: inline-block;
  padding: 5px 9px;
  background: #edf1ec;
  color: #65756b;
  font-size: 11px;
  border-radius: 5px;
}
.badge.accepted,
.badge.income {
  background: #e5f2e8;
  color: #26704c;
}
.badge.sent {
  background: #e8eff7;
  color: #487295;
}
.badge.void,
.badge.expense {
  background: #f8eae5;
  color: #a26049;
}
.empty {
  text-align: center;
  padding: 45px;
  color: var(--muted);
  white-space: normal;
}
.toolbar {
  display: flex;
  gap: 12px;
  align-items: end;
  margin: 0 0 20px;
  flex-wrap: wrap;
}
.toolbar label {
  margin: 0;
  max-width: 210px;
}
.toolbar input {
  margin: 4px 0 0;
}
.section-label {
  font-size: 12px;
  margin: 20px 0 12px;
  color: var(--muted);
}
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.catalog-group {
  padding: 22px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.catalog-group h2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.catalog-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.catalog-line small {
  display: block;
  margin-top: 5px;
}
.catalog-line button {
  padding: 5px 8px;
  font-size: 11px;
}
.tag {
  background: #edf2ed;
  border-radius: 4px;
  font-size: 11px;
  padding: 3px 7px;
}
.action-list button {
  display: block;
  width: 100%;
  text-align: left;
  margin: 12px 0;
  padding: 15px;
}
label {
  display: block;
  color: #52675b;
  font-size: 12px;
  margin-bottom: 16px;
}
input,
select,
textarea {
  display: block;
  width: 100%;
  border: 1px solid #d8e0d8;
  border-radius: 6px;
  padding: 11px 12px;
  background: white;
  color: var(--ink);
  margin-top: 7px;
}
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid #b3cfc0;
  outline-offset: 1px;
}
textarea {
  resize: vertical;
  min-height: 85px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}
.full {
  grid-column: 1/-1;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
dialog {
  border: 1px solid var(--line);
  border-radius: 15px;
  max-height: 90vh;
  width: min(1000px, 92vw);
  padding: 0;
  color: var(--ink);
  box-shadow: 0 20px 100px #17382926;
}
dialog::backdrop {
  background: #152c2466;
}
.dialog-head {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
  z-index: 2;
}
#dialog-body {
  padding: 25px 28px;
}
.line-editor {
  border: 1px solid var(--line);
  background: #f8faf6;
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 12px;
}
.line-editor .form-grid {
  grid-template-columns: 2fr 2fr 1fr 1fr 1.3fr;
}
.line-editor label {
  margin-bottom: 8px;
}
.line-editor .description {
  grid-column: 1/-1;
}
.line-editor .remove-line {
  font-size: 11px;
  padding: 5px 8px;
}
.total-preview {
  margin: 20px 0;
  text-align: right;
  font-size: 18px;
  color: var(--accent);
}
#notice {
  position: sticky;
  top: 12px;
  z-index: 10;
  padding: 14px 20px;
  background: #e2eee3;
  color: var(--ink);
  border: 1px solid #c9deca;
  border-radius: 8px;
}
.error {
  color: #a14336;
}
#notice.error {
  background: #ffeded;
  border-color: #edc9c1;
}
footer {
  font-size: 11px;
  color: #91a097;
  padding: 35px 0;
}
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(at 10% 20%, #e0e9df, transparent 70%), #f4f5ef;
}
.login-card {
  width: min(490px, 92vw);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 48px;
  box-shadow: 0 15px 60px #25493609;
}
.login-card .eyebrow {
  margin-top: 30px;
}
.login-card h1 {
  line-height: 1.5;
  font-size: 29px;
}
.login-card form {
  margin-top: 30px;
}
.login-card button {
  width: 100%;
  margin: 10px 0 25px;
}
.login-card > small {
  font-size: 10px;
}
.pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.65;
}
.print-page {
  background: #e9ece7;
}
.print-actions {
  max-width: 1000px;
  margin: 24px auto;
  display: flex;
  gap: 20px;
  align-items: center;
}
.quotation {
  background: white;
  max-width: 1000px;
  margin: 0 auto 30px;
  padding: 50px;
}
.quotation header {
  border-bottom: 3px solid var(--accent);
  padding-bottom: 20px;
  margin-bottom: 28px;
}
.quotation header p {
  font-size: 12px;
  color: var(--muted);
}
.quote-meta {
  display: flex;
  justify-content: space-between;
  margin: 25px 0;
  font-size: 12px;
}
.quotation table {
  white-space: normal;
}
.quotation td {
  vertical-align: top;
}
.quotation td p {
  font-size: 11px;
}
.quote-totals {
  max-width: 360px;
  margin: 25px 0 35px auto;
}
.quote-totals p {
  display: flex;
  justify-content: space-between;
}
.grand {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  font-size: 19px;
}
.signature {
  margin-top: 45px;
  font-size: 12px;
}
.quotation tr {
  break-inside: avoid;
}
@media (max-width: 1100px) {
  .workspace {
    padding: 0 25px;
  }
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .split {
    grid-template-columns: 1fr;
  }
  .sidebar {
    width: 210px;
  }
  .workspace {
    margin-left: 210px;
  }
  .catalog-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 700px) {
  .sidebar {
    position: static;
    width: 100%;
    padding: 16px;
  }
  .brand {
    margin: 0 0 15px;
  }
  .sidebar > .eyebrow,
  .sidebar nav .eyebrow {
    display: none;
  }
  .sidebar nav {
    display: flex;
    overflow: auto;
  }
  .sidebar nav button {
    min-width: max-content;
  }
  .sidebar-foot {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 10px 0;
  }
  .sidebar-foot small {
    margin: 0;
  }
  .workspace {
    margin: 0;
    padding: 0 16px;
  }
  .cards {
    gap: 10px;
  }
  .card {
    padding: 16px;
  }
  .card .amount {
    font-size: 22px;
  }
  .page-head {
    align-items: start;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .line-editor .form-grid {
    grid-template-columns: 1fr 1fr;
  }
  .full {
    grid-column: 1/-1;
  }
  .topbar {
    height: 55px;
  }
  .quotation {
    padding: 20px;
  }
}
@page {
  size: A4;
  margin: 14mm;
}
@media print {
  .print-page {
    background: white;
  }
  .print-actions {
    display: none;
  }
  .quotation {
    padding: 0;
    margin: 0;
    max-width: none;
  }
  .quotation h1 {
    font-size: 24px;
  }
  .quotation th,
  .quotation td {
    padding: 10px 6px;
  }
  .quote-totals,
  .signature {
    break-inside: avoid;
  }
  thead {
    display: table-header-group;
  }
  a {
    color: inherit;
  }
}
.sidebar {
  overflow-y: auto;
}
.brand,
.sidebar-foot {
  flex-shrink: 0;
}
