/* Customer portal stylesheet — independent of /Portal/portal.css.
   Brand palette mirrors PASOI but the customer surface is intentionally
   simpler: no nav drawer, no admin toolbar, no role-conditional UI. */
:root {
    --brand-primary:   #3d5a73;
    --brand-secondary: #5a7a9b;
    --brand-accent:    #b0c4d8;
    --bg-body:         #f4f5f7;
    --bg-card:         #ffffff;
    --text-primary:    #1a2332;
    --text-soft:       #5a6a7e;
    --border:          #d1d8e0;
    --border-soft:     rgba(0,0,0,0.06);
    --good-green:      #2ecc40;
    --warn-yellow:     #f1c40f;
    --decline-red:     #e74c3c;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg-body:      #1a2332;
        --bg-card:      #2d3b50;
        --text-primary: #e0e6ed;
        --text-soft:    #9aa6b8;
        --border:       #3a4a60;
        --border-soft:  rgba(255,255,255,0.08);
    }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.cust {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100dvh;
    line-height: 1.5;
}
body.cust--centered {
    display: flex; align-items: center; justify-content: center;
    padding: 24px 16px;
}

/* --- Topbar ----------------------------------------------------------- */
.cust-topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 22px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: #fff;
}
.cust-topbar__brand {
    font-weight: 700; font-size: 16px; letter-spacing: 0.3px;
    color: #fff; text-decoration: none;
}
.cust-topbar__user { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.cust-topbar__name { opacity: 0.92; }
.cust-topbar__logout {
    color: #fff; text-decoration: none;
    padding: 6px 12px; border: 1px solid rgba(255,255,255,0.4); border-radius: 6px;
    font-size: 12px;
}
.cust-topbar__logout:hover { background: rgba(255,255,255,0.10); }

/* --- Page chrome ------------------------------------------------------ */
.cust-main { max-width: 720px; margin: 0 auto; padding: 24px 18px 40px; }
.cust-main h1 { font-size: 22px; margin: 0 0 16px; }
.cust-back { margin: 0 0 8px; }
.cust-back a { color: var(--brand-secondary); text-decoration: none; font-size: 13px; }
.cust-back a:hover { text-decoration: underline; }

.cust-banner {
    padding: 10px 14px; border-radius: 8px; margin-bottom: 14px;
    font-size: 14px; border: 1px solid;
}
.cust-banner--error { color: var(--decline-red); border-color: var(--decline-red); background: rgba(231,76,60,0.08); }

/* --- Auth card (login + set-password + landing notices) --------------- */
.cust-card {
    width: 100%; max-width: 380px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.06);
}
.cust-card__title { margin: 0 0 4px; font-size: 22px; }
.cust-card__sub   { margin: 0 0 20px; color: var(--text-soft); font-size: 14px; }
.cust-card__foot  { margin: 16px 0 0; font-size: 12px; color: var(--text-soft); }

.cust-form { display: flex; flex-direction: column; gap: 14px; }
.cust-form label {
    display: flex; flex-direction: column; gap: 6px;
    font-size: 12px; font-weight: 600; letter-spacing: 0.3px;
    color: var(--text-soft); text-transform: uppercase;
}
.cust-form input {
    font: inherit; padding: 10px 12px;
    background: var(--bg-card); color: var(--text-primary);
    border: 1px solid var(--border); border-radius: 8px;
    text-transform: none; letter-spacing: normal;
}
.cust-form input:focus { outline: 2px solid var(--brand-secondary); outline-offset: 1px; }
.cust-form input:disabled { opacity: 0.7; }

.cust-btn {
    display: inline-block; padding: 11px 18px;
    background: var(--brand-secondary); color: #fff;
    border: 0; border-radius: 8px; font-weight: 700;
    cursor: pointer; text-decoration: none; font-size: 14px;
}
.cust-btn:hover { filter: brightness(1.08); }

/* --- Dashboard show list ---------------------------------------------- */
.cust-empty {
    text-align: center; padding: 32px 16px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
    color: var(--text-soft);
}
.cust-empty__hint { font-size: 13px; }

.cust-show-list { list-style: none; padding: 0; margin: 0;
    display: grid; gap: 10px; }
.cust-show-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.cust-show-card:hover { border-color: var(--brand-secondary); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.cust-show-card a {
    display: block; padding: 14px 16px;
    color: inherit; text-decoration: none;
}
.cust-show-card__name { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.cust-show-card__meta {
    display: flex; gap: 12px; flex-wrap: wrap;
    color: var(--text-soft); font-size: 12px;
}
.cust-show-card__stage::before { content: '· '; }
.cust-show-card__loc::before { content: '· '; }

/* --- Show detail sections --------------------------------------------- */
.cust-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 18px;
    margin: 0 0 14px;
}
.cust-section h2 {
    margin: 0 0 10px;
    font-size: 14px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-soft);
}
.cust-section--placeholder { opacity: 0.75; }
.cust-empty-line { margin: 0; color: var(--text-soft); font-size: 13px; }

