:root { --ink: #17201c; --muted: #68746e; --line: #dde3df; --soft: #f4f6f5; --green: #176b55; --green-dark: #104b3c; --green-soft: #e6f1ed; --coral: #ed6255; --yellow: #e8b94d; --white: #fff; --shadow: 0 16px 45px rgba(16, 48, 39, 0.12); }
* { box-sizing: border-box; }
html { color-scheme: light; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { margin: 0; background: #f7f8f7; color: var(--ink); letter-spacing: 0; }
button, input, select { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
.eyebrow { margin: 0 0 8px; color: var(--green); font-size: 0.7rem; font-weight: 850; }
.button { min-height: 42px; padding: 0 16px; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--ink); font-weight: 800; cursor: pointer; }
.button.primary { border-color: var(--green); background: var(--green); color: white; }
.button.primary:hover { background: var(--green-dark); }
.button.wide { width: 100%; }
.button:disabled { cursor: wait; opacity: 0.65; }
.form-error { margin: 0; color: #b6382d; font-size: 0.8rem; line-height: 1.4; }

.login-page { min-height: 100vh; background: #0d3d31; }
.login-shell { display: grid; min-height: 100vh; grid-template-columns: minmax(0, 1.12fr) minmax(390px, 0.88fr); }
.login-brand { position: relative; overflow: hidden; padding: clamp(38px, 7vw, 100px); background: #0d3d31; color: white; }
.brand-mark { display: grid; place-items: center; width: 48px; height: 48px; border: 2px solid var(--yellow); color: var(--yellow); font-size: 1.35rem; font-weight: 900; }
.login-brand > p { margin: 18px 0 0; color: #c9dfd7; font-size: 0.75rem; font-weight: 850; }
.login-brand h1 { max-width: 620px; margin: 70px 0 0; font-size: clamp(2.4rem, 5vw, 5.4rem); line-height: 0.98; }
.login-art { display: flex; gap: 22px; align-items: center; margin-top: 80px; }
.login-art > span { color: var(--yellow); font-size: 2rem; }
.art-photo, .art-print { width: 150px; aspect-ratio: 1; border: 1px solid rgba(255,255,255,.22); background-position: center; background-size: cover; }
.art-photo { background-image: url("assets/landing/hero-printshop.jpg"); }
.art-print { background-image: url("assets/templates/thumbs/mom-right.jpg"); }
.login-panel { display: grid; place-items: center; padding: 32px; background: white; }
.login-form-wrap { width: min(420px, 100%); }
.login-form-wrap h2 { margin: 0 0 38px; font-size: 2.2rem; }
.login-form-wrap form, .app-dialog form { display: grid; gap: 18px; }
.login-form-wrap label, .app-dialog label { display: grid; gap: 7px; color: var(--muted); font-size: 0.78rem; font-weight: 750; }
.login-form-wrap input, .app-dialog input { width: 100%; height: 48px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--ink); outline: none; }
.login-form-wrap input:focus, .app-dialog input:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.login-legal{margin:18px 0 0;color:var(--muted);font-size:.65rem;line-height:1.55}.login-legal a{color:var(--green);font-weight:750}
.mobile-brand { display: none; }

.dashboard-shell { display: grid; min-height: 100vh; grid-template-columns: 232px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 20px 14px 14px; border-right: 1px solid var(--line); background: white; }
.dashboard-brand { display: flex; gap: 10px; align-items: center; padding: 0 8px 26px; color: var(--ink); text-decoration: none; }
.dashboard-brand span { display: grid; place-items: center; width: 32px; height: 32px; background: var(--green); color: white; font-weight: 900; }
.dashboard-brand strong { font-size: 1.05rem; }
.sidebar nav { display: grid; gap: 4px; }
.nav-item { display: grid; grid-template-columns: 25px minmax(0,1fr) auto; gap: 8px; align-items: center; min-height: 44px; padding: 0 11px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); text-align: left; cursor: pointer; }
.nav-item:hover { background: var(--soft); color: var(--ink); }
.nav-item.is-active { background: var(--green-soft); color: var(--green-dark); font-weight: 800; }
.nav-item > span { font-size: 1rem; text-align: center; }
.nav-item b { min-width: 21px; padding: 3px 6px; border-radius: 10px; background: var(--coral); color: white; font-size: 0.65rem; text-align: center; }
.sidebar-user { display: grid; grid-template-columns: 34px minmax(0,1fr) 30px; gap: 9px; align-items: center; margin-top: auto; padding: 13px 8px 2px; border-top: 1px solid var(--line); }
.sidebar-user > span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--green-dark); color: white; font-weight: 850; }
.sidebar-user div { display: grid; min-width: 0; }
.sidebar-user strong, .sidebar-user small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user strong { font-size: 0.72rem; }
.sidebar-user small { color: var(--muted); font-size: 0.64rem; }
.sidebar-user button { width: 30px; height: 30px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }

.dashboard-main { min-width: 0; padding: 32px clamp(18px, 4vw, 58px) 70px; }
.dashboard-header { display: flex; gap: 20px; justify-content: space-between; align-items: end; }
.dashboard-header h1 { margin: 0; font-size: 2rem; }
.stats-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 28px 0; border: 1px solid var(--line); background: white; }
.stats-row article { min-width: 0; padding: 18px 20px; border-right: 1px solid var(--line); }
.stats-row article:last-child { border-right: 0; }
.stats-row span { display: block; color: var(--muted); font-size: 0.72rem; font-weight: 700; }
.stats-row strong { display: block; margin-top: 5px; font-size: 1.75rem; }
.table-toolbar { display: flex; gap: 9px; align-items: center; margin-bottom: 12px; }
.search-field { display: flex; flex: 1 1 300px; align-items: center; max-width: 440px; height: 42px; padding: 0 12px; border: 1px solid var(--line); background: white; }
.search-field span { color: var(--muted); font-size: 1.15rem; }
.search-field input { min-width: 0; width: 100%; height: 100%; padding: 0 9px; border: 0; outline: 0; }
.table-toolbar select, .status-select { height: 42px; padding: 0 34px 0 11px; border: 1px solid var(--line); border-radius: 0; background: white; color: var(--ink); }
.status-select { height: 34px; min-width: 112px; padding-right: 26px; font-size: 0.72rem; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); background: white; color: var(--ink); font-size: 1.1rem; cursor: pointer; }
.data-table-wrap { overflow-x: auto; border: 1px solid var(--line); background: white; }
.data-table { width: 100%; min-width: 950px; border-collapse: collapse; }
.data-table th { padding: 11px 14px; border-bottom: 1px solid var(--line); background: #fafbfa; color: var(--muted); font-size: 0.65rem; text-align: left; text-transform: uppercase; }
.data-table td { padding: 12px 14px; border-bottom: 1px solid #edf0ee; font-size: 0.78rem; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fbfcfb; }
.design-thumb { display: block; width: 52px; height: 52px; object-fit: contain; border: 1px solid var(--line); background-color: #eef1ef; background-image: linear-gradient(45deg,#dfe3e1 25%,transparent 25%),linear-gradient(-45deg,#dfe3e1 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#dfe3e1 75%),linear-gradient(-45deg,transparent 75%,#dfe3e1 75%); background-position: 0 0,0 5px,5px -5px,-5px 0; background-size: 10px 10px; }
.primary-cell { display: grid; gap: 3px; }
.primary-cell strong { font-size: 0.8rem; }
.primary-cell small { color: var(--muted); }
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 12px; background: var(--soft); color: var(--muted); font-size: 0.68rem; font-weight: 800; }
.status-pill.new { background: #fff0ee; color: #b8473d; }
.status-pill.printing { background: #fff7dd; color: #7d621a; }
.status-pill.ready { background: var(--green-soft); color: var(--green-dark); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-actions a, .row-actions button { display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 9px; border: 1px solid var(--line); background: white; color: var(--ink); text-decoration: none; cursor: pointer; }
.empty-state { display: grid; justify-items: center; gap: 5px; padding: 70px 20px; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--ink); }

.generation-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.generation-item { overflow: hidden; border: 1px solid var(--line); background: white; }
.generation-preview { position: relative; display: grid; place-items: center; aspect-ratio: 1; background: #eef1ef; }
.generation-preview img { width: 100%; height: 100%; object-fit: contain; }
.generation-preview .status-pill { position: absolute; top: 9px; right: 9px; }
.generation-item footer { display: grid; gap: 7px; padding: 11px; }
.generation-item footer strong { overflow: hidden; font-size: 0.78rem; text-overflow: ellipsis; white-space: nowrap; }
.generation-item footer small { color: var(--muted); }
.generation-meta { display: flex; justify-content: space-between; gap: 8px; }

.settings-content { display: grid; gap: 20px; max-width: 900px; }
.settings-block { border-top: 1px solid var(--line); padding-top: 18px; }
.settings-block:first-child { border-top: 0; padding-top: 0; }
.settings-block h2 { margin: 0 0 5px; font-size: 1.15rem; }
.settings-block > p { margin: 0 0 16px; color: var(--muted); font-size: 0.8rem; }
.location-row { display: grid; grid-template-columns: minmax(120px, .5fr) minmax(260px, 1.5fr) auto auto; gap: 8px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.location-row code { overflow: hidden; padding: 8px; background: var(--soft); color: var(--green-dark); text-overflow: ellipsis; white-space: nowrap; }

.app-dialog { width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; box-shadow: var(--shadow); }
.app-dialog.compact { width: min(480px, calc(100vw - 32px)); }
.app-dialog::backdrop { background: rgba(12, 28, 23, 0.55); }
.dialog-head { display: flex; justify-content: space-between; align-items: start; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: 1.35rem; }
.dialog-head button { width: 34px; height: 34px; border: 0; background: var(--soft); font-size: 1.3rem; cursor: pointer; }
.app-dialog > form, .app-dialog > div:not(.dialog-head) { padding: 24px; }
.order-detail { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(0, 1.2fr); gap: 24px; }
.order-artwork { display: grid; place-items: center; aspect-ratio: 1; background: #eef1ef; }
.order-artwork img { width: 100%; height: 100%; object-fit: contain; }
.detail-list { display: grid; align-content: start; }
.detail-list div { display: flex; justify-content: space-between; gap: 20px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 0.78rem; }
.detail-list span { color: var(--muted); }
.detail-actions { display: flex; gap: 8px; margin-top: 18px; }
.credential-box { margin: 0 0 14px; padding: 12px; background: var(--soft); }
.credential-box span { display: block; color: var(--muted); font-size: .68rem; }
.credential-box strong, .credential-box code { display: block; overflow-wrap: anywhere; margin-top: 5px; }
.warning-copy { color: #8a6211; font-size: .75rem; line-height: 1.45; }
.toast { position: fixed; z-index: 20; right: 20px; bottom: 20px; max-width: 360px; padding: 13px 16px; background: var(--green-dark); color: white; box-shadow: var(--shadow); font-size: .8rem; font-weight: 750; }

@media (max-width: 900px) {
  .dashboard-shell { grid-template-columns: 76px minmax(0, 1fr); }
  .sidebar { padding-inline: 10px; }
  .dashboard-brand strong, .nav-item:not(.is-active) { font-size: 0; }
  .dashboard-brand { justify-content: center; padding-inline: 0; }
  .nav-item { grid-template-columns: 1fr; justify-items: center; padding: 0; font-size: 0; }
  .nav-item.is-active { font-size: 0; }
  .nav-item > span { font-size: 1.1rem; }
  .nav-item b { position: absolute; margin: -25px 0 0 25px; font-size: .6rem; }
  .sidebar-user { grid-template-columns: 1fr; justify-items: center; padding-inline: 0; }
  .sidebar-user div { display: none; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .stats-row article:nth-child(2) { border-right: 0; }
  .stats-row article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 640px) {
  .login-shell { display: block; }
  .login-brand { display: none; }
  .login-panel { min-height: 100vh; padding: 24px; }
  .mobile-brand { display: flex; gap: 9px; align-items: center; margin-bottom: 75px; font-weight: 850; }
  .mobile-brand b { display: grid; place-items: center; width: 30px; height: 30px; background: var(--green); color: white; }
  .dashboard-shell { display: block; }
  .sidebar { position: fixed; z-index: 10; top: auto; right: 0; bottom: 0; left: 0; display: block; width: auto; height: 64px; padding: 6px 8px max(6px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); border-right: 0; }
  .dashboard-brand, .sidebar-user { display: none; }
  .sidebar nav { grid-template-columns: repeat(4, 1fr); height: 100%; }
  .nav-item, .nav-item.is-active, .nav-item:not(.is-active) { display: grid; grid-template-columns: 1fr; min-height: 48px; font-size: .55rem; justify-items: center; align-content: center; gap: 2px; }
  .nav-item > span { font-size: .9rem; }
  .dashboard-main { padding: 22px 14px 90px; }
  .dashboard-header { align-items: center; }
  .dashboard-header h1 { font-size: 1.6rem; }
  .dashboard-header .button { width: 42px; overflow: hidden; padding: 0; font-size: 0; }
  .dashboard-header .button::before { content: "+"; font-size: 1.25rem; }
  .stats-row { margin: 20px 0; }
  .stats-row article { padding: 13px 14px; }
  .stats-row strong { font-size: 1.35rem; }
  .table-toolbar { flex-wrap: wrap; }
  .search-field { flex-basis: calc(100% - 52px); }
  .table-toolbar select { flex: 1; }
  .data-table-wrap { margin-inline: -14px; border-right: 0; border-left: 0; }
  .generation-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .order-detail { grid-template-columns: 1fr; }
  .location-row { grid-template-columns: 1fr auto; }
  .location-row code { grid-column: 1 / -1; grid-row: 2; }
}
