@charset "UTF-8";

:root {
  color-scheme: light;
  --evergreen: #14362f;
  --text: #1d302b;
  --muted: #52645e;
  --paper: #f6f5ef;
  --white: #fffefa;
  --line: #dedfd6;
  --coral: #a43c30;
  --coral-hover: #8c3227;
  --soft-green: #eaf2eb;
  --focus: #c35c42;
  --radius: .85rem;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
body.signed-in { display: grid; grid-template-columns: 14rem minmax(0, 1fr); }
a { color: var(--evergreen); text-underline-offset: .21em; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, p { margin-top: 0; }
h1, h2 { line-height: 1.25; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.65rem, 3.4vw, 2.4rem); margin-bottom: 0; }
h2 { font-size: 1.18rem; margin-bottom: .55rem; }
p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }
img { max-width: 100%; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 2.2rem;
  padding: 1.6rem 1.1rem;
  color: #f8faf3;
  background: var(--evergreen);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .85rem;
  align-self: flex-start;
  color: inherit;
  text-decoration: none;
  font-size: 1.35rem;
  font-weight: 750;
  line-height: 1.15;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 2.7rem;
  width: 2.7rem;
  height: 2.7rem;
  border-radius: .7rem;
  background: #edb8a5;
  color: #44261c;
}