.cust-detail-grid {
    display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px;
    margin: 0;
}
.cust-detail-grid dt { color: var(--text-soft); font-size: 13px; }
.cust-detail-grid dd { margin: 0; font-size: 14px; }

.cust-crew-list, .cust-truck-list { list-style: none; padding: 0; margin: 0; }
.cust-crew-row, .cust-truck-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-soft);
}
.cust-crew-row:last-child, .cust-truck-row:last-child { border-bottom: 0; }
.cust-crew-row__name, .cust-truck-row__truck { font-weight: 600; font-size: 14px; }
.cust-crew-row__role, .cust-truck-row__driver { color: var(--text-soft); font-size: 12px; }
.cust-truck-row__task::before { content: ' · '; color: var(--text-soft); font-weight: 400; }
.cust-crew-row__phone, .cust-truck-row__phone {
    color: var(--brand-secondary); text-decoration: none; font-size: 13px;
    padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px;
}
.cust-crew-row__phone:hover, .cust-truck-row__phone:hover {
    background: rgba(90,122,155,0.08);
}

/* --- Documents on show detail ----------------------------------------- */
.cust-doc-list { list-style: none; padding: 0; margin: 0; }
.cust-doc-row {
    border-bottom: 1px solid var(--border-soft);
}
.cust-doc-row:last-child { border-bottom: 0; }
.cust-doc-row__link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 4px;
    color: inherit; text-decoration: none;
}
.cust-doc-row__link:hover { color: var(--brand-secondary); }
.cust-doc-row__icon {
    font-size: 18px; line-height: 1;
    flex: 0 0 auto;
    width: 30px; text-align: center;
}
.cust-doc-row__body { min-width: 0; flex: 1 1 auto; }
.cust-doc-row__label { display: block; font-weight: 600; font-size: 14px; }
.cust-doc-row__meta  { display: block; font-size: 12px; color: var(--text-soft); margin-top: 2px;
                       overflow: hidden; text-overflow: ellipsis; }
.cust-doc-row__meta em { font-style: normal; color: var(--brand-secondary); }

/* --- View switcher: list ⇄ calendar on the dashboard ------------------ */
.cust-view-switcher {
    display: inline-flex; padding: 2px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
    margin-bottom: 16px;
}
.cust-view-switcher a {
    padding: 6px 14px; font-size: 13px; font-weight: 600;
    color: var(--text-soft); text-decoration: none; border-radius: 6px;
}
.cust-view-switcher a.is-active {
    background: var(--brand-secondary); color: #fff;
}

