/* =============================================================================
   JTJ Customer Portal — Main Stylesheet
   Font: Inter (Google Fonts)
   Design tokens updated 2026-05
   ============================================================================= */

/* --- Variables ---------------------------------------------------------------- */
:root {
    --navy:        #142a47;
    --navy-deep:   #0e2138;
    --ink:         #1b2a40;
    --slate:       #54657e;
    --mute:        #8b9aae;
    --faint:       #aab6c6;
    --line:        #e5eaf1;
    --line-soft:   #eef2f6;
    --bg:          #f3f5f9;
    --card:        #ffffff;
    --green:       #2c9c52;
    --green-deep:  #1d7a3e;
    --green-soft:  #e6f5ec;
    --blue:        #2f6bc6;
    --blue-soft:   #e8f0fb;
    --amber:       #bd7e1a;
    --amber-soft:  #f9efd7;
    --red:         #c0392b;
    --red-soft:    #fef2f2;
    --r:           14px;
    --shadow:      0 1px 2px rgba(20,42,71,.04), 0 6px 24px -12px rgba(20,42,71,.12);

    /* Movement badge border tokens (portal.js) */
    --mv-load-border:     #b3cdfb;
    --mv-depa-border:     #fcd34d;
    --mv-arrv-border:     #6ee7b7;
    --mv-disc-bg:         #f3e8ff;
    --mv-disc-fg:         #6b21a8;
    --mv-disc-border:     #d8b4fe;
    --mv-dot-pending-bg:  #c8d3e3;
    --mv-dot-done-border: #6ee7b7;
}

/* --- Reset & Base ------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: var(--navy);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* --- Layout ------------------------------------------------------------------- */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.75rem;
}

.wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 22px 1.75rem 60px;
}

.page-content {
    padding: 22px 0 60px;
}

/* --- Topbar (replaces .site-header) ------------------------------------------ */
.topbar {
    background: var(--navy);
    border-bottom: 3px solid var(--green);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 14px 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
}

.brand img {
    display: block;
    height: 32px;
    width: auto;
}

.brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--green);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 17px;
    flex-shrink: 0;
}

.brand-name {
    color: #fff;
    font-weight: 700;
    font-size: 19px;
    letter-spacing: -.01em;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 18px;
}

.topnav a {
    color: #aebccf;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s;
}

.topnav a:hover {
    color: #fff;
    text-decoration: none;
}

.who {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 13.5px;
}

.avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #2f4a6e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #cfe6d8;
    flex-shrink: 0;
}

.signout,
.btn-logout {
    background: transparent;
    border: 1px solid rgba(54,80,113,.5);
    color: #aebccf;
    padding: 6px 12px;
    border-radius: 7px;
    font-size: 12.5px;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: border-color 0.15s, color 0.15s;
}

.signout:hover,
.btn-logout:hover {
    border-color: #5a7494;
    color: #fff;
    text-decoration: none;
}

.header-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.header-logo img {
    display: block;
    height: 32px;
    width: auto;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-user {
    color: #aebccf;
    font-size: 13.5px;
    font-weight: 500;
}

.header-back {
    color: #aebccf;
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.15s;
}

.header-back:hover {
    color: #fff;
    text-decoration: none;
}

/* --- Pagehead (orders list page) --------------------------------------------- */
.pagehead {
    background: var(--navy-deep);
    padding: 24px 0 26px;
}

.pagehead-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.75rem;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.page-title {
    font-weight: 800;
    font-size: 27px;
    color: #fff;
    letter-spacing: -.02em;
    line-height: 1.2;
}

.page-sub {
    color: #9fb1c7;
    font-size: 14px;
    margin-top: 3px;
}

.head-actions {
    display: flex;
    gap: 9px;
    flex-shrink: 0;
}

/* --- Orderhead (order detail page) ------------------------------------------- */
.orderhead {
    background: var(--navy-deep);
    padding: 22px 0 26px;
}

.orderhead-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.75rem;
}

.crumb {
    color: #7e93ac;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    margin-bottom: 9px;
}

