:root {
    --navy: #0b1215; --navy-2: #131d21; --navy-3: #1c292e; --ice: #f1ece2; --paper: #f8f6f1; --rule: #e6e1d6;
    --ink: #0b1215; --muted: #5b676b; --amber: #d4ff3a; --amber-deep: #3d6b12; --green: #1f9d5c; --red: #c0392b; --teal: #0c3634;
    --display: 'Archivo', 'Arial Narrow', sans-serif; --sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; --mono: 'JetBrains Mono', ui-monospace, monospace;
    --side: 248px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--sans); color: var(--ink); background: var(--paper); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2 { font-family: var(--display); font-stretch: 85%; font-weight: 800; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); letter-spacing: 0; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }

/* Buttons */
.b { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-radius: 999px; font: 700 14.5px var(--sans); text-decoration: none; border: 1px solid transparent; cursor: pointer; transition: background .2s, border-color .2s, transform .2s; white-space: nowrap; }
.b-amber { background: var(--amber); color: var(--ink); }
.b-amber:hover { background: #e2ff70; box-shadow: 0 12px 24px -14px rgba(160, 200, 0, .9); }
.b-line { background: #fff; border-color: var(--rule); color: var(--ink); }
.b-line:hover { border-color: var(--ink); }
.b-wa { background: #e7f8ee; color: #0f8a43; }
.b-ghost-red { background: none; color: var(--red); border-color: rgba(192, 57, 43, .25); }
.b-full { width: 100%; padding: 14px; font-size: 15px; }

/* Forms */
label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; margin-bottom: 14px; }
label small { font-weight: 500; color: var(--muted); }
input, select, textarea { font: 500 16px var(--sans); color: var(--ink); padding: 12px 13px; border: 1px solid var(--rule); border-radius: 10px; background: #fff; width: 100%; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--ink); box-shadow: 0 0 0 4px rgba(212, 255, 58, .55); }
.alert { padding: 13px 16px; border-radius: 12px; font-weight: 600; margin-bottom: 18px; }
.alert.ok { background: #e7f8ee; color: #0f6d37; border: 1px solid #bfe9d0; }
.alert.err { background: #fdecea; color: #a12a1c; border: 1px solid #f6c9c3; }

.logo { width: 40px; height: 40px; border-radius: 11px; background: var(--amber); color: var(--ink); display: grid; place-items: center; flex: 0 0 40px; }
.logo svg { width: 24px; height: 24px; }
.brand-row { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-row b { display: block; font-family: var(--display); font-stretch: 80%; font-weight: 900; text-transform: uppercase; font-size: 20px; line-height: 1.05; letter-spacing: .01em; }
.brand-row small { display: block; font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; opacity: .6; margin-top: 3px; }

/* Login */
body.bare { background: #fff; }
.login-wrap { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: linear-gradient(160deg, rgba(11, 18, 21, .7), rgba(11, 18, 21, .96)), url('/assets/img/port.jpg') center/cover; color: #fff; display: flex; align-items: center; padding: 60px; }
.la-inner { max-width: 480px; }
.login-art h1 { font-size: clamp(44px, 4.8vw, 72px); line-height: .92; text-transform: uppercase; font-stretch: 75%; font-weight: 900; margin: 48px 0 26px; }
.login-art h1 span { color: var(--amber); }
.la-list { list-style: none; display: grid; gap: 12px; color: rgba(255, 255, 255, .8); }
.la-list li { display: flex; gap: 12px; align-items: center; }
.la-list li::before { content: "✓"; width: 24px; height: 24px; border-radius: 50%; background: rgba(212, 255, 58, .18); color: var(--amber); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: 0 0 24px; }
.login-card { align-self: center; justify-self: center; width: 100%; max-width: 400px; padding: 40px 28px; }
.login-card h2 { font-size: 32px; margin-bottom: 6px; }
.login-card > .muted { margin-bottom: 24px; }
.login-card .back { display: block; text-align: center; margin-top: 20px; color: var(--muted); font-size: 14px; text-decoration: none; }
.mobile-only { display: none; }
.m-brand { display: none; }

/* Shell */
.side { position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--navy); color: #fff; display: flex; flex-direction: column; padding: 22px 16px; z-index: 20; }
.side > .brand-row { padding: 0 8px 24px; border-bottom: 1px solid rgba(255, 255, 255, .08); margin-bottom: 16px; }
.side nav { display: grid; gap: 4px; }
.side nav a { position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; text-decoration: none; color: rgba(255, 255, 255, .7); font-weight: 600; transition: background .2s, color .2s; }
.side nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side nav a.on { background: rgba(212, 255, 58, .12); color: #fff; }
.side nav a.on svg { stroke: var(--amber); }
.side nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 20px; }
.dot { font-style: normal; margin-left: auto; background: var(--amber); color: var(--ink); font-size: 11px; font-weight: 800; min-width: 22px; height: 22px; border-radius: 11px; display: grid; place-items: center; padding: 0 6px; }
.side-foot { margin-top: auto; display: grid; gap: 8px; padding: 16px 8px 0; border-top: 1px solid rgba(255, 255, 255, .08); }
.side-foot a, .side-foot button { color: rgba(255, 255, 255, .7); font: 600 14px var(--sans); background: none; border: 0; text-align: left; cursor: pointer; text-decoration: none; padding: 6px 0; }
.side-foot a:hover, .side-foot button:hover { color: #fff; }
.topbar { display: none; }
.main { margin-left: var(--side); padding: 34px 40px 60px; max-width: calc(1180px + var(--side)); }
.demo-note { margin-left: var(--side); padding: 0 40px 30px; font-size: 12.5px; color: var(--muted); }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 26px; }
.page-head h1 { font-size: 38px; line-height: 1; text-transform: uppercase; font-stretch: 78%; font-weight: 900; }
.page-head p { margin-top: 4px; }
.crumb { display: inline-block; font-size: 13.5px; color: var(--muted); text-decoration: none; margin-bottom: 6px; font-weight: 600; }

.card { background: #fff; border: 1px solid var(--rule); border-radius: 16px; padding: 22px; margin-bottom: 20px; }
.card h2 { font-size: 18px; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.card h2 .more { margin-left: auto; font: 700 13px var(--sans); color: var(--amber-deep); text-decoration: none; }
.count { font: 700 12px var(--sans); background: var(--ice); color: var(--muted); padding: 2px 9px; border-radius: 999px; }
.grid-2 { display: grid; grid-template-columns: 1.25fr 1fr; gap: 20px; align-items: start; }
.narrow { max-width: 480px; }
.empty { color: var(--muted); padding: 10px 0; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--rule); border-radius: 16px; padding: 20px; text-decoration: none; display: grid; gap: 2px; transition: transform .2s, box-shadow .2s; }
.stat:hover { transform: translateY(-2px); box-shadow: 0 18px 36px -24px rgba(10, 28, 46, .4); }
.stat span { font-size: 13px; font-weight: 700; color: var(--muted); }
.stat b { font-family: var(--display); font-stretch: 75%; font-weight: 900; font-size: 46px; line-height: 1; letter-spacing: -.01em; margin: 4px 0; }
.stat small { font-size: 12.5px; color: var(--muted); }
.stat.accent { background: var(--navy); border-color: var(--navy); color: #fff; }
.stat.accent span, .stat.accent small { color: rgba(255, 255, 255, .65); }
.stat.accent b { color: var(--amber); }

.list { display: grid; }
.row-link { display: flex; justify-content: space-between; gap: 14px; align-items: center; padding: 13px 4px; border-top: 1px solid var(--rule); text-decoration: none; }
.row-link:first-child { border-top: 0; }
.row-link:hover b { color: var(--amber-deep); }
.row-link > div:first-child { min-width: 0; }
.row-link b { display: block; font-size: 15px; transition: color .2s; }
.row-link span { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-link .r { text-align: right; display: grid; gap: 6px; justify-items: end; flex: 0 0 auto; }
.row-link .r small { font-size: 12px; color: var(--muted); }
.prog { width: 110px; height: 5px; border-radius: 3px; background: var(--ice); overflow: hidden; }
.prog i { display: block; height: 100%; background: linear-gradient(90deg, var(--ink), #8fbf00); border-radius: 3px; }

.badge { display: inline-block; font-size: 11.5px; font-weight: 800; padding: 4px 10px; border-radius: 999px; white-space: nowrap; background: var(--ice); color: var(--navy-3); }
.badge.st2, .badge.st3 { background: #fff3dc; color: #9a6100; }
.badge.st4 { background: #e3f0ff; color: #1d5fa8; }
.badge.st5 { background: #e7f8ee; color: #0f6d37; }
.badge.qnew { background: #fff3dc; color: #9a6100; }
.badge.qcontacted { background: #e3f0ff; color: #1d5fa8; }
.badge.qwon { background: #e7f8ee; color: #0f6d37; }
.badge.qlost { background: #f1f2f4; color: #6b7280; }

/* Shipment timeline */
.atl { list-style: none; display: grid; }
.atl li { display: grid; grid-template-columns: 22px 1fr auto; gap: 12px; position: relative; padding-bottom: 18px; }
.atl li::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--rule); background: #fff; margin-top: 4px; z-index: 1; }
.atl li::after { content: ""; position: absolute; left: 6px; top: 18px; bottom: 0; width: 2px; background: var(--rule); }
.atl li:last-child::after { display: none; }
.atl li.done::before { background: var(--ink); border-color: var(--ink); }
.atl li.done::after { background: var(--ink); }
.atl li.now::before { background: var(--amber); border-color: var(--ink); box-shadow: 0 0 0 5px rgba(212, 255, 58, .35); }
.atl b { display: block; }
.atl li:not(.done):not(.now) b { color: var(--muted); font-weight: 600; }
.atl span { display: block; font-size: 13.5px; color: var(--muted); }
.atl time { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.hist { margin-top: 8px; border-top: 1px solid var(--rule); padding-top: 14px; }
.hist summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--amber-deep); }
.hist p { font-size: 13.5px; color: var(--muted); padding: 10px 0; border-bottom: 1px solid var(--rule); }
.hist p b { color: var(--ink); }
.danger-zone { margin-top: -6px; }

/* Quotes */
.tabs { display: flex; gap: 6px; margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 9px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--rule); text-decoration: none; font-weight: 700; font-size: 14px; white-space: nowrap; }
.tabs a i { font-style: normal; color: var(--muted); font-weight: 600; margin-left: 2px; }
.tabs a.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.tabs a.on i { color: var(--amber); }
.quotes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.quote-card { margin: 0; border-left: 4px solid var(--rule); display: flex; flex-direction: column; }
.quote-card.q-new { border-left-color: #a3d900; }
.quote-card.q-contacted { border-left-color: #1d5fa8; }
.quote-card.q-won { border-left-color: var(--green); }
.qc-top { display: flex; justify-content: space-between; gap: 10px; }
.qc-top b { display: block; font-size: 16px; }
.qc-top span { font-size: 13px; color: var(--muted); }
.qc-top small { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.qc-goods { margin: 12px 0 16px; font-size: 14px; font-weight: 600; }
.qc-goods span { font-weight: 500; color: var(--muted); }
.qc-actions { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.qc-actions .b { padding: 9px 14px; font-size: 13.5px; }
.qc-status { margin-left: auto; }
.qc-status select { padding: 8px 10px; font-size: 14px; font-weight: 700; }

/* Content editor */
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.fgrid.f3 { grid-template-columns: repeat(3, 1fr); }
.span2 { grid-column: span 2; }
.rows { display: grid; gap: 8px; margin-bottom: 12px; }
.rowf { display: grid; gap: 8px; align-items: center; }
.rowf.r3 { grid-template-columns: 1fr 2fr 1fr 40px; }
.rowf.r2 { grid-template-columns: 2fr 1fr 40px; }
.rowf input, .rowf select { padding: 10px 12px; font-size: 15px; }
.x { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--rule); background: #fff; color: var(--muted); font-size: 20px; cursor: pointer; }
.x:hover { color: var(--red); border-color: var(--red); }
.save-bar { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 18px; background: rgba(255, 255, 255, .95); backdrop-filter: blur(10px); border: 1px solid var(--rule); border-radius: 14px; box-shadow: 0 -12px 30px -20px rgba(10, 28, 46, .4); }

.hero-prev { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; margin-bottom: 10px; }
.drop { display: block; position: relative; border: 2px dashed var(--rule); border-radius: 14px; padding: 30px 20px; text-align: center; font-weight: 500; color: var(--muted); cursor: pointer; }
.drop:hover { border-color: var(--amber); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop b { color: var(--ink); font-size: 16px; }
.tip { font-size: 14.5px; color: var(--muted); background: var(--ice); border-color: transparent; }
.tip b { color: var(--ink); }

/* ---------- Tablet & phone ---------- */
@media (max-width: 1100px) {
    .stats { grid-template-columns: 1fr 1fr; }
    .grid-2, .quotes { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .login-wrap { grid-template-columns: 1fr; }
    .login-art { display: none; }
    .mobile-only { display: flex; margin-bottom: 30px; color: var(--ink); }
    .login-card { padding: 48px 22px; }

    .side { inset: auto 0 0 0; width: auto; height: auto; flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(255, 255, 255, .08); }
    .side > .brand-row, .side-foot { display: none; }
    .side nav { grid-template-columns: repeat(6, 1fr); gap: 2px; width: 100%; }
    .side nav a { flex-direction: column; gap: 3px; padding: 8px 2px; font-size: 10.5px; text-align: center; }
    .side nav a.on { background: none; color: var(--amber); }
    .page-head h1 { font-size: 32px; }
    .dot { position: absolute; top: 2px; right: calc(50% - 22px); min-width: 18px; height: 18px; font-size: 10px; margin: 0; }
    .topbar { display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 15; background: var(--navy); color: #fff; padding: 12px 16px; }
    .topbar .logo { width: 34px; height: 34px; flex-basis: 34px; }
    .topbar .brand-row b { font-size: 16px; }
    .topbar button { background: rgba(255, 255, 255, .08); color: #fff; border: 0; border-radius: 8px; padding: 8px 12px; font: 600 13px var(--sans); }
    .main { margin: 0; padding: 20px 16px 110px; }
    .demo-note { margin: 0; padding: 0 16px 100px; margin-top: -90px; }
    .page-head { flex-direction: column; align-items: stretch; gap: 14px; margin-bottom: 18px; }
    .page-head .b { align-self: flex-start; }
    .card { padding: 18px 16px; border-radius: 14px; margin-bottom: 14px; }
    .stats { gap: 10px; margin-bottom: 14px; }
    .stat { padding: 14px; border-radius: 14px; }
    .stat b { font-size: 30px; }
    .stat span { font-size: 12px; }
    .stat small { font-size: 11.5px; }
    .row-link .prog { width: 70px; }
    .fgrid, .fgrid.f3 { grid-template-columns: 1fr; }
    .span2 { grid-column: auto; }
    .rowf.r3 { grid-template-columns: 1fr 40px; padding: 10px; background: var(--paper); border-radius: 12px; }
    .rowf.r3 > :not(.x) { grid-column: 1; }
    .rowf.r3 .x { grid-column: 2; grid-row: 1; }
    .save-bar { bottom: calc(64px + env(safe-area-inset-bottom)); }
    .save-bar .muted { display: none; }
    .save-bar .b { width: 100%; }
    .qc-status { margin-left: 0; flex: 1; }
    .quotes { gap: 12px; }
    .quotes .card { margin: 0; }
    body.bare { background: var(--navy); }
    .login-wrap { min-height: 100dvh; align-content: start; background: linear-gradient(180deg, rgba(11, 18, 21, .35), rgba(11, 18, 21, .95) 70%), url('/assets/img/port-sm.jpg') top/cover no-repeat; padding-top: 34px; }
    .login-card { background: #fff; border-radius: 22px 22px 0 0; max-width: none; min-height: calc(100dvh - 210px); align-self: end; padding: 30px 22px 40px; box-shadow: 0 -20px 40px -20px rgba(0, 0, 0, .5); }
    .mobile-only { display: none; }
    .m-brand { display: flex; color: #fff; padding: 0 22px 34px; }
}