/* --- Calendar grid (mirrors LaborGrid's month view) ------------------- */
.cust-cal {
    background: var(--bg-card);
    border: 1px solid var(--border); border-radius: 10px;
    padding: 14px; overflow: hidden;
}
.cust-cal__head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px;
}
.cust-cal__title { font-size: 16px; font-weight: 700; }
.cust-cal__nav a {
    display: inline-block; padding: 6px 10px;
    color: var(--brand-secondary); text-decoration: none; font-size: 14px;
    border: 1px solid var(--border); border-radius: 6px;
    margin-left: 4px;
}
.cust-cal__nav a:hover { background: rgba(90,122,155,0.08); }
.cust-cal__nav a.is-today {
    background: var(--brand-secondary); color: #fff; border-color: var(--brand-secondary);
}
.cust-cal__weekdays {
    display: grid; grid-template-columns: repeat(7, 1fr);
    gap: 2px; margin-bottom: 4px;
}
.cust-cal__weekday {
    text-align: center; font-size: 10px; font-weight: 700;
    color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.4px;
    padding: 4px 0;
}
.cust-cal__grid {
    display: grid; grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: minmax(70px, auto);
    gap: 2px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.cust-cal__cell {
    background: var(--bg-card);
    padding: 4px 6px;
    min-height: 70px;
    position: relative;
    display: flex; flex-direction: column; gap: 2px;
}
.cust-cal__cell--other-month { background: var(--bg-body); opacity: 0.6; }
.cust-cal__cell--today .cust-cal__daynum {
    background: var(--brand-secondary); color: #fff;
    border-radius: 50%; width: 22px; height: 22px;
    display: inline-flex; align-items: center; justify-content: center;
}
.cust-cal__daynum { font-size: 11px; font-weight: 700; color: var(--text-soft); }
.cust-cal__bar {
    background: var(--brand-secondary); color: #fff;
    font-size: 11px; font-weight: 600;
    padding: 3px 6px; border-radius: 4px;
    text-decoration: none;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    display: block;
    line-height: 1.3;
}
.cust-cal__bar:hover { filter: brightness(1.1); }
.cust-cal__empty {
    text-align: center; padding: 28px 8px;
    color: var(--text-soft); font-size: 13px;
}

@media (max-width: 600px) {
    .cust-cal__grid { grid-auto-rows: minmax(56px, auto); }
    .cust-cal__cell { min-height: 56px; padding: 3px 4px; }
    .cust-cal__bar { font-size: 10px; padding: 2px 4px; }
    .cust-cal__daynum { font-size: 10px; }
}

/* --- Wider main column for the unified layout ----------------------- */
.cust-main--wide { max-width: 960px; }

/* --- Button reset for calendar bars (was <a>, now <button>) -------- */
.cust-cal__bar {
    border: 0; cursor: pointer;
    font-family: inherit;
    text-align: left;
    width: 100%;
}

/* --- Show table ---------------------------------------------------- */
.cust-table-section { margin-top: 18px; }
.cust-table-section__title {
    font-size: 14px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-soft);
    margin: 0 0 10px;
}
.cust-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    font-size: 14px;
}
.cust-table thead th {
    text-align: left;
    padding: 10px 14px;
    background: rgba(90,122,155,0.06);
    border-bottom: 1px solid var(--border);
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
    font-weight: 700;
    color: var(--text-soft);
}
.cust-table tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-soft);
}
.cust-table tbody tr:last-child td { border-bottom: 0; }
.cust-table__row { cursor: pointer; transition: background 0.12s; }
.cust-table__row:hover { background: rgba(90,122,155,0.07); }
.cust-table__row--past td { opacity: 0.72; }
.cust-table__divider td {
    background: rgba(90,122,155,0.04);
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-soft);
    padding: 8px 14px;
    text-align: center;
}
.cust-table__name  { font-weight: 600; }
.cust-table__dates { color: var(--text-soft); font-size: 13px; white-space: nowrap; }

@media (max-width: 600px) {
    /* On narrow viewports collapse location + stage columns — they're
       on the side card anyway. Keep name + dates so the row stays
       informative. */
    .cust-table thead th:nth-child(3),
    .cust-table thead th:nth-child(4),
    .cust-table tbody td:nth-child(3),
    .cust-table tbody td:nth-child(4) { display: none; }
}

/* --- Slide-in show side card --------------------------------------- */
.cust-side {
    position: fixed; inset: 0;
    z-index: 1000;
    pointer-events: none; /* enabled when .is-open via panel/backdrop */
}
.cust-side[hidden] { display: none !important; }
.cust-side__backdrop {
    position: absolute; inset: 0;
    background: rgba(10,18,30,0.55);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: auto;
}
.cust-side__panel {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: min(480px, 100vw);
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    box-shadow: -16px 0 40px rgba(0,0,0,0.30);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    display: flex; flex-direction: column;
    pointer-events: auto;
    overflow: hidden;
}
.cust-side.is-open .cust-side__backdrop { opacity: 1; }
.cust-side.is-open .cust-side__panel    { transform: translateX(0); }

.cust-side__head {
    flex: 0 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: #fff;
}
.cust-side__title {
    margin: 0;
    font-size: 18px; font-weight: 700;
    line-height: 1.25;
    word-break: break-word;
}
.cust-side__close {
    flex: 0 0 auto;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    width: 32px; height: 32px;
    font-size: 22px; line-height: 1;
    border-radius: 6px;
    cursor: pointer;
}
.cust-side__close:hover { background: rgba(255,255,255,0.22); }
.cust-side__body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px 20px 24px;
    -webkit-overflow-scrolling: touch;
}
.cust-side__loading {
    padding: 24px 0;
    text-align: center;
    color: var(--text-soft);
    font-size: 13px;
}
.cust-side__error {
    padding: 12px 14px;
    background: rgba(231,76,60,0.10);
    border: 1px solid var(--decline-red);
    border-radius: 8px;
    color: var(--decline-red);
    font-size: 13px;
}
.cust-side-section {
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    margin: 0 0 12px;
}
.cust-side-section h3 {
    margin: 0 0 8px;
    font-size: 12px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-soft);
}

@media (max-width: 600px) {
    .cust-side__panel { width: 100vw; border-left: 0; }
    .cust-side__head  { padding: 12px 16px; }
    .cust-side__body  { padding: 12px 16px 20px; }
}