.crumb a {
    color: #7e93ac;
    text-decoration: none;
}

.crumb a:hover {
    color: #aebfd2;
    text-decoration: none;
}

.orderhead-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.order-id {
    font-weight: 700;
    font-size: 30px;
    color: #fff;
    letter-spacing: -.02em;
    line-height: 1.1;
}

.order-sub {
    color: #9fb1c7;
    font-size: 14px;
    margin-top: 3px;
}

.order-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    padding: 5px 11px;
    border-radius: 999px;
}

.pill-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.pill-shipped   { background: var(--green-soft);  color: var(--green-deep); }
.pill-booked    { background: var(--amber-soft);  color: var(--amber); }
.pill-delivered { background: var(--green-soft);  color: var(--green-deep); }
.pill-cancelled { background: var(--red-soft);    color: var(--red); }

.ref-chip {
    font-size: 12px;
    color: #9fb1c7;
    padding: 5px 11px;
    border-radius: 999px;
    background: rgba(28,54,87,.2);
    border: 1px solid #34507a;
    font-family: 'Courier New', monospace;
    letter-spacing: .02em;
}

/* --- Split shipment notice ---------------------------------------------------- */
.split-notice {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.625rem 1rem;
    border-radius: var(--r);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.split-notice--child {
    background: #EEF3FF;
    border: 1px solid #C7D7FA;
    color: var(--navy);
}

.split-notice--parent {
    background: var(--green-soft);
    border: 1px solid #A8E6C5;
    color: var(--navy);
}

.split-notice a {
    font-weight: 600;
    color: var(--navy);
    text-decoration: underline;
}

/* --- Card -------------------------------------------------------------------- */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow);
}

.card-pad {
    padding: 20px 22px;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 22px;
    border-bottom: 1px solid var(--line-soft);
}

.card-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--ink);
}

.card-note {
    font-size: 12px;
    color: var(--mute);
}

/* --- Stat cards (orders list — left accent border) --------------------------- */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

.stat {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 15px 17px;
    position: relative;
    overflow: hidden;
}

.stat::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
}

.s-total::before    { background: var(--slate); }
.s-transit::before  { background: var(--blue); }
.s-booked::before   { background: var(--amber); }
.s-delivered::before { background: var(--green); }

.stat-top {
    display: flex;
    align-items: center;
    gap: 7px;
}

.stat-ico {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.stat-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--mute);
}

.stat-val {
    font-weight: 800;
    font-size: 28px;
    letter-spacing: -.02em;
    margin-top: 6px;
    color: var(--ink);
}

.stat-val small {
    font-size: 13px;
    font-weight: 600;
    color: var(--slate);
}

.stat-foot,
.stat-extra {
    font-size: 12px;
    color: var(--slate);
    margin-top: 1px;
}

/* Coloured values for orders list stat cards */
.s-transit .stat-val  { color: var(--blue); }
.s-booked .stat-val   { color: var(--amber); }
.s-delivered .stat-val { color: var(--green-deep); }

/* --- Toolbar + chips --------------------------------------------------------- */
.toolbar {
    padding: 14px 16px;
    margin-bottom: 14px;
}

.toolbar-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.search-wrap {
    flex: 1;
    min-width: 240px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 9px 12px;
    background: #fafbfd;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.search-wrap:focus-within {
    border-color: var(--green);
    background: #fff;
    box-shadow: 0 0 0 3px var(--green-soft);
}

.search-wrap input {
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 13.5px;
    color: var(--ink);
    width: 100%;
    outline: none;
}

.search-wrap input::placeholder {
    color: var(--faint);
}

.selectbox {
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fafbfd;
}

.selectbox select {
    appearance: none;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--slate);
    padding: 9px 30px 9px 12px;
    cursor: pointer;
    outline: none;
}

.selectbox svg {
    position: absolute;
    right: 9px;
    pointer-events: none;
    color: var(--mute);
}

.chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 13px;
    margin-top: 13px;
    border-top: 1px solid var(--line-soft);
}

