:root {
  --ink: #12131e;
  --muted: #626575;
  --paper: #f7f7f5;
  --card: #ffffff;
  --line: #e7e4dc;
  --coffee: #12131e;
  --coffee-dark: #090a10;
  --rust: #d5ab68;
  --sage: #626575;
  --gold: #d5ab68;
  --shadow: 0 22px 60px rgba(18, 19, 30, .13);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html { font-family: "DM Sans", sans-serif; color: var(--ink); background: var(--paper); }
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.08fr .92fr; }
.login-brand {
  color: #ffffff; background:
    radial-gradient(circle at 16% 90%, rgba(213, 171, 104, .26), transparent 30%),
    radial-gradient(circle at 88% 14%, rgba(255, 255, 255, .1), transparent 28%),
    linear-gradient(135deg, #090a10, #12131e 72%, #1a1c2b);
  display: flex; flex-direction: column; justify-content: center; padding: 9vw;
}
.brand-mark {
  width: 120px; height: 82px; display: grid; place-items: center; margin-bottom: 48px;
  background: url("https://wrenandraven.com/wp-content/uploads/2026/03/wr-logo.svg") center / contain no-repeat;
  color: transparent; overflow: hidden;
}
.brand-mark span { color: transparent; }
.brand-mark.small { width: 48px; height: 38px; margin: 0; flex: 0 0 auto; }
.brand-logo-full { width: min(230px, 58vw); height: auto; margin: -16px 0 38px; }
.login-brand h1 { font: 700 clamp(52px, 6vw, 92px)/.97 "Fraunces", serif; margin: 14px 0 28px; letter-spacing: -.045em; }
.login-copy { max-width: 520px; color: rgba(255,255,255,.72); font-size: 18px; line-height: 1.65; }
.eyebrow { text-transform: uppercase; font-size: 11px; font-weight: 700; letter-spacing: .18em; margin: 0; color: var(--gold); }
.eyebrow.ink { color: var(--gold); }
.login-panel { display: grid; place-items: center; padding: 48px; background: var(--paper); }
.login-card { width: min(420px, 100%); }
.login-card h2, .modal-head h2 { font: 700 38px/1.1 "Fraunces", serif; margin: 12px 0; }
.login-card > p:not(.eyebrow) { color: var(--muted); margin-bottom: 38px; }
label { display: grid; gap: 8px; color: #4e443c; font-size: 13px; font-weight: 600; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 12px 13px; color: var(--ink); outline: none; transition: border .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(213,171,104,.18); }
textarea { min-height: 84px; resize: vertical; }
.login-card label { margin: 18px 0; }
.login-reset-link { margin-top: 10px; justify-self: start; }
.login-reset-panel { display: grid; gap: 12px; margin-top: 18px; }
.button {
  border: 0; border-radius: 10px; padding: 12px 17px; font-weight: 700;
  display: inline-flex; justify-content: center; align-items: center; gap: 8px;
  transition: transform .18s var(--ease-out), box-shadow .18s var(--ease-out), background .18s;
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button.primary { background: var(--gold); color: var(--coffee-dark); box-shadow: 0 7px 20px rgba(213,171,104,.22); }
.button.secondary { background: #efe8dc; color: var(--coffee); }
.button.ghost { background: transparent; color: var(--coffee); border: 1px solid var(--line); }
.button.danger { background: #a43d35; color: white; }
.button.compact { padding: 8px 11px; border-radius: 8px; font-size: 12px; }
.login-card .button { width: 100%; margin-top: 8px; }
.form-error {
  min-height: 20px; color: #a7372d; font-size: 13px; margin: 0;
  position: sticky; bottom: 0; background: var(--card); z-index: 2;
}
.form-error:empty {
  display: none;
}
.success-message {
  color: #537e45; background: #eaf5e4; border: 1px solid #b9d3b0;
  border-radius: 10px; padding: 11px 12px; position: static;
}
.registration-shell {
  min-height: 100vh; display: grid; grid-template-columns: .85fr 1.15fr; gap: 28px;
  background: radial-gradient(circle at 10% 10%, rgba(213,171,104,.22), transparent 28%), var(--ink);
  padding: 38px; color: white;
}
.registration-shell-success { align-items: center; }
.registration-hero { display: flex; flex-direction: column; justify-content: center; padding: 34px; }
.registration-hero h1 { font: 700 clamp(38px, 6vw, 76px)/.95 "Fraunces", serif; margin: 18px 0; letter-spacing: -.04em; }
.registration-hero p:not(.eyebrow) { color: rgba(255,255,255,.76); font-size: 17px; line-height: 1.7; max-width: 560px; }
.registration-card {
  align-self: center; background: var(--card); color: var(--ink); border-radius: 24px;
  padding: 28px; box-shadow: 0 24px 70px rgba(0,0,0,.28);
}
.registration-card-success { display: grid; align-items: center; align-self: center; min-height: 0; }
.registration-card .form-actions { align-items: center; }
.registration-form-submitted {
  animation: none;
  pointer-events: none;
  display: none !important;
}
.registration-success {
  display: grid; justify-items: center; gap: 14px; text-align: center;
  padding: clamp(30px, 5vw, 44px) 28px; align-content: center;
  border-radius: 20px; background:
    radial-gradient(circle at 50% 8%, rgba(213,171,104,.2), transparent 34%),
    linear-gradient(180deg, #ffffff, #fbf7ef);
  border: 1px solid #eadbc5;
}
.registration-success h2 {
  font: 700 clamp(34px, 5vw, 54px)/1 "Fraunces", serif;
  margin: 0; letter-spacing: -.035em;
}
.registration-success p:not(.eyebrow) {
  max-width: 520px; margin: 0; color: var(--muted); line-height: 1.65;
}
.success-orb {
  width: 76px; height: 76px; display: grid; place-items: center; border-radius: 50%;
  background: #eaf5e4; color: #537e45; border: 1px solid #b9d3b0;
  font-size: 34px; font-weight: 900; box-shadow: 0 16px 34px rgba(83,126,69,.16);
}
.success-reveal { animation: success-card-in .48s var(--ease-out) both; }
.success-reveal .success-orb { animation: success-tick .7s var(--ease-out) .1s both; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 248px; color: #f5f5f5; padding: 24px 16px;
  background: linear-gradient(180deg, #12131e, #090a10); display: flex; flex-direction: column; z-index: 10;
}
.sidebar-brand { display: flex; gap: 13px; align-items: center; padding: 0 10px 30px; text-decoration: none; color: white; }
.sidebar-logo-full { width: 42px; height: 56px; object-fit: contain; flex: 0 0 auto; }
.sidebar-brand strong { display: block; font-family: "Fraunces", serif; font-size: 17px; }
.sidebar-brand small, .user-chip small { display: block; color: rgba(255,255,255,.56); font-size: 11px; margin-top: 3px; }
.sidebar nav { display: grid; gap: 11px; overflow: auto; padding-right: 2px; }
.nav-group { display: grid; gap: 4px; }
.nav-group p {
  margin: 8px 10px 2px; color: rgba(213,171,104,.75); font-size: 10px; font-weight: 800;
  letter-spacing: .14em; text-transform: uppercase;
}
.sidebar nav a, .sidebar-foot > a {
  display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,.66); text-decoration: none;
  font-size: 14px; font-weight: 600; border-radius: 9px; padding: 11px 13px;
}
.sidebar nav a span, .sidebar-foot > a span { width: 18px; font-size: 17px; color: rgba(213,171,104,.62); text-align: center; }
.sidebar nav a:hover, .sidebar nav a.active, .sidebar-foot > a:hover { background: rgba(255,255,255,.075); color: white; }
.sidebar nav a.active span { color: var(--gold); }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.09); padding-top: 12px; }
.user-chip {
  border: 0; background: transparent; color: white; display: flex; gap: 10px; align-items: center;
  width: 100%; text-align: left; padding: 14px 10px 0;
}
.user-chip > span:first-child {
  width: 34px; height: 34px; border-radius: 50%; background: var(--gold); color: var(--coffee-dark); display: grid; place-items: center; font-weight: 700;
}
.main { grid-column: 2; min-width: 0; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 24px;
  padding: 35px 44px 24px; border-bottom: 1px solid var(--line); background: rgba(247,247,245,.92);
  position: sticky; top: 0; z-index: 5; backdrop-filter: blur(14px);
}
.topbar h1 { font: 700 32px/1.1 "Fraunces", serif; margin: 7px 0 0; letter-spacing: -.02em; }
.top-actions { display: flex; gap: 10px; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 10px; color: var(--coffee); background: var(--card); font-size: 20px; transition: transform .18s var(--ease-out), background .18s; }
.icon-button:hover { transform: translateY(-1px); background: #f4eee6; }
.page-content { padding: 30px 44px 60px; transform-origin: top center; }
.page-content.page-changing { opacity: .3; transform: translateY(6px); }
.page-content.page-ready { animation: page-rise .32s var(--ease-out) both; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 24px; }
.metric, .panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 3px 14px rgba(18,19,30,.045);
}
.page-ready > .metrics .metric,
.page-ready > .panel,
.page-ready > .dashboard-grid > .panel,
.page-ready > .forecast-list > .forecast-week,
.page-ready > .customer-grid > *,
.page-ready > .product-grid > * {
  animation: card-in .36s var(--ease-out) both;
}
.page-ready > .metrics .metric:nth-child(2),
.page-ready > .dashboard-grid > .panel:nth-child(2),
.page-ready > .forecast-list > .forecast-week:nth-child(2) { animation-delay: .04s; }
.page-ready > .metrics .metric:nth-child(3),
.page-ready > .forecast-list > .forecast-week:nth-child(3) { animation-delay: .08s; }
.page-ready > .metrics .metric:nth-child(4),
.page-ready > .forecast-list > .forecast-week:nth-child(4) { animation-delay: .12s; }
.metric { padding: 20px; min-height: 132px; display: flex; flex-direction: column; justify-content: space-between; }
.metric-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; font-weight: 600; }
.metric-icon { width: 28px; height: 28px; border-radius: 50%; background: #f1e7dc; display: grid; place-items: center; color: var(--rust); }
.metric strong { font: 700 30px/1 "Fraunces", serif; }
.metric small { color: var(--muted); }
.dashboard-grid { display: grid; grid-template-columns: 1.45fr .8fr; gap: 20px; }
.panel { overflow: hidden; }
.panel + .panel, .panel + section, section + .panel { margin-top: 22px; }
.panel-head { padding: 19px 21px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.panel-head h2 { font: 700 18px "Fraunces", serif; margin: 0; }
.panel-head p { color: var(--muted); margin: 3px 0 0; font-size: 12px; }
.panel-body { padding: 20px; }
.text-button { border: 0; background: transparent; color: var(--gold); font-weight: 700; padding: 5px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.table-sort {
  border: 0; background: transparent; color: inherit; padding: 0; text-align: left;
  display: inline-flex; align-items: center; gap: 7px; font: inherit; letter-spacing: inherit;
  text-transform: inherit;
}
.table-sort:hover, .data-table th.sorted-asc .table-sort, .data-table th.sorted-desc .table-sort { color: var(--ink); }
.sort-indicator {
  color: #a18f80; font-size: 9px; letter-spacing: 0; text-transform: none; font-weight: 800;
}
.data-table th.sorted-asc .sort-indicator, .data-table th.sorted-desc .sort-indicator { color: var(--gold); }
.data-table td { padding: 14px 16px; border-bottom: 1px solid #eee8df; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background .16s, transform .16s var(--ease-out); }
.data-table tbody tr:hover { background: #fbf7f1; transform: translateX(2px); }
.table-actions { display: flex; justify-content: flex-end; gap: 8px; }
.clickable-row { cursor: pointer; }
.item-saved-highlight {
  animation: saved-highlight 1.8s var(--ease-out) both;
}
.cell-title { font-weight: 700; color: var(--ink); }
.cell-sub { color: var(--muted); font-size: 11px; margin-top: 3px; }
.money { font-variant-numeric: tabular-nums; font-weight: 700; }
.status {
  display: inline-flex; padding: 5px 8px; border-radius: 20px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; background: #eee7de; color: #6b5f54;
}
.status.confirmed, .status.scheduled, .status.ordered, .status.booked { background: #f6ead7; color: #7a5728; }
.status.ready, .status.completed, .status.received, .status.delivered, .status.paid { background: #e7efe6; color: #405c3f; }
.status.overdue, .status.cancelled, .status.low { background: #f4dedb; color: #a43d35; }
.status.shipped, .status.in_transit, .status.woocommerce { background: #dfe8ed; color: #456677; }
.status.issued, .status.part_paid { background: #f3e8cc; color: #8a671d; }
.status.void { background: #e7e3df; color: #786f68; }
.status.high { background: #f4dedb; color: #a43d35; }
.status.medium { background: #f3e8cc; color: #8a671d; }
.status.normal { background: #e7efe6; color: #405c3f; }
.voided-invoice, .voided-invoice-title {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  color: var(--muted);
}
.notification-list { display: grid; gap: 10px; }
.notification-item {
  display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 13px;
  border: 1px solid var(--line); border-radius: 12px; background: #fbf8f3;
}
.notification-item.high { border-color: #ebc9c4; background: #fff6f4; }
.notification-item.medium { border-color: #ead2a7; background: #fff9ed; }
.notification-icon {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--coffee); color: white; font-size: 11px; font-weight: 900; text-transform: uppercase;
}
.notification-item.high .notification-icon { background: #a43d35; }
.notification-item.medium .notification-icon { background: var(--gold); color: var(--coffee-dark); }
.notification-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.notification-title strong { font-size: 13px; line-height: 1.25; }
.notification-item p { margin: 5px 0 9px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.notification-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.notification-meta time { color: #a18f80; font-size: 10px; }
.notification-meta .text-button { padding: 0; font-size: 11px; }
.reminder-list { display: grid; gap: 2px; }
.reminder { display: grid; grid-template-columns: 9px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.reminder:last-child { border: 0; }
.reminder-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--rust); margin-top: 5px; }
.reminder strong { display: block; font-size: 13px; }
.reminder p { margin: 4px 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.reminder time { color: #a18f80; font-size: 10px; }
.page-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.page-toolbar .group { display: flex; gap: 9px; }
.page-toolbar input, .page-toolbar select { width: auto; min-width: 180px; background: var(--card); }
.empty { text-align: center; padding: 60px 25px; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font: 700 19px "Fraunces", serif; margin-bottom: 7px; }
.progress { width: 100%; height: 7px; background: #ede6dc; border-radius: 8px; overflow: hidden; margin-top: 7px; }
.progress span { display: block; height: 100%; background: var(--sage); border-radius: inherit; }
.date-card { display: flex; align-items: center; gap: 13px; }
.date-badge { width: 48px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; text-align: center; background: white; }
.date-badge small { display: block; color: var(--rust); text-transform: uppercase; font-size: 9px; font-weight: 700; }
.date-badge strong { font: 700 20px "Fraunces", serif; }
.report-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin: 18px 0; }
.invoice-filters { display: flex; gap: 7px; flex-wrap: wrap; }
.invoice-cell { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.filter-chip { border: 1px solid var(--line); background: var(--card); color: var(--muted); border-radius: 20px; padding: 8px 13px; font-weight: 700; font-size: 12px; }
.filter-chip.active { background: var(--coffee); color: white; border-color: var(--coffee); }
.overdue-text { color: #a43d35; font-weight: 700; }
.credit-balance { color: #537e45; font-weight: 800; }
.due-balance { color: var(--coffee); font-weight: 800; }
.invoice-detail-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.invoice-detail-summary > div, .payment-balance { background: #f2ece4; padding: 13px; border-radius: 10px; }
.invoice-detail-summary > div.credit-balance { background: #eaf5e4; }
.invoice-detail-summary span, .payment-balance span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
.invoice-actions { flex-wrap: wrap; }
.payment-balance { display: flex; justify-content: space-between; align-items: center; }
.payment-balance span { margin: 0; }
.payment-balance strong { font: 700 22px "Fraunces", serif; }
.convert-order { padding: 7px 9px; font-size: 11px; white-space: nowrap; }
.customer-grid, .product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 15px; }
.directory-card, .product-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 19px;
  box-shadow: 0 3px 14px rgba(50,32,21,.035); cursor: pointer; transition: transform .15s, box-shadow .15s;
}
.directory-card:hover, .product-card:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(50,32,21,.08); }
.directory-card-head { display: flex; justify-content: space-between; align-items: center; }
.directory-avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: #eaded1; color: var(--coffee); font: 700 19px "Fraunces", serif; text-transform: uppercase; }
.directory-card h2, .product-card h2 { font: 700 20px/1.2 "Fraunces", serif; margin: 17px 0 5px; }
.directory-card > p, .product-card > p { color: var(--muted); font-size: 12px; margin: 0; }
.directory-card dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 20px 0; }
.directory-card dl div { background: #f4efe8; border-radius: 8px; padding: 10px; }
.directory-card dt, .product-prices span, .price-strip span { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.directory-card dd { margin: 5px 0 0; font-weight: 800; font-size: 12px; }
.directory-card-foot, .product-card-foot { border-top: 1px solid var(--line); padding-top: 12px; display: flex; justify-content: space-between; gap: 10px; font-size: 11px; color: var(--muted); }
.directory-card-foot strong, .product-card-foot strong { color: var(--rust); }
.customer-categories-section { margin-bottom: 28px; }
.product-card { position: relative; overflow: hidden; }
.product-card::before { content: ""; position: absolute; width: 115px; height: 115px; border-radius: 50%; background: #eee3d6; right: -42px; top: -47px; }
.product-card-label { color: var(--rust); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; font-weight: 800; position: relative; }
.product-pack { position: absolute; right: 16px; top: 16px; z-index: 1; font-size: 11px; font-weight: 800; color: var(--coffee); }
.product-prices, .price-strip { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin: 20px 0; }
.product-prices div, .price-strip div { background: #f4efe8; border-radius: 9px; padding: 11px; }
.product-prices strong, .price-strip strong { display: block; margin-top: 5px; }
.detail-toolbar { display: flex; justify-content: space-between; gap: 20px; align-items: center; }
.detail-toolbar .group { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-toolbar p { color: var(--muted); font-size: 12px; margin: 5px 0 0; line-height: 1.45; }
.forecast-week .detail-toolbar { margin-bottom: 16px; }
.contact-list { display: grid; }
.contact-row { display: grid; grid-template-columns: 1.1fr 1fr auto auto; gap: 15px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.contact-row:last-child { border-bottom: 0; }
.contact-name { font-weight: 800; }
.contact-row p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.contact-row strong { font-size: 12px; }
.contact-flags { display: flex; gap: 5px; flex-wrap: wrap; }
.contact-flags span { background: #eee7de; border-radius: 12px; padding: 4px 7px; color: var(--muted); font-size: 9px; font-weight: 700; }
.check-grid { display: flex; gap: 18px; flex-wrap: wrap; padding-top: 5px; }
.check-label { display: flex; grid-template-columns: none; align-items: center; gap: 8px; }
.check-label input { width: auto; }
.text-button.danger { color: #a43d35; justify-self: start; }
.price-strip { grid-template-columns: repeat(3, 1fr); margin: 0; }
.forecast-list { display: grid; gap: 18px; }
.forecast-week { background: var(--card); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.forecast-week.unscheduled { border-color: #d7a498; }
.forecast-week.complete { border-color: #b9d3b0; box-shadow: 0 8px 24px rgba(83, 126, 69, .1); }
.forecast-week.complete > summary { background: linear-gradient(90deg, #f5fbf1 0%, var(--card) 70%); }
.forecast-week > summary {
  display: flex; justify-content: space-between; gap: 20px; align-items: center;
  padding: 20px 22px; border-bottom: 1px solid var(--line); cursor: pointer; list-style: none;
}
.forecast-week > summary::-webkit-details-marker { display: none; }
.forecast-week > summary::after {
  content: "+"; width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 50%; background: #f0e8db; color: var(--coffee); font-weight: 800;
}
.forecast-week[open] > summary::after { content: "-"; }
.forecast-week > summary h2 { font: 700 23px "Fraunces", serif; margin: 6px 0 0; }
.forecast-week-status {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 9px; border-radius: 999px;
  background: #e6f3df; color: #537e45; padding: 5px 9px; font-size: 10px;
  font-weight: 900; letter-spacing: .08em; text-transform: uppercase;
}
.forecast-week-totals { text-align: right; }
.forecast-week-totals strong { display: block; font: 700 24px "Fraunces", serif; }
.forecast-week-totals span { color: var(--muted); font-size: 11px; }
.forecast-products { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.forecast-products > div { background: #f5f0e9; padding: 13px 17px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.forecast-products span strong, .forecast-products span small { display: block; }
.forecast-products span strong { font-size: 12px; }
.forecast-products span small { color: var(--muted); margin-top: 3px; font-size: 10px; }
.forecast-products b { white-space: nowrap; color: var(--coffee); }
.roast-progress-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin: 0 0 15px; }
.roast-progress-card {
  border: 1px solid var(--line); border-radius: 13px; background: #fbf7f1;
  padding: 13px; box-shadow: 0 3px 10px rgba(18,19,30,.035);
}
.roast-progress-card.complete { background: #edf4ea; border-color: #c8d9c4; }
.roast-progress-card span, .roast-progress-card small {
  display: block; color: var(--muted); font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em;
}
.roast-progress-card strong { display: block; margin-top: 3px; font-size: 13px; }
.roast-progress-card p { margin: 8px 0 4px; color: var(--muted); font-size: 11px; }
.roast-progress-card b { color: var(--ink); }
.roast-level-breakdown { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.roast-level {
  display: inline-flex !important; align-items: center; border-radius: 999px; padding: 4px 8px;
  background: #efe8dc; color: var(--coffee) !important; font-size: 10px; font-weight: 900;
  text-transform: uppercase; letter-spacing: .04em;
}
.roast-level.light { background: #f8efd9; color: #7a5524 !important; }
.roast-level.medium { background: #ead3ac; color: #5a371d !important; }
.roast-level.dark { background: #2a2130; color: #fff !important; }
.roast-log-context {
  display: grid; gap: 14px; padding: 15px; border: 1px solid var(--line);
  border-radius: 14px; background: #f6efe6;
}
.roast-log-context > div:first-child {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap;
}
.roast-log-context span {
  color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800;
}
.roast-log-context strong { font: 700 22px "Fraunces", serif; }
.roast-log-context small { color: var(--muted); font-size: 11px; }
.batch-code-display {
  min-height: 43px; display: flex; align-items: center; border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; background: #f4efe6; color: var(--ink);
  font-size: 12px; font-weight: 800;
}
.forecast-orders article { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 15px 21px; border-bottom: 1px solid var(--line); cursor: pointer; }
.forecast-orders article:last-child { border-bottom: 0; }
.forecast-orders article:hover { background: #fbf7f1; }
.forecast-orders h3 { margin: 4px 0; font-size: 14px; }
.forecast-orders p { margin: 0; color: var(--muted); font-size: 11px; }
.forecast-orders article > div:last-child { text-align: right; display: grid; justify-items: end; gap: 7px; }
.forecast-date { color: var(--rust); text-transform: uppercase; font-size: 9px; letter-spacing: .08em; font-weight: 800; }
.forecast-warning { padding: 9px 21px; background: #f5dfd9; color: #813d35; font-size: 11px; font-weight: 800; }
.recurring-calendar { display: grid; gap: 18px; margin-top: 18px; }
.calendar-month { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fbf7f1; }
.calendar-month header { padding: 15px 17px; border-bottom: 1px solid var(--line); background: #f3ece3; }
.calendar-month h2 { margin: 0; font: 700 21px "Fraunces", serif; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-weekdays { background: #ebe1d6; border-bottom: 1px solid var(--line); }
.calendar-weekdays span { padding: 8px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; text-align: center; }
.calendar-grid { background: var(--line); gap: 1px; }
.calendar-day { min-height: 104px; padding: 8px; background: #fffaf3; display: grid; align-content: start; gap: 5px; }
.calendar-day.muted { background: #f1e9df; }
.calendar-day.has-events { background: #fff7e8; }
.calendar-day > strong { font-size: 11px; color: var(--muted); }
.calendar-day em { color: var(--muted); font-size: 10px; font-style: normal; }
.calendar-event { border: 0; border-radius: 8px; padding: 6px 7px; text-align: left; cursor: pointer; background: #ead9c7; color: var(--ink); }
.calendar-event.generated { background: #e3efe0; }
.calendar-event.projected { background: #f5e6cc; }
.calendar-event span, .calendar-event small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-event span { font-size: 10px; font-weight: 800; }
.calendar-event small { margin-top: 2px; font-size: 9px; color: var(--muted); }
.stock-outlook { margin-bottom: 18px; overflow: hidden; }
.stock-outlook .stock-notice { margin: 16px 18px 18px; }
.stock-short { background: #fff3f0; }
.stock-short strong { color: #a43d35; }
.stock-notice { border-radius: 10px; padding: 13px 15px; border: 1px solid var(--line); }
.stock-notice strong { display: block; font-size: 12px; }
.stock-notice p { margin: 5px 0 0; font-size: 11px; line-height: 1.45; }
.stock-notice.neutral { background: #f2eee8; color: var(--muted); }
.stock-notice.success { background: #e7f0e6; border-color: #bfd2bd; color: #315b36; }
.stock-notice.warning { background: #f8eed6; border-color: #e5cf91; color: #765713; }
.stock-notice.danger { background: #f6e1dd; border-color: #dfb0a8; color: #81352e; }
.forecast-week .panel-body > .stock-notice { margin: 0 0 16px; }
.bar-chart { display: grid; gap: 10px; padding: 16px 18px; }
.bar-row { display: grid; grid-template-columns: minmax(95px, 1fr) 2fr 90px; gap: 12px; align-items: center; font-size: 11px; }
.bar-row > span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row > div { height: 12px; border-radius: 99px; background: #eee5da; overflow: hidden; }
.bar-row i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--rust), var(--gold)); }
.bar-row strong { text-align: right; font-size: 11px; }
.line-chart { padding: 18px 20px 14px; }
.line-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-axis { stroke: #e4dccf; stroke-width: 1.5; }
.chart-area { fill: rgba(213, 171, 104, .16); stroke: none; }
.chart-line { fill: none; stroke: var(--gold); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.chart-point circle { fill: var(--coffee); stroke: var(--gold); stroke-width: 3; }
.chart-label { fill: var(--muted); font-size: 11px; font-weight: 700; }
.chart-summary { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; margin-top: 4px; }
.chart-summary strong { color: var(--ink); }
.recipe-list { display: grid; gap: 9px; }
.recipe-row {
  display: grid; grid-template-columns: 1fr 120px; gap: 12px; align-items: end;
  padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #f7f3ed;
}
.recipe-row .check-label { align-self: center; flex-wrap: wrap; }
.recipe-row small { width: 100%; margin-left: 24px; color: var(--muted); }
.form-hint { color: var(--muted); font-size: 11px; line-height: 1.45; }
.settings-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 22px; align-items: start; }
.settings-nav {
  position: sticky; top: 114px; display: grid; gap: 8px; padding: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 15px;
  box-shadow: 0 3px 14px rgba(18,19,30,.045);
}
.settings-nav .eyebrow { margin: 0 0 4px; }
.settings-nav button {
  border: 1px solid transparent; border-radius: 12px; background: transparent; color: var(--muted);
  padding: 12px; text-align: left; transition: background .18s, border-color .18s, color .18s, transform .18s var(--ease-out);
}
.settings-nav button:hover { background: #f8f2ea; transform: translateX(2px); }
.settings-nav button.active { background: #f4eadb; border-color: #ead4b5; color: var(--coffee); }
.settings-nav strong { display: block; color: inherit; font-size: 13px; }
.settings-nav span { display: block; margin-top: 4px; font-size: 11px; line-height: 1.35; }
.settings-content { min-width: 0; }
.settings-tab-panel { display: none; gap: 18px; }
.settings-tab-panel.active { display: grid; animation: card-in .28s var(--ease-out) both; }
.settings-section { margin-top: 18px; }
.danger-zone {
  border-color: #e4b6ae;
  background: linear-gradient(180deg, #fff, #fbefec);
}
.danger-zone .panel-head h2 { color: #81352e; }
.danger-zone .panel-body p { color: #71322d; }
.delete-warning { background: #f6e7e4; border: 1px solid #e6bdb7; border-radius: 11px; padding: 17px; color: #71322d; }
.delete-warning p { margin: 8px 0 0; line-height: 1.5; }
.status-history { display: grid; }
.status-history > div { display: grid; grid-template-columns: 110px 1fr auto; gap: 12px; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.status-history > div:last-child { border-bottom: 0; }
.status-history p { margin: 0; color: var(--muted); font-size: 11px; }
.status-history time { color: var(--muted); font-size: 10px; }

dialog {
  border: 0; border-radius: 17px; padding: 0;
  width: min(1180px, calc(100vw - 24px)); max-height: calc(100vh - 24px);
  box-shadow: var(--shadow); color: var(--ink); overflow: hidden;
}
dialog[open] { animation: modal-in .22s var(--ease-out) both; }
dialog::backdrop { background: rgba(18,19,30,.68); backdrop-filter: blur(4px); animation: fade-in .22s ease both; }
.modal-head { padding: 23px 25px 18px; display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 27px; margin: 7px 0 0; }
.modal-body { padding: 24px 25px 26px; display: grid; gap: 17px; max-height: calc(100vh - 128px); overflow: auto; }
.modal-back {
  justify-self: start; border: 1px solid var(--line); background: #f4eee6; color: var(--coffee);
  border-radius: 999px; padding: 8px 13px; font-size: 12px; font-weight: 800;
}
#modal-form.panel-slide { animation: panel-slide .24s var(--ease-out) both; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid .wide { grid-column: 1 / -1; }
.read-only-field {
  min-height: 43px; display: flex; align-items: center; padding: 10px 12px;
  border-radius: 10px; background: #f4efe6; color: var(--ink); font-weight: 800;
}
.form-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 5px; }
.line-items { display: grid; gap: 9px; }
.line-item { display: grid; grid-template-columns: 1fr 90px 110px 34px; gap: 8px; align-items: end; }
.product-line { grid-template-columns: minmax(190px, 1.2fr) minmax(140px, .9fr) 105px 80px 110px 34px; }
.purchase-line { grid-template-columns: 140px minmax(190px, 1fr) minmax(190px, 1fr) 85px 130px 92px 34px; }
.purchase-line .custom-choice { grid-column: auto; }
.roast-line {
  display: grid; grid-template-columns: minmax(220px, 1.4fr) 140px 120px 100px 100px 140px 34px;
  gap: 8px; align-items: end; padding: 12px; border: 1px solid var(--line);
  border-radius: 12px; background: #faf8f2;
}
.roast-line .wide { grid-column: 1 / 6; }
.batch-code { display: grid; gap: 8px; color: #4e443c; font-size: 13px; font-weight: 600; }
.batch-code strong {
  min-height: 43px; display: flex; align-items: center; border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; background: #f4efe6; color: var(--ink);
  font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.receive-line {
  display: grid; grid-template-columns: 1fr 180px; gap: 10px; align-items: end;
  padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #f7f2eb;
}
.receive-line small { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }
.template-line {
  display: grid; grid-template-columns: 1fr 1fr 1fr 100px 34px; gap: 8px; align-items: end;
  padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #f7f2eb;
}
.template-line.product-size-line { grid-template-columns: minmax(130px, .85fr) minmax(180px, 1.2fr) 110px 120px 120px 34px; }
.template-line .wide { grid-column: 1 / 5; }
.template-line.product-size-line .wide { grid-column: 1 / 6; }
.remove-line { border: 0; background: #f3e8e5; color: #9d3c34; border-radius: 9px; height: 42px; }
.toast {
  position: fixed; right: 25px; bottom: 25px; padding: 12px 16px; border-radius: 10px;
  background: var(--coffee-dark); color: white; box-shadow: var(--shadow); z-index: 9999;
  opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s;
}
.toast.in-modal { position: absolute; right: 24px; bottom: 24px; }
.toast.show { opacity: 1; transform: translateY(0); }

@keyframes page-rise {
  from { opacity: 0; transform: translateY(8px) scale(.995); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes panel-slide {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes registration-form-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(8px) scale(.985); }
}
@keyframes success-card-in {
  from { opacity: 0; transform: translateY(16px) scale(.97); filter: blur(3px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
@keyframes success-tick {
  0% { opacity: 0; transform: scale(.55) rotate(-12deg); box-shadow: 0 0 0 0 rgba(83,126,69,.28); }
  58% { opacity: 1; transform: scale(1.08) rotate(0); box-shadow: 0 0 0 12px rgba(83,126,69,.09); }
  100% { opacity: 1; transform: scale(1) rotate(0); box-shadow: 0 16px 34px rgba(83,126,69,.16); }
}
@keyframes saved-highlight {
  0% { background: #fff7e4; box-shadow: 0 0 0 0 rgba(213,171,104,.75); transform: translateY(-1px); }
  55% { background: #fff7e4; box-shadow: 0 0 0 8px rgba(213,171,104,.16); }
  100% { box-shadow: 0 0 0 0 rgba(213,171,104,0); transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

@media (max-width: 1050px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; grid-template-columns: repeat(4, minmax(160px, 1fr)); overflow-x: auto; }
}
@media (max-width: 760px) {
  .registration-shell { grid-template-columns: 1fr; padding: 20px; }
  .registration-hero { padding: 16px; }
  .registration-card { padding: 20px; }
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .app-shell { display: block; padding-bottom: 70px; }
  .sidebar { position: fixed; inset: auto 0 0; width: auto; height: 66px; padding: 7px; flex-direction: row; overflow-x: auto; }
  .sidebar-brand, .sidebar-foot { display: none; }
  .sidebar nav { display: flex; width: 100%; justify-content: space-around; overflow: visible; }
  .nav-group { display: contents; }
  .nav-group p { display: none; }
  .sidebar nav a { min-width: 68px; padding: 7px; flex-direction: column; gap: 2px; font-size: 9px; }
  .main { display: block; }
  .topbar { padding: 20px; }
  .page-content { padding: 20px; }
  .topbar h1 { font-size: 25px; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric { min-height: 112px; padding: 15px; }
  .metric strong { font-size: 25px; }
  .page-toolbar { align-items: stretch; flex-direction: column; }
  .page-toolbar .group { overflow-x: auto; }
  .settings-nav { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
  .data-table { min-width: 680px; }
  .panel { overflow-x: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .line-item, .product-line, .purchase-line, .template-line, .roast-line { grid-template-columns: 1fr; }
  .roast-line .wide { grid-column: auto; }
  .invoice-detail-summary { grid-template-columns: 1fr 1fr; }
  .contact-row { grid-template-columns: 1fr; gap: 6px; }
  .detail-toolbar { align-items: flex-start; flex-direction: column; }
  .forecast-week > summary { align-items: flex-start; flex-direction: column; }
  .forecast-week-totals { text-align: left; }
  .status-history > div { grid-template-columns: 1fr; gap: 5px; }
}
