/* Customer portal + staff admin — shared styles (loaded only on /portal/ and /admin/) */
.portal-hero { min-height: 250px !important; padding-bottom: 3rem; }
.portal-hero h1 { margin-bottom: .5rem; font-size: clamp(2rem, 4vw, 44px); }
.portal-hero p { margin: 0; }
.portal { padding: 2.5rem 0 4rem; min-height: 50vh; }
.portal [hidden] { display: none !important; }

/* Cards & auth forms */
.p-card { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); padding: clamp(18px, 3vw, 28px); }
.p-card + .p-card { margin-top: 20px; }
.auth-card { max-width: 460px; margin: 0 auto; }
.auth-card h2 { font-size: 1.5rem; margin-bottom: .4rem; }
.auth-card .lead { color: var(--muted); margin-bottom: 1.4rem; }
.auth-switch { display: grid; grid-template-columns: 1fr 1fr; background: var(--card-alt); border: 1px solid var(--border); border-radius: 8px; padding: 4px; margin-bottom: 18px; }
.auth-switch button { border: 0; background: transparent; padding: 9px 8px; border-radius: 6px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; }
.auth-switch button[aria-selected="true"] { background: #fff; color: var(--navy); box-shadow: 0 1px 4px rgba(32,58,110,.12); }
.p-btn-block { width: 100%; justify-content: center; }
.p-link { background: none; border: 0; padding: 0; color: var(--navy); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.p-small { font-size: 13px; color: var(--muted); }
.p-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.p-msg { margin: 12px 0 0; padding: 11px 13px; border-radius: var(--radius); font-size: 14.5px; }
.p-msg.ok { background: #e7f6ec; color: #1b6b35; }
.p-msg.err { background: #fdecec; color: #a01c1c; }
.p-msg.info { background: #eef1fb; color: var(--navy); }
.field input[readonly] { background: var(--card-alt); color: var(--muted); }
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

/* Dashboard shell */
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.dash-head h2 { margin: 0; font-size: clamp(1.4rem, 3vw, 1.8rem); }
.dash-head .who { color: var(--muted); font-size: 14px; margin-top: 4px; }
.btn--ghost { border-color: #cfd6e4; color: var(--navy); background: #fff; }
.btn--ghost:hover { border-color: var(--navy); }
.btn--navy { background: var(--navy); color: #fff; }
.btn--navy:hover { background: var(--navy-deep); color: #fff; }
.btn--sm { padding: .55em 1em; font-size: 13.5px; }
.btn[disabled] { opacity: .6; cursor: default; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); padding: 16px 18px; border-left: 4px solid var(--navy); }
.stat.yellow { border-left-color: var(--yellow); }
.stat.pink { border-left-color: var(--pink); }
.stat.green { border-left-color: #1f9d55; }
.stat .n { font-family: var(--font-head); font-size: 1.7rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
.stat .l { font-size: 13px; color: var(--muted); margin-top: 4px; }
@media (max-width: 800px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.tabs { display: flex; gap: 6px; border-bottom: 2px solid var(--border); margin-bottom: 22px; overflow-x: auto; }
.tabs button { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 12px 16px; font-weight: 600; font-size: 15px; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--yellow); }
.tabs button .count { background: var(--card-alt); border-radius: 999px; padding: 1px 8px; font-size: 12px; }
.tabs .i { width: 18px; height: 18px; }
@media (max-width: 600px) { .tabs button { padding: 10px 10px; font-size: 14px; flex: 1 0 auto; justify-content: center; } .tabs .i { display: none; } }

.sec-title { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; margin: 30px 0 14px; }
.sec-title:first-child { margin-top: 0; }
.sec-title .count { font-family: var(--font); font-size: 13px; font-weight: 600; background: #e8edfb; color: var(--navy); border-radius: 999px; padding: 2px 9px; }
.empty { background: #fff; border: 1px dashed #cfd6e4; border-radius: var(--radius-lg); padding: 22px; text-align: center; color: var(--muted); font-size: 15px; }

/* Badges */
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; background: #e8edfb; color: var(--navy); }
.badge.b-quote { background: #fdf3cc; color: #8a6300; }
.badge.b-live { background: #e6f0ff; color: #0d4fb3; }
.badge.b-done { background: #e7f6ec; color: #1b6b35; }
.badge.b-bad { background: #fdecec; color: #a01c1c; }
.badge.b-grey { background: #eef0f4; color: #555; }

/* Shipment cards */
.ship { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); padding: 20px; margin-bottom: 16px; }
.ship-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.ship-ref { font-family: var(--font-head); font-weight: 700; color: var(--navy); font-size: 1.1rem; }
.ship-route { font-size: 15px; margin-top: 4px; }
.ship-route .arrow { color: var(--muted); margin: 0 6px; }
.ship-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13.5px; color: var(--muted); margin-top: 8px; }
.ship-meta strong { color: var(--text); font-weight: 600; }
.ship-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* Progress tracker */
.track { list-style: none; display: grid; grid-template-columns: repeat(7, 1fr); margin: 20px 0 6px; padding: 0; counter-reset: s; }
.track li { position: relative; text-align: center; font-size: 12px; color: var(--muted); padding-top: 26px; }
.track li::before { content: ""; position: absolute; top: 5px; left: 50%; transform: translateX(-50%); width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid #cfd6e4; z-index: 1; }
.track li::after { content: ""; position: absolute; top: 11px; left: -50%; width: 100%; height: 3px; background: #cfd6e4; }
.track li:first-child::after { display: none; }
.track li.done { color: var(--text); }
.track li.done::before { background: var(--navy); border-color: var(--navy); }
.track li.done::after { background: var(--navy); }
.track li.now { color: var(--navy); font-weight: 700; }
.track li.now::before { background: var(--yellow); border-color: var(--navy); width: 18px; height: 18px; top: 3px; box-shadow: 0 0 0 4px rgba(253,199,12,.3); }
.track-mobile { display: none; font-size: 14px; margin: 16px 0 4px; }
.track-bar { height: 8px; border-radius: 999px; background: #e3e7ef; overflow: hidden; margin-top: 8px; }
.track-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--navy), #3a5bd9); border-radius: 999px; }
@media (max-width: 700px) { .track { display: none; } .track-mobile { display: block; } }

/* Timeline */
details.timeline { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
details.timeline summary { cursor: pointer; font-weight: 600; color: var(--navy); font-size: 14px; }
.tl { list-style: none; margin: 14px 0 0; padding: 0 0 0 18px; border-left: 2px solid var(--border); }
.tl li { position: relative; padding: 0 0 14px 14px; font-size: 14px; }
.tl li::before { content: ""; position: absolute; left: -25px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--navy); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--navy); }
.tl li:first-child::before { background: var(--yellow); }
.tl .t-when { font-size: 12.5px; color: var(--muted); }
.tl .t-what { font-weight: 600; }
.tl .t-note { color: var(--text); }

/* Quotes */
.quote-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding: 14px 16px; background: #fffbea; border: 1px solid #f5e3a0; border-radius: var(--radius); }
.quote-amount { font-family: var(--font-head); font-weight: 700; font-size: 1.4rem; color: var(--navy); }
.quote-notes { font-size: 14px; margin-top: 10px; white-space: pre-wrap; }

/* Tables */
.p-table-wrap { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); overflow-x: auto; }
.p-table { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 560px; }
.p-table th, .p-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.p-table th { font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--card-alt); font-weight: 600; }
.p-table tr:last-child td { border-bottom: 0; }
.p-table td.num, .p-table th.num { text-align: right; white-space: nowrap; }
.p-table .strong { font-weight: 600; color: var(--navy); }
.p-table tr.clickable { cursor: pointer; }
.p-table tr.clickable:hover td { background: #f8f9fd; }
.total-row { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 14px; font-weight: 600; }

/* Icon buttons */
.icon-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #cfd6e4; background: #fff; color: var(--navy); border-radius: var(--radius); padding: 6px 10px; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; }
.icon-btn:hover { border-color: var(--navy); }
.icon-btn .i { width: 16px; height: 16px; }

/* Settings */
.settings-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }
.settings-grid h3 { font-size: 1.15rem; margin-bottom: 1rem; }

/* Admin extras */
.admin-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.admin-bar input[type="search"], .admin-bar select { font: inherit; font-size: 14.5px; padding: 9px 12px; border: 1px solid #cfd6e4; border-radius: var(--radius); background: #fff; min-width: 220px; }
.crumbs { font-size: 14px; margin-bottom: 14px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* Modal dialog */
dialog.p-modal { border: 0; border-radius: var(--radius-lg); padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog.p-modal::backdrop { background: rgba(4, 12, 44, .55); }
.p-modal .m-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #fff; z-index: 1; }
.p-modal .m-head h3 { margin: 0; font-size: 1.2rem; }
.p-modal .m-body { padding: 20px 22px; }
.p-modal .m-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: #fff; }
.p-modal .m-close { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 4px; }
.p-modal .field select { width: 100%; font: inherit; font-size: 15px; padding: 11px 12px; border: 1px solid #cfd6e4; border-radius: var(--radius); background: #fff; }

/* Website enquiries: delete */
.btn--danger { background: #b42318; color: #fff; border-color: #b42318; }
.btn--danger:hover:not(:disabled) { background: #8f1c13; border-color: #8f1c13; }
.btn--danger:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn.danger { color: #b42318; border-color: #f1c4c0; }
.icon-btn.danger:hover { border-color: #b42318; background: #fdecec; }
.enq-bar { align-items: center; justify-content: space-between; }
.enq-all { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.enq-pick { display: inline-flex; align-items: center; gap: 10px; }
.enq-pick input, .enq-all input { width: 18px; height: 18px; accent-color: var(--navy); cursor: pointer; }
.ship.is-picked { background: #fff7f6; box-shadow: 0 0 0 2px #f1c4c0; }
.btn--danger-ghost { background: #fff; color: #b42318; border-color: #f1c4c0; }
.btn--danger-ghost:hover { background: #fdecec; border-color: #b42318; color: #b42318; }
.p-modal [hidden] { display: none !important; }