.chip-lead {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--mute);
    align-self: center;
    margin-right: 2px;
    white-space: nowrap;
}

.chip {
    font-size: 12.5px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--slate);
    transition: all .12s;
    text-decoration: none;
    display: inline-block;
}

.chip:hover {
    border-color: var(--mute);
    color: var(--ink);
    text-decoration: none;
}

.chip.active {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
}

/* --- Input elements ---------------------------------------------------------- */
.input-search,
.input-select,
.input-textarea {
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--ink);
    background: #fafbfd;
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 0.5625rem 0.75rem;
    width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.input-search:focus-visible,
.input-select:focus-visible,
.input-textarea:focus-visible {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px var(--green-soft);
}

.input-select {
    width: auto;
    padding-right: 2rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238b9aae' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
}

.input-textarea {
    resize: vertical;
    min-height: 80px;
}

textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 11px;
    font-family: inherit;
    font-size: 13.5px;
    color: var(--ink);
    resize: vertical;
    min-height: 74px;
    background: #fff;
}

textarea:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px var(--green-soft);
}

/* --- Buttons ----------------------------------------------------------------- */
.btn {
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    border-radius: 9px;
    padding: 9px 15px;
    cursor: pointer;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: transform .08s, background .15s, border-color .15s, color .15s;
    white-space: nowrap;
    text-decoration: none;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}

.btn-primary:hover {
    background: var(--navy-deep);
    text-decoration: none;
}

.btn-ghost {
    background: #fff;
    color: var(--slate);
    border-color: var(--line);
}

.btn-ghost:hover {
    border-color: var(--mute);
    color: var(--ink);
    text-decoration: none;
}

.btn-ghost-d {
    background: rgba(255,255,255,.08);
    color: #fff;
    border-color: rgba(255,255,255,.27);
}

.btn-ghost-d:hover {
    background: rgba(255,255,255,.15);
    text-decoration: none;
}

.btn-light {
    background: #fff;
    color: var(--green-deep);
    border-color: transparent;
}

.btn-light:hover {
    background: #eefcf2;
    text-decoration: none;
}

.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(255,255,255,.08);
    color: #fff;
    border-color: rgba(255,255,255,.27);
}

.btn-export:hover {
    background: rgba(255,255,255,.15);
    text-decoration: none;
}

.btn-download {
    background: var(--green);
    color: #fff;
    border-color: var(--green);
    font-size: 0.8125rem;
    padding: 0.375rem 0.875rem;
}

.btn-download:hover {
    background: var(--green-deep);
    text-decoration: none;
}

.btn-sm {
    font-size: 0.8125rem;
    padding: 6px 12px;
    border-radius: 7px;
}

.btn-full {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.9375rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* --- Tablecard --------------------------------------------------------------- */
.tablecard {
    overflow: hidden;
}

.tbl-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line-soft);
}

.tbl-head-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--ink);
}

.tbl-head-count {
    font-size: 12.5px;
    color: var(--mute);
}

.tbl-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* --- Data table (orders list) ------------------------------------------------ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 920px;
}

.data-table thead th {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--mute);
    text-align: left;
    padding: 11px 16px;
    background: #fafbfd;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--line-soft);
    font-size: 13px;
    color: var(--ink);
    vertical-align: middle;
}

.data-table tbody tr {
    cursor: pointer;
    transition: background .1s;
}

.data-table tbody tr:hover {
    background: #f6f9fc;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tfoot td {
    padding: 13px 16px;
    border-top: 2px solid var(--line);
    font-size: 13px;
}

