
/* BYRISE brand tokens – SRS §17 */
:root {
  --primary: #D86B9B;
  --primary-dark: #B94F7C;
  --bg: #FFF8FB;
  --surface: #FFFFFF;
  --pink-2: #F8DCE8;
  --pink-1: #FCEEF4;
  --text: #39313A;
  --muted: #8B7E87;
  --line: #EFE0E7;
  --success: #3F916B;
  --warning: #E09B38;
  --danger: #D65361;
  --info: #5B80D1;
  --r-card: 14px;
  --r-btn: 10px;
  --r-input: 9px;
  --shadow-sm: 0 1px 2px rgba(57, 49, 58, .04);
  --shadow: 0 1px 3px rgba(57, 49, 58, .05), 0 6px 20px rgba(216, 107, 155, .07);
  --shadow-lg: 0 14px 36px rgba(57, 49, 58, .12), 0 4px 12px rgba(216, 107, 155, .08);
  --sidebar-w: 240px;
  --header-h: 64px;
  --font: 'Be Vietnam Pro', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}


*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.3; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 700; } h2 { font-size: 16.5px; } h3 { font-size: 15px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; }
.hidden { display: none !important; }
.text-success { color: var(--success); } .text-danger { color: var(--danger); } .text-warning { color: #B9771A; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
::selection { background: var(--pink-2); }
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-thumb { background: #E3CED8; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #CFAEC0; }


/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(circle at 18% 12%, #FCE4EF 0, transparent 45%), radial-gradient(circle at 85% 88%, #F8DCE8 0, transparent 42%), var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-lg); border: 1px solid #F5E6ED; padding: 32px 28px 28px; text-align: center; position: relative; overflow: hidden; }
.login-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--primary), var(--primary-dark)); }
.login-card img { width: 96px; height: 96px; border-radius: 50%; box-shadow: 0 4px 14px rgba(216, 107, 155, .18); }
.login-card h1 { margin: 10px 0 2px; color: var(--primary-dark); letter-spacing: .8px; font-size: 24px; }
.login-card form { text-align: left; margin-top: 20px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 40px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; border-radius: 8px; font-size: 12px; font-weight: 600; }
.pw-toggle:hover { background: var(--pink-1); color: var(--primary-dark); }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--line); position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40; transition: transform .2s ease; }
.brand { display: flex; align-items: center; gap: 10px; padding: 14px 18px; height: var(--header-h); border-bottom: 1px solid var(--line); }
.brand img { width: 38px; height: 38px; border-radius: 50%; }
.brand b { color: var(--primary-dark); font-size: 17px; letter-spacing: .5px; }
.brand small { display: block; color: var(--muted); font-size: 11px; margin-top: -2px; }
.nav { padding: 10px; overflow-y: auto; flex: 1; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--text); font-weight: 500; margin-bottom: 3px; transition: background .15s, color .15s; position: relative; }
.nav a:hover { background: var(--pink-1); text-decoration: none; }
.nav a.active { background: linear-gradient(90deg, var(--pink-2), #FCEFF5); color: var(--primary-dark); font-weight: 600; }
.nav a.active::before { content: ''; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3.5px; border-radius: 0 4px 4px 0; background: var(--primary); }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .82; }
.nav a.active svg { opacity: 1; }
.nav .badge-count { margin-left: auto; background: var(--danger); color: #fff; font-size: 11px; border-radius: 10px; padding: 0 7px; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.header { height: var(--header-h); background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 24px; position: sticky; top: 0; z-index: 30; }
.header .search { flex: 1; max-width: 440px; position: relative; }
.header .search input { padding-left: 38px; background: var(--bg); border-radius: 999px; border-color: transparent; }
.header .search input:focus { background: var(--surface); border-color: var(--primary); }
.header .search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; color: var(--muted); pointer-events: none; }
.header .today { color: var(--muted); font-size: 13px; white-space: nowrap; margin-left: auto; }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--text); transition: background .15s; }
.icon-btn:hover { background: var(--pink-1); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .dot { position: absolute; top: 5px; right: 5px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; box-shadow: 0 0 0 2px #fff; }
.user-chip { display: flex; align-items: center; gap: 9px; cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 999px; border: 1px solid transparent; background: transparent; transition: border-color .15s, background .15s; }
.user-chip:hover { border-color: var(--line); background: var(--pink-1); }
.user-chip .avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--pink-2), var(--primary)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.user-chip .meta { line-height: 1.2; } .user-chip .meta b { font-size: 13px; } .user-chip .meta small { color: var(--muted); font-size: 11px; display: block; }
.menu-btn { display: none; }
.content { padding: 20px 24px 44px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.breadcrumb { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.breadcrumb a { color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.bottom-nav { display: none; }
.fab { display: none; }
.backdrop { display: none; }
.dropdown { position: absolute; right: 16px; top: calc(var(--header-h) - 2px); background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-lg); width: 360px; max-width: calc(100vw - 24px); max-height: 70vh; overflow: auto; z-index: 60; border: 1px solid var(--line); }
.dropdown .dd-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.dropdown .dd-item { padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.dropdown .dd-item:last-child { border-bottom: 0; }
.dropdown .dd-item:hover { background: var(--pink-1); }
.dropdown .dd-item.unread { background: #FFF3F8; }


/* ---------- Cards, Sections & KPIs ---------- */
.section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }
.card { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 16px; border: 1px solid #F3E4EC; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.kpis-ops { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpis-fin { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border-radius: var(--r-card); padding: 14px 16px; box-shadow: var(--shadow-sm); border: 1px solid var(--line); cursor: default; transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease; }
.kpi[data-href] { cursor: pointer; }
.kpi[data-href]:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 500; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.kpi .value { font-size: 22px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi.accent { background: linear-gradient(135deg, #DC72A0, #B94F7C); color: #fff; border: 0; box-shadow: 0 6px 18px rgba(185, 79, 124, .22); }
.kpi.accent .label { color: rgba(255, 255, 255, .88); }
.kpi.warn { border-left: 3px solid var(--warning); } .kpi.warn .value { color: #B9771A; }
.kpi.danger { border-left: 3px solid var(--danger); } .kpi.danger .value { color: var(--danger); }
.kpi.good { border-left: 3px solid var(--success); } .kpi.good .value { color: var(--success); }
.chart-box { position: relative; height: 250px; }
.pct-bar { height: 5px; border-radius: 99px; background: var(--pink-1); margin-top: 5px; overflow: hidden; }
.pct-bar span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--primary-dark)); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: var(--r-btn); padding: 9px 14px; font: inherit; font-weight: 600; cursor: pointer; background: var(--pink-1); color: var(--primary-dark); white-space: nowrap; min-height: 40px; transition: background .15s, border-color .15s, transform .1s, filter .15s; }
.btn:hover { filter: brightness(.97); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(216, 107, 155, .25); }
.btn-primary:hover { background: var(--primary-dark); filter: none; }
.btn-outline { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-outline:hover { background: var(--pink-1); border-color: var(--pink-2); filter: none; }
.btn-danger { background: #FBE7E9; color: var(--danger); }
.btn-success { background: #E3F3EB; color: var(--success); }
.btn-sm { padding: 5px 10px; min-height: 32px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; color: var(--primary-dark); padding: 0; min-height: 0; font-weight: 600; cursor: pointer; }

/* ---------- Forms ---------- */
label { display: block; font-size: 12px; font-weight: 600; color: #5C5059; margin-bottom: 4px; }
.field { margin-bottom: 12px; min-width: 0; }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid #E6D3DD; border-radius: var(--r-input); padding: 9px 11px; min-height: 40px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(216, 107, 155, .15); }
textarea { min-height: 72px; resize: vertical; }
input[type=checkbox] { width: auto; min-height: 0; accent-color: var(--primary); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
.input-group { display: flex; gap: 6px; } .input-group > input { flex: 1; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; color: var(--text); margin: 6px 0; cursor: pointer; }

/* ---------- Filters & Header Pills ---------- */
.count-pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; background: var(--pink-2); color: var(--primary-dark); font-size: 12.5px; font-weight: 600; margin-left: 10px; vertical-align: middle; }
.page-head h1 { display: inline-block; vertical-align: middle; }
.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.filters > * { width: auto; }
.filters input[type=search] { min-width: 220px; flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 14px; font-size: 13px; cursor: pointer; font-weight: 500; color: var(--text); transition: background .15s, border-color .15s, color .15s; }
.chip:hover { border-color: var(--primary); background: var(--pink-1); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 2px 8px rgba(216, 107, 155, .25); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #FAF4F7; }
.table td { padding: 12px; border-bottom: 1px solid #F6EBF0; vertical-align: middle; }
.table.compact { font-size: 13px; }
.table.compact th { padding: 9px 6px; font-size: 11.5px; }
.table.compact td { padding: 9px 6px; }
.table tr.clickable { cursor: pointer; transition: background .12s; }
.table tr.clickable:hover td { background: #FFF5F9; }
.table tr.clickable.selected td { background: var(--pink-1); }
.table tr.clickable.selected td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.table td.num, .table th.num { text-align: right; }
.table td.center, .table th.center { text-align: center; }
.table td.primary-cell b { white-space: nowrap; }
.row-act { position: relative; display: inline-flex; justify-content: center; }
.row-menu { position: absolute; right: 0; top: 100%; margin-top: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 170px; z-index: 50; overflow: hidden; text-align: left; }
.row-menu .dd-item { padding: 9px 13px; font-size: 13px; cursor: pointer; border-bottom: 1px solid #F7EDF2; }
.row-menu .dd-item:last-child { border-bottom: 0; }
.row-menu .dd-item:hover { background: var(--pink-1); }

.when { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.2; white-space: nowrap; }
.when b { font-weight: 600; font-size: 13px; }
.when span { font-size: 11.5px; color: var(--muted); }
.when.late b, .when.late span { color: var(--danger); }
.staff { font-size: 11.5px; color: var(--primary-dark); margin-top: 2px; white-space: nowrap; }

.status-wrap { position: relative; display: inline-flex; align-items: center; }
.status-pill { padding-right: 20px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9' viewBox='0 0 24 24' fill='none' stroke='%235C5059' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 7px center; }
.status-overlay { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; padding: 0; opacity: 0; cursor: pointer; border: 0; }
.status-wrap:hover .status-pill { filter: brightness(.95); }

.note-cell { min-width: 0; max-width: 115px; }
.note-wrap { display: flex; align-items: center; gap: 3px; }
.note-text { flex: 1; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-wrap .icon-btn { width: 22px; height: 22px; flex: none; color: var(--muted); }
.note-wrap .icon-btn svg { width: 13px; height: 13px; }
.ship-inline { display: flex; align-items: center; gap: 3px; max-width: 125px; }
.ship-txt { flex: 1; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ship-copy-btn { width: 22px; height: 22px; flex: none; color: var(--primary-dark); }
.ship-copy-btn svg { width: 13px; height: 13px; }
.settle-inline { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; white-space: nowrap; }

/* ---------- Return & Inspection ---------- */
.extra-row { display: grid; grid-template-columns: 1fr 160px 36px; gap: 8px; margin-bottom: 8px; }
.refund-cell { min-width: 0; }
.ord-money { text-align: right; }
.od-view { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.od-big { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 14px; background: var(--pink-1); cursor: zoom-in; }
.od-big.ph { display: grid; place-items: center; font-size: 28px; cursor: default; }
.od-cap { text-align: center; margin-top: 6px; font-size: 13px; color: var(--muted); }
.od-list { max-height: 440px; overflow-y: auto; }
.od-item { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 8px; }
.od-item[role=button] { cursor: pointer; }
.od-item.active { border-color: var(--primary); background: #FFFBFD; }
.ord-stack { display: flex; align-items: center; }
.ord-stack .thumb { width: 36px; height: 44px; border-radius: 8px; border: 2px solid #fff; font-size: 10px; }
.ord-stack > * + .thumb { margin-left: -12px; }
.ord-more { margin-left: 4px; font-size: 12px; font-weight: 600; color: var(--primary-dark); }
.pk-top { position: sticky; top: -16px; background: var(--surface); padding: 4px 0 10px; z-index: 2; }
.pk-dates { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
.pk-dates, .pk-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin-bottom: 8px; }
.pk-dates label { font-size: 12px; color: var(--muted); min-width: 0; }
.pk-dates input, .pk-filters > * { min-width: 0; width: 100%; }
.pk-filters { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr); margin-bottom: 0; }
.pk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.pk { position: relative; border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: 0 0 8px; text-align: left; cursor: pointer; font: inherit; overflow: hidden; display: flex; flex-direction: column; }
.pk > b, .pk > small { padding: 0 8px; } .pk > b { margin-top: 6px; } .pk > small { font-size: 11.5px; color: var(--muted); }
.pk-img { width: 100%; aspect-ratio: 3/4; object-fit: cover; background: var(--pink-1); display: grid; place-items: center; }
.pk-tick { position: absolute; right: 8px; top: 8px; width: 26px; height: 26px; border-radius: 50%; display: none; place-items: center; background: var(--primary); color: #fff; font-weight: 700; }
.pk.on { border-color: var(--primary); } .pk.on .pk-tick { display: grid; }
.pk:disabled { opacity: .5; cursor: not-allowed; }
.pk-more { grid-column: 1 / -1; }
.sec { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; background: #fff; }
.sec h3 { font-size: 15px; margin: 0 0 10px; }
.sec .ret-cond { display: flex; flex-wrap: wrap; gap: 8px; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.of-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.of-sum { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow-y: auto; }
.of-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; }
.of-bar [data-bar] { display: flex; flex-direction: column; line-height: 1.25; } .of-bar small { color: var(--muted); } .of-bar b { font-size: 17px; }
.of-item .row.between { flex-wrap: nowrap; align-items: flex-start; } .of-item .row.between > div { min-width: 0; }
.of-item { display: flex; gap: 12px; align-items: flex-start; } .of-item .grow { flex: 1; min-width: 0; }
.of-img { width: 64px; height: 84px; object-fit: cover; border-radius: 10px; flex: none; background: var(--pink-1); display: grid; place-items: center; }
.type-codes { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.acc-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 46px; gap: 8px; margin-bottom: 8px; } .acc-row .ferr { grid-column: 1 / -1; } .acc-row .btn { padding: 0; }
.sum-item { display: flex; gap: 8px; align-items: center; padding: 4px 0; } .sum-item .grow { flex: 1; min-width: 0; }
.sum-img { width: 32px; height: 42px; object-fit: cover; border-radius: 6px; flex: none; background: var(--pink-1); display: grid; place-items: center; font-size: 9px; }
.ferr { color: var(--danger); font-size: 13px; margin-top: 4px; font-weight: 600; }
.dep-big { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.dep-big .chip-radio span { display: flex; flex-direction: column; gap: 2px; border-radius: 14px; padding: 12px; width: 100%; text-align: center; }
.dep-big b { font-size: 15px; } .dep-big em { font-style: normal; font-weight: 700; font-size: 17px; color: var(--primary-dark); } .dep-big small { color: var(--muted); font-size: 11.5px; }
details.more summary { cursor: pointer; font-weight: 600; color: var(--primary-dark); min-height: 24px; }
.sum3 { background: #FFFBFD; position: sticky; bottom: 0; }
.ord-prods { display: flex; flex-direction: column; gap: 4px; }
.ord-prod { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.ord-prod .thumb { width: 40px; height: 48px; border-radius: 8px; font-size: 11px; }
.item-card > .ord-prod { float: left; margin-right: 10px; }
.item-card::after { content: ''; display: block; clear: both; }
.refund { color: #15803D; font-weight: 700; background: #DCFCE7; border-radius: 8px; padding: 2px 8px; display: inline-block; }
.refund.soft { background: transparent; color: #15803D; font-weight: 600; padding: 0; }
.owe { color: var(--danger); font-size: 12px; line-height: 1.3; display: inline-block; text-align: right; }
.owe b { font-size: 14px; }
.ret-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; }
.ret-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.ret-item.done { background: #FAFAFA; }
.ret-head { margin-bottom: 8px; }
.ret-cond { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip-radio input { display: none; }
.chip-radio span { display: inline-block; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; cursor: pointer; background: #fff; }
.chip-radio input:checked + span { background: var(--pink-2); border-color: var(--primary); color: var(--primary-dark); font-weight: 600; }
.ret-sum { background: #FFFBFD; border: 1px solid var(--pink-2); border-radius: 12px; padding: 12px; align-self: start; }
.ret-sum h4 { margin: 0 0 8px; }
.ret-result { display: flex; justify-content: space-between; align-items: center; border-radius: 10px; padding: 10px 12px; margin-top: 8px; font-weight: 600; }
.ret-result b { font-size: 18px; }
.ret-result.pos { background: #DCFCE7; color: #15803D; }
.ret-result.neg { background: #FEE2E2; color: #B91C1C; }
.extra-total { display: flex; justify-content: space-between; font-weight: 700; padding: 6px 0; border-top: 1px dashed var(--line); }
.empty { text-align: center; color: var(--muted); padding: 28px 10px; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding-top: 4px; gap: 8px; flex-wrap: wrap; }
.pager-btns { display: flex; align-items: center; gap: 4px; }
.page-btn { min-width: 32px; height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; display: inline-grid; place-items: center; transition: background .12s, border-color .12s; }
.page-btn:hover:not(:disabled) { background: var(--pink-1); border-color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn:disabled { opacity: .45; cursor: not-allowed; }
.page-dots { padding: 0 4px; color: var(--muted); font-size: 13px; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: #EFE9EC; color: #5C5059; }
.b-new { background: #E8EEFC; color: #3C5DAA; }
.b-prep { background: #FFF1DC; color: #A76A10; }
.b-out { background: var(--pink-2); color: var(--primary-dark); }
.b-due { background: #FFE9CC; color: #A55E00; }
.b-late { background: #FBE1E4; color: #B5303F; }
.b-back { background: #E6F0FF; color: #3C5DAA; }
.b-done { background: #E3F3EB; color: #2F7A56; }
.b-cancel { background: #EEE; color: #888; text-decoration: line-through; }
.b-ok { background: #E3F3EB; color: #2F7A56; }
.b-warn { background: #FFF1DC; color: #A76A10; }
.b-bad { background: #FBE1E4; color: #B5303F; }

/* ---------- Modal, Toast & Loading ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(57, 49, 58, .42); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 18px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 24px 64px rgba(32, 20, 28, .22); animation: pop .16s ease-out; }
.modal.lg { max-width: 860px; }
.modal-head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.ord-sum { margin-bottom: 12px; }
@media (min-width: 1100px) { .ord-sum { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.ord-sum .kpi { padding: 10px 12px; }
.ord-sum .value { font-size: 16px; white-space: nowrap; }
.chip [data-cnt] { opacity: .65; }
.od-next .btn-block { font-size: 17px; padding: 14px; margin-top: 8px; min-height: 52px; white-space: normal; }
.od-more { margin-top: 10px; }
.od-more summary { cursor: pointer; color: var(--muted); font-weight: 600; padding: 6px 0; }
.od-more .row { flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip[data-days].active { background: var(--primary); color: #fff; border-color: var(--primary); }
#outbox-pill { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 90; border: 0; border-radius: 20px; padding: 7px 14px; font: inherit; font-size: 13px; font-weight: 600; color: #fff; background: var(--text); cursor: pointer; white-space: nowrap; }
#outbox-pill.net { background: #B26A00; }
#outbox-pill.bad { background: #C0392B; }
#money-tip { position: fixed; z-index: 300; display: none; padding: 3px 9px; border-radius: 8px; background: var(--text); color: #fff; font-size: 13px; font-weight: 600; pointer-events: none; }
.toast { background: var(--text); color: #fff; padding: 11px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 14px; max-width: 380px; animation: fade .2s; }
.toast.success { background: var(--success); } .toast.error { background: var(--danger); } .toast.warning { background: #C9862A; }
.loading-bar { position: fixed; top: 0; left: 0; height: 3px; background: var(--primary); z-index: 300; width: 0; transition: width .3s; }
.spinner { width: 24px; height: 24px; border: 3px solid var(--pink-2); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Order Form & Details ---------- */
.steps { display: flex; gap: 8px; margin-bottom: 14px; }
.step { flex: 1; padding: 10px 12px; border-radius: 11px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; display: flex; gap: 8px; align-items: center; transition: border-color .15s, background .15s; }
.step:hover { border-color: var(--primary); }
.step .n { width: 22px; height: 22px; border-radius: 50%; background: var(--pink-1); display: grid; place-items: center; font-size: 12px; flex: none; }
.step.active { border-color: var(--primary); color: var(--primary-dark); background: #FFFBFD; } .step.active .n { background: var(--primary); color: #fff; }
.step.done .n { background: var(--success); color: #fff; }
.item-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: #FFFCFE; }
.item-card.conflict { border-color: var(--danger); background: #FFF6F7; }
.prod-mini { display: flex; gap: 10px; align-items: center; }
.prod-mini img, .thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 10px; background: var(--pink-1); flex: none; }
.thumb-lg { width: 100%; max-width: 280px; aspect-ratio: 3/4; object-fit: cover; border-radius: 14px; background: var(--pink-1); }
.ph { display: grid; place-items: center; color: var(--primary); font-weight: 700; }
.alert { padding: 10px 12px; border-radius: 10px; font-size: 13px; margin: 8px 0; }
.alert-danger { background: #FBE7E9; color: #A3303D; } .alert-warning { background: #FFF1DC; color: #8E5A0C; } .alert-info { background: #EEF2FD; color: #3C5DAA; } .alert-success { background: #E3F3EB; color: #2F7A56; }
.summary-line { display: flex; justify-content: space-between; padding: 5px 0; gap: 12px; }
.summary-line.total { border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 10px; font-weight: 700; font-size: 16px; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(to top, var(--bg) 70%, transparent); padding: 12px 0 4px; display: flex; gap: 8px; justify-content: flex-end; z-index: 5; }
.timeline { border-left: 2px solid var(--pink-2); margin-left: 6px; padding-left: 14px; }
.timeline .t { position: relative; padding-bottom: 12px; }
.timeline .t::before { content: ''; position: absolute; left: -20px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.qr-box { display: inline-block; padding: 10px; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
.qr-box img, .qr-box canvas { display: block; }
.transfer { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.transfer .info { font-size: 13px; line-height: 1.6; }

/* ---------- Calendar & Agenda ---------- */
.gantt { overflow-x: auto; }
.gantt table { border-collapse: collapse; min-width: 100%; }
.gantt th, .gantt td { border: 1px solid var(--line); font-size: 11px; padding: 0; height: 30px; min-width: 34px; text-align: center; }
.gantt th.p, .gantt td.p { position: sticky; left: 0; background: var(--surface); text-align: left; padding: 0 8px; min-width: 110px; font-weight: 600; z-index: 1; }
.gantt td.busy { background: var(--primary); color: #fff; cursor: pointer; }
.gantt td.busy.late { background: var(--danger); } .gantt td.busy.done { background: #B9D9C8; }
.gantt th.today, .gantt td.today { outline: 2px solid var(--warning); outline-offset: -2px; }
.fc { --fc-border-color: var(--line); --fc-button-bg-color: var(--primary); --fc-button-border-color: var(--primary); --fc-button-hover-bg-color: var(--primary-dark); --fc-button-active-bg-color: var(--primary-dark); --fc-today-bg-color: #FFF3F8; font-size: 13px; }
.fc .fc-toolbar-title { font-size: 17px; }

.agenda-nav { display: flex; align-items: center; gap: 6px; margin: 4px 0 12px; }
.agenda-nav .icon-btn { font-size: 22px; color: var(--muted); flex: none; }
.agenda-week { flex: 1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.aday { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; font: inherit; color: var(--text); transition: border-color .15s, background .15s; }
.aday:hover { border-color: var(--primary); }
.aday .dn { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.aday b { font-size: 14px; }
.aday .cnt { display: flex; gap: 4px; min-height: 18px; }
.aday .cnt i { font-style: normal; font-size: 11px; font-weight: 700; border-radius: 9px; padding: 0 6px; line-height: 18px; }
.aday .cnt i.o { background: var(--pink-2); color: var(--primary-dark); }
.aday .cnt i.r { background: #E6F0FF; color: #3C5DAA; }
.aday .cnt i.z { color: var(--line); }
.aday.today { border-color: var(--primary); }
.aday.sel { background: var(--primary); border-color: var(--primary); color: #fff; }
.aday.sel .dn { color: rgba(255, 255, 255, .85); }
.agenda-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.asec { min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 4px 12px 8px; }
.ahead { font-weight: 700; padding: 8px 0; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.ahead span { font-size: 12px; font-weight: 700; border-radius: 10px; padding: 0 8px; line-height: 20px; }
.ahead.o span { background: var(--pink-2); color: var(--primary-dark); }
.ahead.r span { background: #E6F0FF; color: #3C5DAA; }
.arow { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #F7EEF2; cursor: pointer; }
.arow:last-child { border-bottom: 0; }
.arow:hover { background: #FFFBFD; }
.arow .t { font-weight: 700; width: 44px; flex: none; font-variant-numeric: tabular-nums; }
.arow .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.arow .m { flex: 1; min-width: 0; overflow: hidden; white-space: normal; }
.arow .m small { color: var(--muted); margin-left: 6px; }
.arow .ship-line { display: block; font-size: 12.5px; color: var(--text); margin-top: 2px; }
.aempty { padding: 12px 0; }

/* ---------- Delivery address ---------- */
.ship-box { background: #FFFBFD; border: 1px solid var(--pink-2); border-radius: 12px; padding: 12px; }
.ship-cell { min-width: 0; max-width: 130px; }
.ship-m { font-size: 11.5px; color: var(--muted); }
.ship-a { font-size: 12.5px; line-height: 1.35; white-space: normal; }
.ship-a.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ship-copy { font-size: 11.5px; display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; }
.ship-copy svg { width: 12px; height: 12px; }


@media (max-width: 1100px) {
  .ret-grid { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis-ops { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis-fin { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* ---------- Mobile (SRS §17.2) ---------- */
@media (max-width: 860px) {
  body { font-size: 15px; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  .backdrop.open { display: block; position: fixed; inset: 0; background: rgba(57,49,58,.35); z-index: 35; }
  .main { margin-left: 0; }
  .menu-btn { display: grid; }
  .header { padding: 0 10px; gap: 6px; }
  .header .today, .user-chip .meta { display: none; }
  .user-chip { padding: 3px; }
  .header .search { max-width: none; }
  .content { padding: 14px 14px 110px; }
  .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .od-view { grid-template-columns: minmax(0, 1fr); }
  .od-photo { max-width: 260px; margin: 0 auto; width: 100%; }
  .od-list { max-height: none; }
  .kpis, .kpis-ops, .kpis-fin { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .value { font-size: 19px; }
  h1 { font-size: 19px; }
  .page-actions .btn { flex: 1; }
  .kv { grid-template-columns: 110px 1fr; }
  .filters input[type=search] { min-width: 0; width: 100%; }
  .filters > select { flex: 1; }
  /* Tables become card lists – no horizontal scrolling for key info */
  table.table.cards thead { display: none; }
  table.table.cards, table.table.cards tbody, table.table.cards tr, table.table.cards td { display: block; width: 100%; }
  table.table.cards tr { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; padding: 10px 12px; box-shadow: var(--shadow-sm); }
  table.table.cards td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 10px; text-align: right; }
  table.table.cards td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: none; }
  table.table.cards td[data-label=""]::before { content: none; }
  table.table.cards .when { flex-direction: row; gap: 6px; }
  table.table.cards .note-cell { max-width: none; }
  table.table.cards .ship-cell { max-width: none; }
  table.table.cards td.ship-cell, table.table.cards .ship { text-align: right; }
  table.table.cards td.primary-cell { font-size: 15px; font-weight: 600; justify-content: flex-start; text-align: left; }
  .card { padding: 14px; }
  .steps .step span.l { display: none; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { border-radius: 18px 18px 0 0; max-height: 92vh; }
  .sticky-actions { position: fixed; left: 0; right: 0; bottom: 64px; padding: 10px 16px; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(0,0,0,.06); }
  .sticky-actions .btn { flex: 1; }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: 64px; background: var(--surface); border-top: 1px solid var(--line); z-index: 45; padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: var(--muted); font-weight: 600; }
  .bottom-nav a svg { width: 22px; height: 22px; }
  .bottom-nav a.active { color: var(--primary-dark); }
  .bottom-nav a:hover { text-decoration: none; }
  .bottom-nav .create { position: relative; top: -16px; }
  .bottom-nav .create span.c { width: 54px; height: 54px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(216,107,155,.45); }
  .bottom-nav .create span.c svg { width: 26px; height: 26px; }
  .toasts { bottom: 76px; left: 16px; right: 16px; }
  .dropdown { right: 8px; left: 8px; width: auto; }
}
@media (max-width: 860px) {
  .agenda-nav { gap: 2px; } .agenda-nav .icon-btn { width: 26px; }
  .agenda-week { gap: 3px; } .aday { padding: 6px 0; border-radius: 10px; min-width: 0; } .aday b { font-size: 15px; } .aday .mo { display: none; }
  .aday .cnt i { padding: 0 4px; }
  .agenda-cols { grid-template-columns: minmax(0, 1fr); }
  .arow .m small { display: block; margin-left: 0; }
  .arow .badge { display: none; }
}
/* ---------- Phone: touch targets, no iOS zoom, safe areas (desktop untouched) ---------- */
@media (max-width: 860px) {
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px; min-height: 44px; }
  .btn, .btn-sm { min-height: 42px; }
  .btn-sm { padding: 8px 12px; font-size: 14px; }
  .chip { min-height: 40px; padding: 8px 14px; display: inline-flex; align-items: center; }
  .chip-radio span { padding: 10px 14px; font-size: 14px; }
  .icon-btn { min-width: 42px; min-height: 42px; }
  .ship-copy-btn { width: 42px; height: 42px; margin: -8px 0; }
  .ship-copy { display: inline-flex; align-items: center; min-height: 42px; font-size: 14px; }
  .status-overlay { font-size: 16px; min-height: 44px; }
  input[type=month] { min-height: 42px !important; }
  input[type=checkbox] { width: 20px; height: 20px; }
  input[type=date], input[type=datetime-local], input[type=time], input[type=month] { min-width: 0; -webkit-appearance: none; appearance: none; text-align: left; }
  .extra-row { grid-template-columns: minmax(0, 1fr) 110px 44px; }
  .modal { max-height: 94dvh; width: 100%; }
  .modal-body { overscroll-behavior: contain; flex: 1 1 auto; min-height: 0; }
  .modal-foot { position: sticky; bottom: 0; background: var(--surface); padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; min-height: 46px; }
  .modal-head .icon-btn { margin: -6px -8px -6px 0; }
  .bottom-nav { height: calc(64px + env(safe-area-inset-bottom)); }
  .bottom-nav a { min-height: 44px; }
  .sticky-actions { bottom: calc(64px + env(safe-area-inset-bottom)); }
  .content { padding-bottom: calc(120px + env(safe-area-inset-bottom)); }
  .page-actions { flex-wrap: wrap; }
  .of-grid { grid-template-columns: minmax(0, 1fr); }
  .of-sum { position: static; max-height: none; }
  .of-bar .btn { flex: none; min-width: 150px; }
  #of .pair:has(input[type=datetime-local]) { grid-template-columns: minmax(0, 1fr); }
  .pk-dates { grid-template-columns: minmax(0, 1fr) !important; gap: 4px; }
  .pk-top { position: static; }
  .pk-filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .pk-filters input { grid-column: 1 / -1; }
  .pk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pk-dates input { padding: 8px 6px; font-size: 14px; }
  table.table.cards td:empty { display: none; }
  .filters input[type=search] { flex: 1 1 100%; }
  .sticky-actions { padding-bottom: 20px; }
  .table.cards tr.clickable { cursor: pointer; }
}
@media (max-width: 400px) {
  .content { padding-left: 10px; padding-right: 10px; }
  .kv { grid-template-columns: 92px 1fr; }
  .kpi .value { font-size: 17px; }
}
@media print {
  body * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area { position: absolute; left: 0; top: 0; }
}
.page-back { display: none; }
@media (max-width: 860px) { .page-back { display: inline-flex; align-items: center; border: 0; background: none; color: var(--primary-dark); font: inherit; font-weight: 600; padding: 8px 12px 8px 0; min-height: 44px; cursor: pointer; } .page-back + .breadcrumb { display: none; } }

