*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy: #0B1D35;
  --navy-2: #122540;
  --navy-3: #1B3254;
  --gold: #D4A017;
  --gold-2: #F0BC2E;
  --white: #FFFFFF;
  --off: #F7F8FC;
  --border: #E8ECF4;
  --text: #1A2332;
  --muted: #64748B;
  --red: #E53E3E;
  --green: #38A169;
  --blue: #3182CE;
  --orange: #DD6B20;
  --purple: #805AD5;
  --shadow: 0 2px 12px rgba(0, 0, 0, .08);
  --shadow-md: 0 4px 24px rgba(0, 0, 0, .12);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, .16);
  --sidebar-w: 246px;
  --topbar-h: 62px;
  --font-display: 'Barlow Condensed', sans-serif;
  --font-body: 'Inter', sans-serif;
}

html, body { height: 100%; }
body { font-family: var(--font-body); background: var(--off); color: var(--text); font-size: 14px; }
button, input, select, textarea { font-family: inherit; }
[hidden] { display: none !important; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--navy); }

/* Loader */

.app-loader { position: fixed; inset: 0; background: var(--navy); z-index: 10000; display: flex; flex-direction: column; align-items: center; justify-content: center; transition: opacity .25s; }
.app-loader.is-done { opacity: 0; pointer-events: none; }
.spinner { width: 40px; height: 40px; border: 3px solid rgba(255, 255, 255, .15); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; margin-top: 16px; }
.spinner--dark { border-color: var(--border); border-top-color: var(--navy); width: 28px; height: 28px; margin: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

.brand { font-family: var(--font-display); font-weight: 900; color: var(--gold); text-transform: uppercase; line-height: 1; letter-spacing: .3px; }
.brand b { color: #fff; display: block; }
.brand-sub { font-size: 10px; color: rgba(255, 255, 255, .4); text-transform: uppercase; letter-spacing: 2px; margin-top: 6px; }

/* Buttons */

a.btn { text-decoration: none; }
.btn { font-size: 13px; font-weight: 700; border: none; border-radius: 8px; padding: 10px 18px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .15s, color .15s, border-color .15s; white-space: nowrap; }
.btn i { font-size: 16px; line-height: 1; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--gold); color: var(--navy); }
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-gold:hover { background: var(--gold-2); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: #2F855A; }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: #C53030; }
.btn-ghost { background: #fff; color: var(--text); border: 1.5px solid var(--border); }
.btn-ghost:hover { border-color: var(--navy); color: var(--navy); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: 7px; }
.btn:disabled { background: #CBD5E1 !important; color: #94A3B8 !important; border-color: #CBD5E1 !important; cursor: not-allowed; }
.btn.is-busy { pointer-events: none; opacity: .7; }

/* Forms */

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.field > label .req { color: var(--red); }
.input, .field input, .field select, .field textarea { width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 9px; font-size: 13px; outline: none; transition: border-color .15s, box-shadow .15s; background: #fff; color: var(--text); }
.field textarea { resize: vertical; min-height: 70px; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(11, 29, 53, .06); }
.field input:disabled, .field select:disabled { background: var(--off); color: var(--muted); }
.field .hint { font-size: 11px; color: var(--muted); }
.field.has-error input, .field.has-error select { border-color: var(--red); }
.field .error { font-size: 11px; color: var(--red); font-weight: 600; }
.input-prefix { position: relative; }
.input-prefix span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 12px; font-weight: 700; pointer-events: none; }
.input-prefix input { padding-left: 40px; }

.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }
.col-12 { grid-column: span 12; } .col-8 { grid-column: span 8; } .col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; } .col-2 { grid-column: span 2; }

.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; user-select: none; }
.check small { display: block; color: var(--muted); font-size: 11px; }

.toggle { position: relative; display: inline-block; width: 38px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle span { position: absolute; cursor: pointer; inset: 0; background: #CBD5E1; transition: .25s; border-radius: 22px; }
.toggle span::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .25s; box-shadow: 0 1px 4px rgba(0, 0, 0, .2); }
.toggle input:checked + span { background: var(--green); }
.toggle input:checked + span::before { transform: translateX(16px); }
.toggle input:disabled + span { opacity: .5; cursor: not-allowed; }

.segmented { display: inline-flex; background: var(--off); border: 1.5px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; }
.segmented button { border: none; background: transparent; padding: 7px 14px; border-radius: 6px; font-size: 12px; font-weight: 700; color: var(--muted); cursor: pointer; }
.segmented button.is-active { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

/* Badges and pills */

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 99px; text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; }
.badge-ok { background: #F0FFF4; color: #276749; border: 1px solid #9AE6B4; }
.badge-warn { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }
.badge-err { background: #FFF5F5; color: #C53030; border: 1px solid #FED7D7; }
.badge-info { background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE; }
.badge-purple { background: #FAF5FF; color: #6B46C1; border: 1px solid #E9D8FD; }
.badge-gray { background: var(--off); color: var(--muted); border: 1px solid var(--border); }

.pill-cost { background: #FFF7ED; color: #C05621; border: 1px solid #FED7AA; border-radius: 6px; padding: 2px 8px; font-size: 13px; font-weight: 700; font-family: var(--font-display); white-space: nowrap; }
.pill-price { background: #F0FFF4; color: #276749; border: 1px solid #9AE6B4; border-radius: 6px; padding: 2px 8px; font-size: 13px; font-weight: 700; font-family: var(--font-display); white-space: nowrap; }
.pill-margin { background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE; border-radius: 99px; padding: 2px 8px; font-size: 11px; font-weight: 700; }
.pill-margin.is-low { background: #FFF5F5; color: #C53030; border-color: #FED7D7; }

.code { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-size: 11px; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.qty { font-family: var(--font-display); font-size: 16px; font-weight: 800; color: var(--navy); }
.qty.is-neg { color: var(--red); }
.qty.is-pos { color: var(--green); }
.muted { color: var(--muted); }
.text-sm { font-size: 12px; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }

/* Cards */

.card { background: #fff; border-radius: 14px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-title { font-family: var(--font-display); font-size: 17px; font-weight: 900; color: var(--navy); text-transform: uppercase; }
.card-body { padding: 18px; }

/* Login */

.login { min-height: 100vh; background: var(--navy); display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; padding: 16px; }
.login::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 25% 40%, rgba(212, 160, 23, .10) 0%, transparent 55%), radial-gradient(ellipse at 80% 70%, rgba(212, 160, 23, .06) 0%, transparent 55%); }
.login::after { content: ''; position: absolute; inset: 0; background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .018) 0 2px, transparent 2px 22px); }
.login-box { position: relative; z-index: 2; width: 100%; max-width: 410px; }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .brand { font-size: 46px; }
.login-card { background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1); border-radius: 16px; padding: 26px; display: flex; flex-direction: column; gap: 14px; backdrop-filter: blur(4px); }
.login-card .field > label { color: rgba(255, 255, 255, .55); }
.login-card .field input { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .12); color: #fff; padding: 12px 14px; font-size: 14px; }
.login-card .field input:focus { border-color: var(--gold); box-shadow: none; }
.login-card .field input::placeholder { color: rgba(255, 255, 255, .3); }
.login-error { background: rgba(229, 62, 62, .15); border: 1px solid rgba(229, 62, 62, .3); border-radius: 8px; padding: 10px 14px; font-size: 12px; color: #FCA5A5; }
.login-submit { width: 100%; background: var(--gold); color: var(--navy); border: none; padding: 14px; border-radius: 10px; font-family: var(--font-display); font-size: 20px; font-weight: 900; text-transform: uppercase; cursor: pointer; transition: background .2s; margin-top: 4px; }
.login-submit:hover { background: var(--gold-2); }
.login-submit:disabled { opacity: .6; cursor: wait; }
.login-foot { text-align: center; color: rgba(255, 255, 255, .3); font-size: 11px; margin-top: 18px; }

/* Shell */

.shell { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: var(--sidebar-w); min-width: var(--sidebar-w); background: var(--navy); display: flex; flex-direction: column; height: 100vh; overflow-y: auto; z-index: 50; }
.sidebar-logo { padding: 20px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.sidebar-logo .brand { font-size: 25px; }
.nav { padding: 10px 0; flex: 1; }
.nav-group { font-size: 9px; font-weight: 800; letter-spacing: 2px; color: rgba(255, 255, 255, .25); text-transform: uppercase; padding: 14px 20px 4px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 10px 20px; color: rgba(255, 255, 255, .6); font-size: 13px; font-weight: 500; text-decoration: none; transition: background .2s, color .2s; border-left: 3px solid transparent; }
.nav-item:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.nav-item.is-active { background: rgba(212, 160, 23, .12); color: var(--gold); border-left-color: var(--gold); }
.nav-item i { font-size: 17px; width: 18px; text-align: center; }
.nav-badge { margin-left: auto; font-size: 10px; background: var(--red); color: #fff; border-radius: 10px; padding: 1px 7px; font-weight: 700; }
.nav-badge.is-gold { background: var(--gold); color: var(--navy); }
.sidebar-user { padding: 14px 20px; border-top: 1px solid rgba(255, 255, 255, .07); display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--gold); color: var(--navy); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 15px; font-weight: 900; flex-shrink: 0; text-transform: uppercase; }
.sidebar-user .name { font-size: 13px; font-weight: 600; color: #fff; }
.sidebar-user .role { font-size: 10px; color: rgba(255, 255, 255, .4); }
.sidebar-user button { margin-left: auto; background: rgba(255, 255, 255, .1); border: none; color: rgba(255, 255, 255, .6); width: 30px; height: 30px; border-radius: 6px; cursor: pointer; font-size: 15px; display: flex; align-items: center; justify-content: center; transition: background .2s, color .2s; flex-shrink: 0; }
.sidebar-user button:hover { background: rgba(220, 38, 38, .4); color: #fff; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.topbar { background: #fff; border-bottom: 1px solid var(--border); padding: 0 24px; height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; gap: 12px; box-shadow: 0 1px 4px rgba(0, 0, 0, .05); flex-shrink: 0; }
.crumb { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.crumb strong { color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-date { font-size: 12px; color: var(--muted); }
.menu-toggle { display: none; border: none; background: var(--off); width: 36px; height: 36px; border-radius: 8px; font-size: 20px; cursor: pointer; color: var(--navy); }
.content { flex: 1; overflow-y: auto; padding: 24px; }
.scrim { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-title { font-family: var(--font-display); font-size: 26px; font-weight: 900; color: var(--navy); text-transform: uppercase; line-height: 1.1; }
.page-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Stats */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: flex; gap: 12px; align-items: center; }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0; }
.tone-blue { background: #EFF6FF; color: #1D4ED8; }
.tone-orange { background: #FFF7ED; color: #C05621; }
.tone-purple { background: #F5F3FF; color: #6B46C1; }
.tone-green { background: #F0FFF4; color: #276749; }
.tone-red { background: #FFF5F5; color: #C53030; }
.tone-gold { background: #FFFBEB; color: #B7791F; }
.stat-value { font-family: var(--font-display); font-size: 24px; font-weight: 900; color: var(--navy); line-height: 1.1; }
.stat-label { font-size: 11px; color: var(--muted); margin-top: 2px; }
a.stat { text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
a.stat:hover { border-color: var(--navy); transform: translateY(-1px); }

/* Tables */

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 220px; }
.search input { width: 100%; padding: 10px 12px 10px 38px; border: 1.5px solid var(--border); border-radius: 9px; font-size: 13px; outline: none; background: #fff; }
.search input:focus { border-color: var(--navy); }
.search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 16px; }
.toolbar select { padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 9px; font-size: 13px; outline: none; background: #fff; max-width: 220px; }

.table-wrap { background: #fff; border-radius: 14px; border: 1px solid var(--border); overflow: hidden; box-shadow: var(--shadow); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; padding: 11px 12px; border-bottom: 2px solid var(--border); background: var(--off); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr.is-clickable { cursor: pointer; }
tbody tr.is-clickable:hover td { background: #FAFBFE; }
tr.is-inactive td { opacity: .55; }
.table-foot { padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); gap: 10px; flex-wrap: wrap; }
.pager { display: flex; gap: 6px; align-items: center; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.pcell { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.thumb { width: 42px; height: 42px; border-radius: 8px; background: var(--off); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 19px; color: #A0AEC0; flex-shrink: 0; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.pcell-name { font-weight: 600; font-size: 13px; color: var(--navy); }
.pcell-meta { font-size: 11px; color: var(--muted); margin-top: 1px; }

.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty i { font-size: 38px; color: #CBD5E1; display: block; margin-bottom: 10px; }
.empty strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.loading-row { padding: 40px; display: flex; justify-content: center; }

/* Tabs */

.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab { border: none; background: transparent; padding: 10px 14px; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.tab:hover { color: var(--navy); }
.tab.is-active { color: var(--navy); border-bottom-color: var(--gold); }
.tab .count { background: var(--off); border-radius: 99px; padding: 0 7px; font-size: 11px; }

/* Modal */

.modal-overlay { position: fixed; inset: 0; background: rgba(11, 29, 53, .55); z-index: 3000; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade-in .15s; }
.modal { background: #fff; border-radius: 16px; width: 540px; max-width: 100%; max-height: 92vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: rise .18s ease-out; }
.modal.is-wide { width: 960px; }
.modal.is-medium { width: 720px; }
.modal-head { background: var(--navy); padding: 16px 22px; display: flex; align-items: center; justify-content: space-between; border-radius: 16px 16px 0 0; flex-shrink: 0; gap: 12px; }
.modal-head h3 { font-family: var(--font-display); font-size: 20px; font-weight: 900; color: #fff; text-transform: uppercase; }
.modal-head .sub { font-size: 12px; color: rgba(255, 255, 255, .5); margin-top: 2px; }
.modal-close { background: rgba(255, 255, 255, .15); border: none; color: #fff; width: 32px; height: 32px; border-radius: 6px; cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.modal-close:hover { background: rgba(255, 255, 255, .25); }
.modal-body { padding: 20px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; flex-shrink: 0; background: #fff; border-radius: 0 0 16px 16px; }
.modal-foot .spacer { flex: 1; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.section-label { font-family: var(--font-display); font-size: 15px; font-weight: 900; color: var(--navy); text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.section-label i { color: var(--gold); font-size: 17px; }
.section-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.notice { border-radius: 10px; padding: 11px 14px; font-size: 12px; display: flex; gap: 10px; align-items: flex-start; line-height: 1.5; }
.notice i { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.notice-info { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }
.notice-warn { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }
.notice-err { background: #FFF5F5; color: #9B2C2C; border: 1px solid #FED7D7; }

/* Presentation rows in the product form */

.pres-list { display: flex; flex-direction: column; gap: 10px; }
.pres { border: 1.5px solid var(--border); border-radius: 12px; padding: 14px; background: #FCFDFF; }
.pres.is-base { border-color: rgba(212, 160, 23, .55); background: #FFFDF5; }
.pres-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.pres-head .title { font-weight: 700; color: var(--navy); font-size: 13px; }
.pres-head .actions { margin-left: auto; display: flex; gap: 6px; }
.pres-grid { display: grid; grid-template-columns: 2fr 1.2fr 1fr 1fr 1fr 1fr; gap: 10px; }
.pres-foot { display: flex; gap: 10px; margin-top: 10px; align-items: flex-end; flex-wrap: wrap; }
.pres-equiv { font-size: 11px; color: var(--muted); margin-top: 8px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag { display: inline-flex; align-items: center; gap: 6px; background: var(--off); border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px 4px 9px; font-size: 12px; font-family: ui-monospace, Menlo, monospace; }
.tag button { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; }
.tag button:hover { color: var(--red); }

.image-drop { width: 120px; height: 120px; border: 2px dashed var(--border); border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); font-size: 11px; cursor: pointer; overflow: hidden; position: relative; background: var(--off); flex-shrink: 0; }
.image-drop:hover { border-color: var(--navy); color: var(--navy); }
.image-drop i { font-size: 26px; }
.image-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* Line editor (transfers, receipts, adjustments) */

.lines td { padding: 8px 10px; }
.lines input { width: 100%; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 13px; outline: none; }
.lines input:focus { border-color: var(--navy); }
.lines .w-qty { width: 120px; }
.lines .w-money { width: 140px; }
.lines-total { display: flex; justify-content: flex-end; gap: 28px; padding: 12px 4px 0; font-size: 13px; }
.lines-total strong { font-family: var(--font-display); font-size: 20px; color: var(--navy); }

.picker { position: relative; }
.picker-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-md); max-height: 280px; overflow-y: auto; z-index: 20; }
.picker-item { padding: 9px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; font-size: 13px; border-bottom: 1px solid var(--off); }
.picker-item:last-child { border-bottom: none; }
.picker-item:hover, .picker-item.is-active { background: #F5F8FF; }
.picker-item .meta { color: var(--muted); font-size: 11px; }

/* Permission matrix */

.perm-columns { columns: 2 320px; column-gap: 16px; }
.perm-group { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; break-inside: avoid; margin-bottom: 16px; }
.perm-group-head { background: var(--off); padding: 9px 14px; font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.perm-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 14px; border-top: 1px solid var(--border); font-size: 13px; gap: 10px; }
.perm-row .src { font-size: 10px; color: var(--muted); }
.perm-row .src.is-custom { color: var(--orange); font-weight: 700; }
.perm-matrix th, .perm-matrix td { text-align: center; }
.perm-matrix th:first-child, .perm-matrix td:first-child { text-align: left; }
.perm-matrix .yes { color: var(--green); font-size: 17px; }
.perm-matrix .no { color: #CBD5E1; }

/* Count screen */

.scan-box { display: flex; gap: 10px; align-items: center; background: var(--navy); border-radius: 14px; padding: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.scan-box i.lead { color: var(--gold); font-size: 26px; }
.scan-box input { flex: 1; min-width: 200px; padding: 13px 16px; font-size: 16px; border-radius: 10px; border: none; outline: none; font-family: ui-monospace, Menlo, monospace; }
.scan-box .hint { color: rgba(255, 255, 255, .5); font-size: 12px; width: 100%; }
.progress { height: 8px; background: var(--off); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--gold); transition: width .3s; }
.diff-pos { color: var(--green); font-weight: 700; }
.diff-neg { color: var(--red); font-weight: 700; }
td input.count-input { width: 110px; padding: 7px 9px; border: 1.5px solid var(--border); border-radius: 7px; text-align: right; font-size: 13px; }
td input.count-input:focus { border-color: var(--navy); outline: none; }
tr.is-flash td { animation: flash 1s; }
@keyframes flash { from { background: #FEF3C7; } }

/* Toast */

.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow-lg); max-width: 380px; animation: rise .2s ease-out; }
.toast i { font-size: 18px; }
.toast.is-ok { background: #276749; }
.toast.is-warn { background: #C05621; }
.toast.is-err { background: #9B2C2C; }

/* Detail lists */

.dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.dl div span { display: block; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 3px; }
.dl div strong { font-size: 14px; color: var(--text); font-weight: 600; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

@media (max-width: 1100px) {
  .pres-grid { grid-template-columns: 1fr 1fr 1fr; }
}

@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .25s; }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 40; }
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .topbar-date { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .col-8, .col-6, .col-4, .col-3, .col-2 { grid-column: span 12; }
  .modal-overlay { padding: 0; align-items: stretch; }
  .modal, .modal.is-wide, .modal.is-medium { width: 100%; max-height: 100vh; border-radius: 0; }
  .modal-head { border-radius: 0; }
  .modal-foot { border-radius: 0; }
}

@media (max-width: 560px) {
  .pres-grid { grid-template-columns: 1fr 1fr; }
  .toolbar select { max-width: none; flex: 1 1 140px; }
  .stat-value { font-size: 20px; }
  .page-title { font-size: 22px; }
  .stats { grid-template-columns: 1fr 1fr; }
}

.field > label.check { text-transform: none; font-size: 13px; font-weight: 500; color: var(--text); letter-spacing: 0; }
.field > label.check small { text-transform: none; font-weight: 400; letter-spacing: 0; }

/* Point of sale */

.pos { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.pos-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pos-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.pos-search { position: relative; }
.pos-search > i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 22px; color: var(--gold); pointer-events: none; }
.pos-search input { width: 100%; padding: 15px 16px 15px 50px; font-size: 16px; border: 2px solid var(--navy); border-radius: 12px; outline: none; background: #fff; }
.pos-search input:focus { box-shadow: 0 0 0 4px rgba(212, 160, 23, .25); }
.pos-search .picker-results { max-height: 380px; }
.pos-lines { min-height: 320px; }
.pos-lines td input.is-error { border-color: var(--red); background: #FFF5F5; }
.pos-side { position: sticky; top: 0; display: flex; flex-direction: column; overflow: visible; }
.pos-section { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.pos-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; }
.pos-customer { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; background: var(--off); border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.pos-totals { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.row-between { display: flex; justify-content: space-between; gap: 10px; }
.pos-grand { display: flex; justify-content: space-between; align-items: baseline; border-top: 2px solid var(--navy); margin-top: 6px; padding-top: 10px; font-family: var(--font-display); font-weight: 900; text-transform: uppercase; color: var(--navy); }
.pos-grand span:last-child { font-size: 32px; }
.pos-side .notice { margin: 0 16px 12px; }
.pos-actions { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.pos-pay { padding: 16px; font-family: var(--font-display); font-size: 21px; font-weight: 900; text-transform: uppercase; }
.kbd { font-family: ui-monospace, Menlo, monospace; font-size: 10px; font-weight: 700; background: rgba(11, 29, 53, .12); border-radius: 4px; padding: 1px 5px; }
.btn-ghost .kbd, .btn-primary .kbd { background: rgba(255, 255, 255, .2); }

.pay-total { display: flex; justify-content: space-between; align-items: baseline; background: var(--navy); color: #fff; border-radius: 12px; padding: 14px 18px; }
.pay-total span { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: rgba(255, 255, 255, .6); }
.pay-total strong { font-family: var(--font-display); font-size: 30px; color: var(--gold); }
.pay-row { display: grid; grid-template-columns: 150px 1fr 1fr 34px; gap: 8px; align-items: center; }
.pay-row .input { padding: 10px 12px; }
.pay-row .input-prefix input { padding-left: 42px; }
.pay-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pay-summary div { background: var(--off); border-radius: 10px; padding: 10px 12px; }
.pay-summary span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; font-weight: 700; }
.pay-summary strong { font-family: var(--font-display); font-size: 20px; color: var(--navy); }
.pay-summary .change { background: #F0FFF4; }
.pay-summary .change strong { color: #276749; }

.receipt-done { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0; }
.receipt-done > i { font-size: 56px; color: var(--green); }
.receipt-change { font-size: 15px; background: #F0FFF4; color: #276749; border-radius: 10px; padding: 8px 16px; }
.receipt-change strong { font-family: var(--font-display); font-size: 24px; }

.denoms { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.denom { display: grid; grid-template-columns: 74px 84px 1fr; align-items: center; gap: 8px; background: var(--off); border-radius: 10px; padding: 8px 10px; }
.denom label { font-family: var(--font-display); font-weight: 800; font-size: 15px; color: var(--navy); white-space: nowrap; }
.denom input { width: 100%; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 8px; text-align: right; font-size: 14px; outline: none; background: #fff; }
.denom input:focus { border-color: var(--navy); }
.denom span { font-size: 11px; color: var(--muted); text-align: right; white-space: nowrap; }
.pay-summary strong.diff-neg { color: var(--red); }
.pay-summary strong.diff-pos { color: var(--green); }

@media (max-width: 1100px) {
  .pos { grid-template-columns: 1fr; }
  .pos-side { position: static; }
}
@media (max-width: 560px) {
  .pay-row { grid-template-columns: 1fr 1fr; }
  .pay-summary { grid-template-columns: 1fr; }
}

/* Reports */

.bars { display: flex; align-items: flex-end; gap: 4px; height: 180px; padding-top: 10px; }
.bar { flex: 1; min-width: 6px; max-width: 46px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.bar span { width: 100%; background: linear-gradient(180deg, var(--gold-2), var(--gold)); border-radius: 5px 5px 2px 2px; min-height: 2px; transition: opacity .15s; }
.bar:hover span { opacity: .75; }
.bar em { font-style: normal; font-size: 10px; color: var(--muted); }

/* Administration */

.admin-grid { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: start; }
.admin-list { max-height: calc(100vh - 230px); overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.admin-table { display: flex; justify-content: space-between; align-items: center; gap: 8px; border: none; background: transparent; text-align: left; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--text); }
.admin-table small { display: block; font-size: 10px; }
.admin-table:hover { background: var(--off); }
.admin-table.is-active { background: rgba(212, 160, 23, .14); }
.admin-rows td, .admin-rows th { white-space: nowrap; font-size: 12px; }
.json-view { background: var(--navy); color: #E2E8F0; border-radius: 10px; padding: 14px; font-size: 12px; overflow: auto; max-height: 60vh; }

@media (max-width: 900px) {
  .admin-grid { grid-template-columns: 1fr; }
  .admin-list { max-height: 220px; }
}

/* e-CF configuration */
.ecf-checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-top: 16px; }
.ecf-check { display: flex; gap: 9px; align-items: flex-start; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--border); background: var(--off); }
.ecf-check i { font-size: 18px; margin-top: 1px; }
.ecf-check span { display: flex; flex-direction: column; gap: 2px; font-size: 12px; min-width: 0; }
.ecf-check small { color: var(--muted); overflow-wrap: anywhere; }
.ecf-check.is-ok i { color: var(--green); }
.ecf-check.is-missing { background: #FFF5F5; border-color: #FED7D7; }
.ecf-check.is-missing i { color: var(--red); }
.ecf-check.is-optional i { color: var(--muted); }
.ecf-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ecf-method { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; text-align: left; border: 1.5px solid var(--border); border-radius: 11px; background: #fff; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.ecf-method i { font-size: 22px; color: var(--muted); }
.ecf-method strong { font-family: var(--font-display); font-size: 16px; font-weight: 800; color: var(--navy); text-transform: uppercase; }
.ecf-method small { font-size: 12px; color: var(--muted); line-height: 1.4; }
.ecf-method:hover { border-color: var(--gold); }
.ecf-method.is-active { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212, 160, 23, .18); }
.ecf-method.is-active i { color: var(--gold); }
.ecf-cert { display: flex; gap: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--off); }
.ecf-cert > i { font-size: 30px; }
.ecf-cert dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; font-size: 12px; }
.ecf-cert dt { color: var(--muted); font-weight: 600; }
.ecf-cert dd { margin: 0; overflow-wrap: anywhere; }
.segmented button:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 760px) {
  .ecf-methods { grid-template-columns: 1fr; }
}
tr.group-row td { background: var(--off); font-family: var(--font-display); font-size: 13px; font-weight: 800; color: var(--navy); text-transform: uppercase; letter-spacing: .3px; padding-top: 9px; padding-bottom: 9px; }

/* Pendiente de entrega */
.delivery-toggle { margin-top: 14px; border: 1px dashed var(--border); border-radius: 10px; padding: 12px 14px; }
.delivery-toggle.is-on { border-style: solid; border-color: var(--gold); background: #FFFBEB; }
.delivery-lines { margin-top: 10px; }
#pay-delivery { display: flex; flex-direction: column; gap: 10px; }
.pending-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: #6B46C1; }

/* Cola de caja y etiquetas */
.queue-btn .queue-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--red, #C53030); color: #fff; font: 800 12px var(--font-display); display: inline-flex; align-items: center; justify-content: center; }
.queue-btn.has-queue { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(212, 160, 23, .25); animation: queue-pulse 2s ease-in-out 3; }
@keyframes queue-pulse { 50% { box-shadow: 0 0 0 5px rgba(212, 160, 23, .35); } }
@media (prefers-reduced-motion: reduce) { .queue-btn.has-queue { animation: none; } }
.labels-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .labels-layout { grid-template-columns: 1fr; } }
.lbl-preview-wrap { background: repeating-conic-gradient(#F1F5F9 0% 25%, #fff 0% 50%) 50% / 14px 14px; border: 1.5px dashed var(--border); border-radius: 10px; padding: 18px; display: flex; justify-content: center; }
.lbl-preview-wrap iframe { border: 0; background: #fff; box-shadow: 0 6px 18px rgba(11, 29, 53, .16); border-radius: 3px; }

/* Pestañas con acción a la derecha (Kardex, Cuentas por cobrar) */
.tabs { align-items: center; }
.tabs .spacer { flex: 1; }