/* Table cell helpers */
.so        { font-weight: 700; font-size: 13px; color: var(--navy); }
.so-tag    { font-size: 11px; color: var(--mute); font-family: 'Courier New', monospace; margin-top: 1px; }
.ref       { font-family: 'Courier New', monospace; font-size: 12px; color: var(--slate); }
.product   { font-weight: 600; }
.dest      { color: var(--ink); }
.dest-sub  { font-size: 11px; color: var(--mute); text-transform: uppercase; letter-spacing: .02em; }
.vessel    { font-weight: 600; font-size: 12.5px; }
.eta       { font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.eta-rel   { font-size: 11px; margin-top: 1px; }
.rel-today { color: var(--green-deep); font-weight: 700; }
.rel-soon  { color: var(--blue); }
.rel-past  { color: var(--faint); }
.rel-far   { color: var(--mute); }
.qty       { font-variant-numeric: tabular-nums; font-weight: 700; }
.qty-empty { color: var(--faint); font-weight: 500; font-style: italic; font-size: 12px; }
.chevron   { color: var(--faint); display: block; }
.num       { text-align: right; font-variant-numeric: tabular-nums; }
.tbl th.th-num { text-align: right; }

/* Compat aliases */
.date-primary  { display: block; font-weight: 500; }
.date-relative { display: block; font-size: 0.75rem; color: var(--mute); margin-top: 2px; }
.so-link       { font-weight: 600; color: var(--navy); font-size: 0.9375rem; }
.so-link:hover { color: var(--green); }
.product-cell  { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Table empty state */
.table-empty {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--mute);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.table-empty svg { color: var(--line); flex-shrink: 0; }
.table-empty p   { font-size: 0.9375rem; }

/* --- Pager ------------------------------------------------------------------- */
.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 18px;
    border-top: 1px solid var(--line-soft);
    flex-wrap: wrap;
}

.pager-info {
    font-size: 12.5px;
    color: var(--mute);
}

.pager-ctrl {
    display: flex;
    gap: 6px;
    align-items: center;
}

.pg {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--slate);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    text-decoration: none;
    transition: border-color .15s, color .15s, background .15s;
}

.pg:hover {
    border-color: var(--mute);
    color: var(--ink);
    text-decoration: none;
}

.pg.active {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
}

/* --- Status badges ----------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 4px 9px;
    border-radius: 999px;
    white-space: nowrap;
}

.badge::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.badge-blue   { background: var(--blue-soft);  color: var(--blue); }
.badge-green  { background: var(--green-soft); color: var(--green-deep); }
.badge-amber  { background: var(--amber-soft); color: var(--amber); }
.badge-red    { background: var(--red-soft);   color: var(--red); }
.badge-grey   { background: var(--line-soft);  color: var(--mute); }

/* Inline badge (BO numbers etc) */
.badge-sm {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 5px;
    background: var(--blue-soft);
    color: var(--blue);
    letter-spacing: .02em;
}

/* Mono helper */
.mono {
    font-family: 'Courier New', monospace;
    font-size: 0.875em;
}

.container-number {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: .05em;
}

/* --- Hero card (order.php arrival strip) -------------------------------------- */
.hero {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 18px;
}

.hero-band {
    background: linear-gradient(100deg, #15402a, #1d7a3e 70%, #2c9c52);
    padding: 22px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.hero-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hero-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.hero-eyebrow {
    color: #a9e5c1;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.hero-h {
    font-weight: 700;
    font-size: 25px;
    color: #fff;
    line-height: 1.15;
    margin-top: 2px;
    letter-spacing: -.01em;
}

.hero-sub {
    color: #cdeed9;
    font-size: 13.5px;
    margin-top: 2px;
}

.hero-actions {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
}

/* --- Progress tracker -------------------------------------------------------- */
.tracker {
    padding: 24px 26px 22px;
}

.track-line {
    position: relative;
    display: flex;
    justify-content: space-between;
}

.track-line::before {
    content: "";
    position: absolute;
    top: 9px;
    left: 5%;
    right: 5%;
    height: 2px;
    background: var(--line);
}

.track-fill {
    position: absolute;
    top: 9px;
    left: 5%;
    height: 2px;
    background: var(--green);
    border-radius: 2px;
    transition: width .4s ease;
}

.node {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    text-align: center;
}

.dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dot.done {
    background: var(--green);
    border-color: var(--green);
}

.dot.done::after {
    content: "";
    width: 7px;
    height: 4px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translateY(-1px);
}

.dot.current {
    border-color: var(--green);
    background: #fff;
    box-shadow: 0 0 0 4px var(--green-soft);
}

.dot.current::after {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
}

.node-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--ink);
    margin-top: 9px;
}