.brand-subtitle { display: block; margin-top: .3rem; font-size: .75rem; color: var(--muted); font-weight: 500; }
.sidebar .brand-subtitle { color: #c1d1c8; }
.navigation { display: grid; gap: .25rem; }
.navigation a, .logout-button {
  padding: .66rem .85rem;
  border-radius: .45rem;
  text-align: left;
  text-decoration: none;
  color: #e3ece5;
  border: 0;
  background: transparent;
}
.navigation a:hover, .logout-button:hover { background: #295147; }
.navigation [aria-current="page"] { background: #31584e; color: white; font-weight: 700; }
.logout-form { margin-top: auto; }
.logout-button { width: 100%; }

.main-content {
  width: min(100%, 82rem);
  min-width: 0;
  padding: clamp(1.2rem, 4vw, 3rem);
  margin-inline: auto;
}
.signed-out .main-content { display: grid; min-height: 100vh; place-content: center; }
.page-header, .section-header, .form-actions, .search-form, .row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .8rem 1rem;
}
.page-header, .section-header { justify-content: space-between; }
.page-header { margin-bottom: 1.45rem; }
.page-header p { margin-top: .6rem; max-width: 62ch; }
.section-header h2 { margin-bottom: 0; }
.back-link { display: inline-block; margin-bottom: .65rem; }

.panel {
  min-width: 0;
  padding: clamp(1rem, 3vw, 1.6rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 0 3px 12px rgb(34 55 42 / 4%);
}
.login-panel { width: min(25rem, calc(100vw - 2.8rem)); padding: clamp(1.35rem, 5vw, 2.4rem); }
.login-panel .brand { margin-bottom: 1.75rem; }
.login-panel h1 { font-size: 1.65rem; margin-bottom: 1.1rem; }
.login-panel .button { width: 100%; margin-top: .3rem; }

button, .button, .btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 2.65rem;
  max-width: 100%;
  padding: .52rem 1rem;
  border: 1px solid transparent;
  border-radius: .48rem;
  background: var(--coral);
  color: white;
  font-weight: 650;
  line-height: 1.45;
  text-align: center;
  text-decoration: none;
}
button:hover, .button:hover, .btn:hover { background: var(--coral-hover); }
.button-secondary, .button.secondary, .btn.secondary {
  border-color: #aabbb1;
  background: var(--white);
  color: var(--evergreen);
}
.button-secondary:hover, .button.secondary:hover, .btn.secondary:hover { background: var(--soft-green); }
.button-danger, .button.danger, .btn.danger { border-color: var(--coral); background: var(--white); color: var(--coral); }
.button-danger:hover, .button.danger:hover, .btn.danger:hover { background: #f9e9e4; }

.field {
  display: grid;
  min-width: 0;
  gap: .32rem;
  align-content: start;
  font-size: .92rem;
  font-weight: 650;
}
.field + .field { margin-top: .85rem; }
.field-grid > .field + .field { margin-top: 0; }
textarea, select, input:not([type="checkbox"], [type="radio"], [type="hidden"]) {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 2.7rem;
  padding: .55rem .68rem;
  color: var(--text);
  border: 1px solid #aebbb2;
  border-radius: .43rem;
  background: white;
  font-weight: 400;
}
input[type="file"] { max-width: 100%; }
input::file-selector-button {
  padding: .33rem .53rem;
  margin-right: .45rem;
  border: 0;
  border-radius: .25rem;
  background: var(--soft-green);
  color: var(--evergreen);
  font: inherit;
  cursor: pointer;
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--evergreen); }
textarea { resize: vertical; }
.form-actions { margin-top: 1.25rem; }
.field + .button, .field + button { margin-top: .9rem; }
.search-form { justify-content: start; align-items: end; margin-bottom: 1rem; }
.search-form .field { width: min(100%, 28rem); }

.metric-grid, .field-grid, .editor-grid { display: grid; gap: 1rem; }
.metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 1.2rem; }
.field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-wide { grid-column: 1 / -1; }
.editor-grid { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; }
.metric { display: grid; gap: .5rem; text-decoration: none; }
.metric:hover { border-color: #9eb6a9; }
.metric span { color: var(--muted); }
.metric strong { font-size: clamp(1.6rem, 4vw, 2.3rem); font-variant-numeric: tabular-nums; }
.record-list { padding: 0; margin: 1rem 0 0; list-style: none; }
.record-list li { display: flex; flex-wrap: wrap; gap: .25rem 1rem; padding: .65rem 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.table-wrap, .table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: .85rem .65rem; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
th { font-size: .88rem; color: var(--muted); background: var(--soft-green); }
tbody tr:last-child td { border-bottom: 0; }
.cell-detail { display: block; font-size: .88rem; }
.row-actions a { white-space: nowrap; }
td.row-actions { display: table-cell; }
td.row-actions a { display: inline-block; margin-right: .85rem; }
.muted, .eyebrow { color: var(--muted); }
.empty-state { padding: 1.45rem .3rem .55rem; color: var(--muted); }
.empty-state a { margin-left: .4rem; }
.ocr-result { margin-top: 1rem; }
.notice { padding: .65rem .9rem; border-radius: .45rem; overflow-wrap: anywhere; }
.notice.success { color: #1f5539; background: var(--soft-green); }
.notice.error { color: #842c22; background: #fae9e2; }
.badge { display: inline-block; padding: .2rem .55rem; border-radius: 20rem; background: var(--soft-green); color: var(--evergreen); font-size: .82rem; }

@media (max-width: 900px) {
  body.signed-in { grid-template-columns: 11.8rem minmax(0, 1fr); }
  .editor-grid { grid-template-columns: 1fr; }
}

@media (max-width: 670px) {
  body.signed-in { display: block; }
  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .85rem .3rem;
    height: auto;
    padding: .7rem .8rem;
  }
  .sidebar .brand { font-size: 1.05rem; }
  .brand-mark { flex-basis: 2.25rem; width: 2.25rem; height: 2.25rem; }
  .navigation { grid-column: 1 / -1; grid-row: 2; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .navigation a { display: grid; place-items: center; padding: .5rem .15rem; font-size: .88rem; text-align: center; }
  .logout-form { margin: 0; align-self: center; }
  .logout-button { padding: .35rem .55rem; font-size: .85rem; }
  .metric-grid { gap: .45rem; }
  .metric-grid .panel { padding: .65rem; font-size: .85rem; }
  .field-grid { grid-template-columns: 1fr; }
  .customer-list th, .customer-list td { font-size: .88rem; padding-inline: .35rem; }
}

@media (max-width: 350px) {
  .search-form .button { width: 100%; }
}