.node-label.muted   { color: var(--mute); }
.node-label.current { color: var(--green-deep); }

.node-date {
    font-size: 11.5px;
    color: var(--slate);
    margin-top: 2px;
}

.node-place {
    font-size: 11px;
    color: var(--mute);
    text-transform: uppercase;
    letter-spacing: .03em;
}

.node-pending {
    font-size: 11px;
    color: var(--faint);
    font-style: italic;
    margin-top: 2px;
}

/* --- Detail groups (order.php grouped fields) -------------------------------- */
.detail-group + .detail-group {
    border-top: 1px solid var(--line-soft);
}

.group-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--green-deep);
    padding: 16px 22px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.group-label::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line-soft);
}

.kv-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 28px;
    padding: 12px 22px 18px;
}

.kv {
    padding: 7px 0;
}

.kv-k {
    display: block;
    font-size: 11.5px;
    color: var(--mute);
    font-weight: 600;
    letter-spacing: .02em;
}

.kv-v {
    display: block;
    font-size: 14px;
    color: var(--ink);
    font-weight: 600;
    margin-top: 2px;
}

.kv-v.empty {
    color: var(--faint);
    font-weight: 500;
    font-style: italic;
}

.kv-note {
    font-size: 11px;
    color: var(--mute);
    margin-top: 2px;
}

/* --- Inline tables (order lines, containers) --------------------------------- */
.tbl {
    width: 100%;
    border-collapse: collapse;
}

.tbl th {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--mute);
    text-align: left;
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    background: #fafbfd;
    white-space: nowrap;
}

.tbl td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--line-soft);
    font-size: 13.5px;
    color: var(--ink);
    vertical-align: top;
}

.tbl tr:last-child td {
    border-bottom: none;
}

.tbl tbody tr:hover {
    background: #fafbfd;
}

.tbl-foot {
    display: flex;
    justify-content: flex-end;
    gap: 40px;
    padding: 13px 16px;
    background: #fafbfd;
    border-top: 1px solid var(--line);
}

.foot-k {
    font-size: 12px;
    color: var(--mute);
    font-weight: 600;
}

.foot-v {
    font-weight: 700;
    font-size: 15px;
    color: var(--ink);
}

.cell-strong    { font-weight: 700; }
.cell-mute      { color: var(--mute); }
.line-desc-main { font-weight: 700; font-size: 14px; }
.line-desc-sub  { font-size: 12px; color: var(--mute); margin-top: 2px; }

/* --- Documents section ------------------------------------------------------- */
.doc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 22px;
    border-bottom: 1px solid var(--line-soft);
    transition: background .1s;
}

.doc-row:last-child {
    border-bottom: none;
}

.doc-row:hover {
    background: #fafbfd;
}

.doc-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.doc-ico {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--bg);
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--faint);
}

.doc-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
}

.doc-meta {
    font-size: 11.5px;
    color: var(--mute);
    margin-top: 1px;
}

.tag-pending {
    font-size: 11px;
    font-weight: 700;
    color: var(--amber);
    background: var(--amber-soft);
    padding: 4px 10px;
    border-radius: 999px;
    letter-spacing: .02em;
    white-space: nowrap;
    flex-shrink: 0;
}

.doc-foot {
    padding: 11px 22px;
    font-size: 11.5px;
    color: var(--mute);
    background: #fafbfd;
    border-top: 1px solid var(--line-soft);
}

/* Portal.js doc status elements */
.document-actions {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-shrink: 0;
}

.doc-status.available   { color: var(--green-deep); font-size: 0.8125rem; font-weight: 500; display: none; }
.doc-status.unavailable { color: var(--mute); font-size: 0.8125rem; }

/* --- Rating / Feedback section ----------------------------------------------- */
.rating-section {
    padding: 16px 22px;
}

.rating-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 1.25rem;
}

.rating-question {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.rating-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink);
}

.rating-sublabel {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--mute);
    margin-top: 0.125rem;
    max-width: 180px;
}

.star-group {
    display: flex;
    gap: 2px;
    margin-top: 6px;
}

.star {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 28px;
    color: var(--line);
    padding: 2px 3px;
    line-height: 1;
    transition: color 0.1s;
    font-family: inherit;
}

.star.lit,
.star.hover-lit {
    color: #f59e0b;
}

.star:focus-visible {
    outline: 2px solid var(--green);
    border-radius: 3px;
}

.star-display {
    color: #f59e0b;
    letter-spacing: 1px;
}

.rating-comment-wrap {
    margin-top: 1rem;
}

.rating-comment-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--ink);
}

.rating-textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 12px;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--ink);
    background: #fafbfd;
    resize: vertical;
    transition: border-color 0.15s;
}

.rating-textarea:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px var(--green-soft);
}

.rating-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.rating-message          { font-size: 0.875rem; }
.rating-message.success  { color: var(--green-deep); }
.rating-message.error    { color: var(--red); }

.rating-already-submitted {
    color: var(--mute);
    font-size: 0.9375rem;
}

.rating-summary {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--navy);
}

.rating-thankyou {
    padding: 1rem;
    text-align: center;
    color: var(--green-deep);
    font-size: 0.9375rem;
    font-weight: 500;
}

/* --- Grid2 (docs + rating two column layout) --------------------------------- */
.grid2 {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 18px;
}

/* --- Section gap utility ----------------------------------------------------- */
.sec-gap {
    height: 18px;
}

/* Consistent vertical rhythm between stacked sections on order detail page */
.wrap > .card + .card,
.wrap > .stats + .card,
.wrap > .stats + .shipsgo-card,
.wrap > .shipsgo-card + .card {
    margin-top: 20px;
}

/* --- Tracking / Shipsgo section ---------------------------------------------- */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.tracking-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--mute);
    font-size: 0.875rem;
    padding: 1rem 0;
}

.tracking-loading::before {
    content: '';
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--line);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

.tracking-error {
    color: var(--red);
    font-size: 0.875rem;
    padding: 1rem 0;
}

.shipsgo-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    margin-bottom: 18px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.shipsgo-head {
    background: var(--navy);
    padding: 0.8125rem 1.125rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.shipsgo-title {
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.shipsgo-ref {
    font-family: 'Courier New', monospace;
    font-size: 0.6875rem;
    background: rgba(255,255,255,.12);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    color: rgba(255,255,255,.8);
}

.map-card-body {
    overflow: hidden;
    border-radius: 0 0 var(--r) var(--r);
}

.map-card-body iframe {
    width: 100%;
    height: 650px;
    border: none;
    display: block;
}

/* --- Movement events (portal.js injected) ------------------------------------ */
.movements-wrap {
    padding: 0.25rem 0;
}

.port-group {
    border-bottom: 1px solid var(--line);
}

.port-group:last-child {
    border-bottom: none;
}

.port-header {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.875rem 1.25rem 0.625rem;
    background: var(--bg);
}

.port-icon {
    flex-shrink: 0;
    opacity: 0.6;
}

.port-code {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--navy);
}

.port-name {
    font-size: 0.75rem;
    color: var(--mute);
    font-weight: 500;
    margin-left: 2px;
}

.movement-row {
    display: flex;
    align-items: center;
    padding: 0.625rem 1.25rem;
    border-top: 1px solid var(--line);
    transition: background .1s;
}

.movement-row:hover {
    background: #f6f9fc;
}

.mv-type {
    width: 52px;
    flex-shrink: 0;
}

.mv-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.2em 0.45em;
    border-radius: 4px;
    border: 1px solid transparent;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: .04em;
    white-space: nowrap;
}

.mv-load  { background: var(--blue-soft);   color: var(--blue);         border-color: var(--mv-load-border); }
.mv-depa  { background: var(--amber-soft);  color: var(--amber);        border-color: var(--mv-depa-border); }
.mv-arrv  { background: var(--green-soft);  color: var(--green-deep);   border-color: var(--mv-arrv-border); }
.mv-disc  { background: var(--mv-disc-bg);  color: var(--mv-disc-fg);   border-color: var(--mv-disc-border); }
.mv-other { background: var(--bg);          color: var(--mute);          border-color: var(--line); }

.mv-date {
    width: 90px;
    flex-shrink: 0;
}

.mv-date-main {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--navy);
}

.mv-date-year {
    font-size: 0.6875rem;
    color: var(--mute);
}

.mv-vessel {
    flex: 1;
    min-width: 0;
}

.mv-vessel-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--navy);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mv-voyage {
    font-size: 0.6875rem;
    color: var(--mute);
    margin-top: 1px;
}

.mv-status {
    width: 28px;
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
}

.mv-dot-done {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--green-soft);
    border: 1.5px solid var(--mv-dot-done-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--green-deep);
}

.mv-dot-pending {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--mv-dot-pending-bg);
}

/* --- Document type badges (portal.js) ---------------------------------------- */
.doc-type-badge {
    display: inline-block;
    padding: 0.2em 0.65em;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}

.doc-type-badge--supporting { background: var(--blue-soft);  color: var(--blue); }
.doc-type-badge--container  { background: var(--green-soft); color: var(--green-deep); }

/* --- PDF Modal --------------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,18,30,.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal-box {
    background: var(--card);
    border-radius: var(--r);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(12px);
    transition: transform 0.2s ease;
}

.modal-overlay.open .modal-box {
    transform: translateY(0);
}

.modal-head {
    padding: 0.875rem 1.125rem;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--navy);
}

.modal-subtitle {
    font-size: 0.6875rem;
    color: var(--mute);
    margin-top: 2px;
}

.modal-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: var(--bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--mute);
    font-size: 16px;
    line-height: 1;
    transition: background .15s, color .15s;
}

.modal-close:hover {
    background: var(--line);
    color: var(--navy);
}

.modal-body {
    flex: 1;
    overflow: hidden;
    background: #525659;
}

.modal-body iframe {
    width: 100%;
    height: 100%;
    min-height: 70vh;
    border: none;
    display: block;
}

/* --- Form groups (login.php) ------------------------------------------------- */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.375rem;
}

/* --- Text utilities ---------------------------------------------------------- */
.text-right  { text-align: right; }
.text-muted  { color: var(--mute); }
.text-small  { font-size: 0.8125rem; }

/* --- Skip link --------------------------------------------------------------- */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: 9999;
    background: var(--navy);
    color: var(--card);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: top 0.15s;
}

.skip-link:focus {
    top: 0.75rem;
}

/* --- Responsive --------------------------------------------------------------- */
@media (max-width: 880px) {
    .grid2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .toolbar-row {
        flex-direction: column;
        align-items: stretch;
    }

    .search-wrap {
        min-width: 0;
    }

    .selectbox {
        width: 100%;
    }

    .selectbox select {
        width: 100%;
    }

    .orderhead-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .kv-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .tracker {
        padding: 18px 16px;
    }

    .node-label,
    .node-date,
    .node-place {
        font-size: 10px;
    }

    .hero-band {
        padding: 18px 16px;
    }

    .hero-h {
        font-size: 19px;
    }

    .rating-questions {
        flex-direction: column;
        gap: 1.25rem;
    }

    .tbl-foot {
        gap: 18px;
    }
}

@media (max-width: 680px) {
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .wrap,
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .topbar-inner,
    .pagehead-inner,
    .orderhead-inner {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .who .avatar + span {
        display: none;
    }

    .page-title {
        font-size: 21px;
    }

    .order-id {
        font-size: 22px;
    }

    .hero-actions {
        display: none;
    }

    .track-line {
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .node {
        min-width: 70px;
    }

    .pager {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

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

/* --- Reduced motion ----------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
