/* ==========================================================================
   Service Report POC - base styles
   ========================================================================== */

:root {
    --brand: #8b2e22;           /* Gyro logo red */
    --brand-600: #74251b;
    --brand-050: #fbf1ef;
    --brand-100: #f4dcd7;
    --accent: #e3b21f;          /* Gyro logo yellow */
    --ink: #1b2430;
    --ink-2: #3c4857;
    --muted: #677485;
    --line: #e3e7ed;
    --line-2: #d3d9e2;
    --bg: #f4f6f9;
    --surface: #ffffff;
    --sidebar: #16202b;
    --sidebar-2: #1f2b38;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .05);
    --sidebar-w: 264px;
    --topbar-h: 64px;

    --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--bg);
    --bs-border-color: var(--line);
    --bs-link-color: var(--brand);
    --bs-link-color-rgb: 139, 46, 34;
    --bs-link-hover-color: var(--brand-600);
    --bs-primary: var(--brand);
    --bs-primary-rgb: 139, 46, 34;
    --bs-focus-ring-color: rgba(139, 46, 34, .2);
}

html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--bs-body-font-family);
    color: var(--ink);
    background: var(--bg);
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Buttons ---------- */
.btn {
    --bs-btn-font-weight: 600;
    --bs-btn-border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
}
.btn-sm { min-height: 34px; --bs-btn-border-radius: 8px; gap: 5px; }
.btn-lg { min-height: 52px; }
.btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-600);
    --bs-btn-hover-border-color: var(--brand-600);
    --bs-btn-active-bg: var(--brand-600);
    --bs-btn-active-border-color: var(--brand-600);
    --bs-btn-disabled-bg: var(--brand);
    --bs-btn-disabled-border-color: var(--brand);
    --bs-btn-focus-shadow-rgb: 139, 46, 34;
}
.btn-outline-primary {
    --bs-btn-color: var(--brand);
    --bs-btn-border-color: var(--brand-100);
    --bs-btn-bg: #fff;
    --bs-btn-hover-bg: var(--brand-050);
    --bs-btn-hover-color: var(--brand-600);
    --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand-100);
    --bs-btn-active-color: var(--brand-600);
    --bs-btn-active-border-color: var(--brand);
}
.btn-outline-secondary {
    --bs-btn-color: var(--ink-2);
    --bs-btn-border-color: var(--line-2);
    --bs-btn-bg: #fff;
    --bs-btn-hover-bg: #f1f3f6;
    --bs-btn-hover-color: var(--ink);
    --bs-btn-hover-border-color: var(--line-2);
    --bs-btn-active-bg: #e8ebf0;
    --bs-btn-active-color: var(--ink);
    --bs-btn-active-border-color: var(--line-2);
}
.btn-link { --bs-btn-color: var(--brand); --bs-btn-hover-color: var(--brand-600); }
.btn-icon {
    width: 44px; height: 44px; padding: 0;
    border-radius: 12px; border: 0; background: transparent;
    font-size: 26px; color: var(--ink);
}
.btn-icon:hover { background: #eef1f5; }

/* ---------- Forms ---------- */
.form-label { font-weight: 600; font-size: 13.5px; color: var(--ink-2); margin-bottom: 6px; }
.form-control, .form-select {
    min-height: 48px;
    border-radius: var(--radius-sm);
    border-color: var(--line-2);
    font-size: 16px;               /* avoids iOS zoom on focus */
    color: var(--ink);
    background-color: #fff;
}
.form-control-sm { min-height: 38px; font-size: 15px; }
.form-control:focus, .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .22rem rgba(139, 46, 34, .14);
}
.form-control[readonly] { background: #f3f5f8; color: var(--ink-2); font-weight: 600; }
textarea.form-control { min-height: 48px; line-height: 1.45; }
.form-text { color: var(--muted); font-size: 13px; }

/* ==========================================================================
   App shell
   ========================================================================== */
.app-shell { min-height: 100vh; }

.app-sidebar { --bs-offcanvas-width: 284px; border-right: 0 !important; }
.sidebar-inner {
    display: flex; flex-direction: column;
    height: 100%;
    background: #ffffff;
    border-right: 1px solid var(--line);
    color: var(--ink-2);
    padding: 16px 14px;
    overflow-y: auto;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 4px 6px 18px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 14px;
}
.brand-logo {
    display: inline-flex; align-items: center; justify-content: center;
    width: 64px; height: 40px; border-radius: 10px;
    background: #fff; border: 1px solid var(--line); padding: 4px 6px; flex: none;
}
.brand-logo img { max-width: 100%; max-height: 100%; }
.brand-text { line-height: 1.2; }
.brand-text strong { display: block; color: var(--ink); font-size: 15px; }
.brand-text small { color: var(--muted); font-size: 12px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group-label {
    margin: 16px 10px 6px;
    font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: #98a2b0;
}
.nav-item-link {
    position: relative;
    display: flex; align-items: center; gap: 12px;
    min-height: 46px; padding: 0 12px;
    border-radius: 10px;
    color: var(--ink-2); text-decoration: none; font-weight: 500;
    transition: background .15s, color .15s;
}
.nav-item-link i { font-size: 18px; width: 20px; text-align: center; color: #7b8697; transition: color .15s; }
.nav-item-link:hover { background: #f3f5f8; color: var(--ink); }
.nav-item-link:hover i { color: var(--ink-2); }
.nav-item-link.active { background: var(--brand-050); color: var(--brand); font-weight: 600; }
.nav-item-link.active i { color: var(--brand); }
.nav-item-link.active::before {
    content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px;
    width: 4px; border-radius: 0 4px 4px 0; background: var(--brand);
}
.nav-item-link.active .nav-count { background: var(--brand); color: #fff; }
.nav-count {
    margin-left: auto;
    min-width: 24px; height: 22px; padding: 0 7px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 999px; font-size: 12px; font-weight: 700;
    background: #fff4d6; color: #8a5a00;
}
.sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-bottom: 6px; border-radius: 12px; background: #f7f8fa; }
.user-meta { line-height: 1.25; min-width: 0; }
.user-meta strong { display: block; color: var(--ink); font-size: 14px; }
.user-meta small { color: var(--muted); font-size: 12px; }
.poc-note { font-size: 11px; color: #98a2b0; padding: 10px 12px 0; }

.avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 50%; flex: none;
    background: var(--brand); color: #fff; font-weight: 700; font-size: 14px;
}
.avatar-sm { width: 36px; height: 36px; font-size: 13px; }

.app-main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

.app-topbar {
    position: sticky; top: 0; z-index: 1020;
    display: flex; align-items: center; gap: 12px;
    min-height: var(--topbar-h);
    padding: 10px 28px;
    background: rgba(244, 246, 249, .9);
    backdrop-filter: saturate(160%) blur(8px);
    -webkit-backdrop-filter: saturate(160%) blur(8px);
    border-bottom: 1px solid var(--line);
}
.topbar-title { flex: 1; min-width: 0; line-height: 1.2; }
.topbar-title h1 { font-size: 20px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.topbar-sub { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.app-content { flex: 1; padding: 24px 28px 32px; width: 100%; max-width: 1320px; }

@media (min-width: 992px) {
    .app-sidebar { position: fixed !important; top: 0; bottom: 0; left: 0; width: var(--sidebar-w); z-index: 1030; }
    .app-sidebar .sidebar-inner { height: 100vh; }
    .app-main { margin-left: var(--sidebar-w); }
}

/* ==========================================================================
   Common components
   ========================================================================== */
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 18px 20px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.panel-head h3 { font-size: 16px; font-weight: 700; margin: 0; display: flex; align-items: center; gap: 8px; }
.panel-link { font-size: 13.5px; font-weight: 600; text-decoration: none; white-space: nowrap; }

.badge-status {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px 3px 8px; border-radius: 999px;
    font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge-status i { font-size: 11px; }
.badge-status.is-pending { background: #fff4d6; color: #8a5a00; }
.badge-status.is-completed { background: #e2f5e9; color: #1e6b3a; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }
.chip {
    display: inline-flex; align-items: center;
    padding: 2px 9px; border-radius: 6px;
    background: #eef1f5; color: var(--ink-2);
    font-size: 12px; font-weight: 600;
}

.empty-state {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 32px 16px; color: var(--muted); text-align: center; font-size: 14px;
}
.empty-state i { font-size: 28px; opacity: .6; }

.back-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; text-decoration: none; margin-bottom: 12px; }

/* ---------- Dashboard ---------- */
.welcome {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 22px 24px; margin-bottom: 18px;
    border-radius: var(--radius);
    background:
        radial-gradient(circle at 92% 10%, rgba(227, 178, 31, .28), transparent 45%),
        linear-gradient(120deg, #7a271d 0%, #8b2e22 45%, #b04a34 100%);
    color: #fff;
    box-shadow: var(--shadow);
}
.welcome-hi { margin: 0; opacity: .75; font-size: 14px; }
.welcome-name { margin: 2px 0 0; font-size: 22px; font-weight: 700; }
.welcome-cta { font-weight: 600; }

.stat-card {
    display: flex; flex-direction: column; gap: 2px;
    height: 100%;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    color: var(--ink); text-decoration: none;
    transition: transform .15s, box-shadow .15s;
}
a.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); color: var(--ink); }
.stat-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 12px; font-size: 19px; margin-bottom: 10px;
}
.tone-slate { background: #eef1f5; color: #3c4857; }
.tone-amber { background: #fff4d6; color: #a86d00; }
.tone-green { background: #e2f5e9; color: #1e6b3a; }
.tone-brand { background: var(--brand-050); color: var(--brand); }
.stat-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }

.sr-list { display: flex; flex-direction: column; }
.sr-row {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 4px;
    border-top: 1px solid var(--line);
    color: var(--ink); text-decoration: none;
}
.sr-row:first-child { border-top: 0; }
.sr-row:hover { color: var(--ink); background: #fafbfc; }
.sr-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sr-row-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sr-no { font-weight: 700; color: var(--brand); text-decoration: none; letter-spacing: .01em; }
.sr-row-cust { font-weight: 600; font-size: 14.5px; }
.sr-row-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.sr-row-meta span { display: inline-flex; align-items: center; gap: 5px; }
.sr-row-go { color: #a7b1be; font-size: 16px; }

.fab {
    position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom));
    width: 58px; height: 58px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand); color: #fff; font-size: 26px;
    box-shadow: 0 8px 20px rgba(139, 46, 34, .35);
    z-index: 1010;
}
.fab:hover { color: #fff; background: var(--brand-600); }

/* ---------- Lists (Pending / Completed) ---------- */
.list-toolbar { display: flex; gap: 12px; margin-bottom: 16px; }
.search-box { position: relative; flex: 1; max-width: 460px; }
.search-box i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box .form-control { padding-left: 40px; background: #fff; }

.sr-table { --bs-table-bg: transparent; font-size: 14px; }
.sr-table thead th {
    background: #f7f8fa; color: var(--muted);
    font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.sr-table tbody td { padding: 14px; border-color: var(--line); }
.sr-table tbody tr:hover { background: #fafbfc; }
.sr-table .btn-sm { min-height: 32px; font-size: 13px; }

.card-list { display: flex; flex-direction: column; gap: 12px; }
.sr-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.sr-card-body { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; color: var(--ink); text-decoration: none; }
.sr-card-body:hover { color: var(--ink); }
.kv-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 2px 0 0; }
.kv-mini div { min-width: 0; }
.kv-mini dt { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.kv-mini dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.sr-card-actions { display: flex; border-top: 1px solid var(--line); }
.sr-card-actions a, .sr-card-actions button {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 48px; font-weight: 600; font-size: 14px;
    color: var(--ink-2); text-decoration: none;
    border: 0; background: none; padding: 0;
}
.sr-card-actions > * + * { border-left: 1px solid var(--line); }
.sr-card-actions a.is-primary { color: var(--brand); }
.sr-card-actions button.is-danger { color: #c0392b; }
.sr-card-actions a:active, .sr-card-actions button:active { background: #f1f3f6; }

/* ==========================================================================
   Create / Edit SR
   ========================================================================== */
.sr-form, .sr-view { max-width: 980px; }

.form-hero {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 16px 18px; margin-bottom: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.form-hero-main { display: flex; flex-direction: column; min-width: 0; }
.form-hero-label { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
.form-hero-no { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.form-hero-hint { font-size: 12.5px; color: var(--muted); }
.form-hero-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

.sr-accordion { --bs-accordion-border-color: var(--line); --bs-accordion-btn-focus-box-shadow: none; --bs-accordion-active-bg: #fff; --bs-accordion-active-color: var(--ink); display: flex; flex-direction: column; gap: 12px; }
.sr-accordion .accordion-item {
    border: 1px solid var(--line) !important;
    border-radius: var(--radius) !important;
    overflow: visible;                 /* lets the Tool ID dropdown extend outside the card */
    box-shadow: var(--shadow-sm);
}
.sr-accordion .accordion-button {
    gap: 12px; padding: 14px 16px; min-height: 64px;
    font-weight: 700; font-size: 15.5px; color: var(--ink);
    border-radius: var(--radius) !important;
}
.sr-accordion .accordion-button:not(.collapsed) { box-shadow: inset 0 -1px 0 var(--line); border-radius: var(--radius) var(--radius) 0 0 !important; }
.sec-icon {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 38px; height: 38px; border-radius: 10px;
    background: var(--brand-050); color: var(--brand); font-size: 17px;
}
.sec-title { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sec-title small { font-weight: 500; font-size: 12.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec-badge { margin-left: auto; margin-right: 10px; font-size: 13px; font-weight: 700; color: var(--brand); background: var(--brand-050); padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.sr-accordion .accordion-body { padding: 18px 16px 20px; }

/* Large check tiles (Problem Encountered / Service) */
.check-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.check-tiles-2 { grid-template-columns: 1fr 1fr; }
.check-tile { position: relative; margin: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.check-tile input { position: absolute; opacity: 0; pointer-events: none; }
.check-tile span {
    display: flex; align-items: center; gap: 10px;
    min-height: 54px; padding: 10px 14px;
    border: 1.5px solid var(--line-2); border-radius: 12px;
    background: #fff; font-weight: 600; font-size: 15px; line-height: 1.25;
    transition: border-color .12s, background .12s;
}
.check-tile span i {
    flex: none; width: 24px; height: 24px; border-radius: 6px;
    border: 2px solid #b4bdc9; color: transparent;
    display: inline-flex; align-items: center; justify-content: center; font-size: 16px;
    transition: all .12s;
}
.check-tile input:checked + span { border-color: var(--brand); background: var(--brand-050); color: var(--brand-600); }
.check-tile input:checked + span i { background: var(--brand); border-color: var(--brand); color: #fff; }
.check-tile input:focus-visible + span { box-shadow: 0 0 0 .22rem rgba(139, 46, 34, .2); }

/* Numbered dynamic lines (Problem / Action Taken / References) */
.line-list { display: flex; flex-direction: column; gap: 10px; }
.line-item { display: flex; align-items: flex-start; gap: 10px; }
.line-no {
    flex: none; width: 30px; height: 30px; margin-top: 9px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; background: #eef1f5; color: var(--ink-2); font-weight: 700; font-size: 13px;
}
.line-item textarea { flex: 1; resize: vertical; }
.btn-remove {
    flex: none; display: inline-flex; align-items: center; justify-content: center;
    min-width: 44px; height: 48px; padding: 0 10px;
    border: 0; border-radius: 10px; background: transparent;
    color: #9aa4b2; font-size: 17px;
}
.btn-remove:hover, .btn-remove:active { background: #fdecea; color: #c0392b; }
.btn-add {
    margin-top: 12px; width: 100%;
    border: 1.5px dashed var(--line-2); background: #fafbfc; color: var(--brand);
    min-height: 50px;
}
.btn-add:hover, .btn-add:active { border-color: var(--brand); background: var(--brand-050); color: var(--brand-600); }

/* Time Taken quick fill */
.time-helper { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.time-helper-label { font-size: 13px; color: var(--muted); font-weight: 600; display: inline-flex; gap: 5px; }
.time-helper .form-control { width: auto; flex: 1; min-width: 110px; max-width: 150px; }

/* Service items table (desktop) */
.items-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.items-table thead th {
    font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em;
    padding: 0 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.items-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.items-table .col-sno { width: 56px; text-align: center; }
.items-table .col-num { width: 130px; text-align: right; }
.items-table .col-act { width: 52px; text-align: right; }
.items-table .item-title { display: none; }
.items-table .col-sno .line-no { margin-top: 9px; }
.items-table textarea { resize: vertical; }
.items-table output { display: block; padding: 12px 4px 0; font-weight: 700; font-variant-numeric: tabular-nums; }

.total-box {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 16px; min-height: 56px;
    border-radius: 12px; background: #8b8e92; color: #fff;
}
.total-box span { font-weight: 600; font-size: 14px; opacity: .85; }
.total-box strong { font-size: 22px; font-variant-numeric: tabular-nums; }

/* Signature pad */
.sign-pad {
    position: relative; margin-top: 8px;
    height: 190px; border: 1.5px dashed var(--line-2); border-radius: 12px;
    background: #fff repeating-linear-gradient(0deg, transparent 0 149px, #eef1f5 149px 150px);
    touch-action: none;
}
.sign-pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.sign-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: #b4bdc9; font-weight: 600; pointer-events: none; }
.sign-pad.has-ink .sign-hint { display: none; }

/* Sticky bottom action bar */
.action-bar {
    position: sticky; bottom: 0; z-index: 1015;
    padding: 12px 28px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 16px rgba(16, 24, 40, .06);
}
.action-bar-inner { display: flex; gap: 10px; max-width: 980px; }
.action-bar .btn { min-height: 50px; padding: 0 20px; }
.action-bar .btn i { font-size: 18px; }

/* ---------- View SR ---------- */
.view-section h3 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.view-section h3 i { color: var(--brand); }
.kv { margin: 0; display: flex; flex-direction: column; }
.kv > div { display: flex; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.kv > div:first-child { border-top: 0; padding-top: 0; }
.kv dt { flex: 0 0 42%; font-weight: 500; color: var(--muted); font-size: 14px; }
.kv dd { margin: 0; flex: 1; font-weight: 600; font-size: 14.5px; overflow-wrap: anywhere; }
.kv-label { font-weight: 500; color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.check-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.check-sum { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px; background: #f3f5f8; color: var(--muted); font-weight: 600; font-size: 14px; }
.check-sum.is-on { background: var(--brand-050); color: var(--brand-600); }
.num-list { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.num-list li { padding-left: 4px; line-height: 1.5; }
.num-list li::marker { font-weight: 700; color: var(--muted); }
.view-items { display: flex; flex-direction: column; }
.view-item { display: grid; grid-template-columns: 56px 90px 1fr 110px 130px 130px; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); align-items: start; }
.view-item-head { border-top: 0; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.vi-num { text-align: right; font-variant-numeric: tabular-nums; }
.vi-amt { font-weight: 700; }
.sign-view { height: 140px; border: 1px solid var(--line); border-radius: 12px; display: flex; align-items: center; justify-content: center; background: #fafbfc; }
.sign-view img { max-height: 100%; max-width: 100%; }

/* ---------- Toast ---------- */
.toast { border: 0; border-radius: 12px; box-shadow: var(--shadow); }

/* ==========================================================================
   Login
   ========================================================================== */
/* Login: single box centred on the screen */
.login-body { background: var(--bg); min-height: 100vh; }
.login-wrap { display: flex; min-height: 100vh; min-height: 100dvh; }
.login-panel { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card {
    width: 100%; max-width: 400px;
    background: #fff; border: 1px solid var(--line); border-radius: 18px;
    box-shadow: var(--shadow); padding: 32px 28px;
}
.login-logo { display: flex; justify-content: center; margin-bottom: 14px; }
.login-logo img { height: 56px; }
.login-title { text-align: center; font-size: 22px; font-weight: 700; margin: 0; }
.login-sub { text-align: center; color: var(--muted); margin: 4px 0 22px; }
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 18px; pointer-events: none; }
.input-icon .form-control { padding-left: 44px; min-height: 52px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border: 0; background: transparent; color: var(--muted); font-size: 18px; border-radius: 10px; }
.pw-toggle:hover { background: #f1f3f6; }
.demo-creds {
    display: flex; gap: 10px; margin-top: 20px; padding: 12px 14px;
    border-radius: 12px; background: #f7f8fa; border: 1px solid var(--line);
    font-size: 13.5px; color: var(--ink-2);
}
.demo-creds > i { color: var(--brand); font-size: 17px; }
.demo-creds code { color: var(--brand); background: #fff; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line); }
.login-foot { margin-top: 18px; font-size: 12.5px; color: var(--muted); }

/* ---------- Master data driven fields (Create SR) ---------- */
.step-no {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; margin-right: 7px; border-radius: 50%;
    background: var(--brand); color: #fff; font-size: 11.5px; font-weight: 700; vertical-align: 1px;
}
.auto-tag {
    display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 5px;
    background: #e8f1fd; color: #1d5fb8; font-size: 10.5px; font-weight: 700; letter-spacing: .03em; vertical-align: 1px;
}
.form-control.is-auto { background: #f7faff; border-color: #d6e3f5; }
.form-control.is-auto[readonly] { color: var(--ink); font-weight: 500; }
.is-flash { animation: autoFlash 1.1s ease; }
@keyframes autoFlash { 0% { background: #fff3c4; border-color: var(--accent); } 100% { } }

.master-card {
    display: flex; flex-wrap: wrap; gap: 6px 18px;
    margin-top: 8px; padding: 10px 12px;
    border-radius: 10px; background: #f7f8fa; border: 1px solid var(--line);
    font-size: 13.5px; color: var(--ink-2);
}
.master-card[hidden] { display: none; }
.master-card > div { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.master-card i { color: var(--brand); }

/* Tool ID: dropdown with multiple selection */
.ms-select { position: relative; }
.ms-toggle {
    display: flex; align-items: center; gap: 8px;
    min-height: 48px; text-align: left; background-color: #fff;
    border-radius: var(--radius-sm); border-color: var(--line-2); font-size: 16px;
}
.ms-toggle:disabled { background-color: #f3f5f8; }
.ms-toggle[aria-expanded="true"] { border-color: var(--brand); box-shadow: 0 0 0 .22rem rgba(139, 46, 34, .14); }
.ms-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; color: var(--ink); }
.ms-text.is-placeholder { font-weight: 400; color: var(--muted); }
.ms-count {
    flex: none; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand); color: #fff; font-size: 12px; font-weight: 700;
}
.ms-count[hidden] { display: none; }
.ms-menu {
    width: 100%; padding: 6px; margin-top: 4px !important;
    border: 1px solid var(--line); border-radius: 12px;
    box-shadow: 0 10px 30px rgba(16, 24, 40, .14);
    max-height: 340px; overflow-y: auto;
}
.ms-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.ms-head .btn { min-height: 30px; padding: 0 4px; font-size: 13px; }
.ms-item {
    display: flex; align-items: center; gap: 12px;
    min-height: 52px; padding: 8px 10px; margin: 0;
    border-radius: 10px; cursor: pointer;
}
.ms-item:hover { background: #f5f7fa; }
.ms-item .form-check-input { width: 22px; height: 22px; margin: 0; flex: none; }
.ms-item .form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.ms-item .form-check-input:focus { box-shadow: 0 0 0 .2rem rgba(139, 46, 34, .18); border-color: var(--brand); }
.ms-item:has(input:checked) { background: var(--brand-050); }
.ms-item span { display: flex; flex-direction: column; line-height: 1.25; }
.ms-item b { font-weight: 700; }
.ms-item small { color: var(--muted); font-size: 12.5px; }
.ms-foot { padding: 6px 4px 2px; border-top: 1px solid var(--line); margin-top: 4px; }

/* ---------- Masters (read-only POC lists) ---------- */
.master-intro {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 16px; margin-bottom: 16px;
    border-radius: var(--radius); background: #fff; border: 1px solid var(--line);
    font-size: 14px; color: var(--ink-2);
}
.master-intro > i { font-size: 20px; color: var(--brand); }
.relation {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px;
    font-size: 12.5px; font-weight: 600;
}
.relation span { padding: 2px 8px; border-radius: 6px; background: var(--brand-050); color: var(--brand-600); }
.relation i { color: var(--muted); font-size: 12px; }
.filter-chip {
    display: inline-flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px;
    border-radius: 999px; background: var(--brand-050); color: var(--brand-600); font-weight: 600; font-size: 13.5px;
}
.filter-chip a { color: inherit; display: inline-flex; }
.count-link { font-weight: 700; text-decoration: none; }

/* Compact list cell ("SN001, ...") - all values in a tooltip */
.multi-val {
    padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left;
    border-bottom: 1px dashed var(--line-2); cursor: help; white-space: nowrap;
}
.multi-val:hover, .multi-val:focus-visible { color: var(--brand); border-bottom-color: var(--brand); outline: none; }
.multi-tip { --bs-tooltip-max-width: 280px; }
.multi-tip .tooltip-inner { text-align: left; white-space: pre-line; font-size: 12.5px; line-height: 1.5; }

/* Server-side list pager (App_Code/Helpers/ListPager.cs): Customer Master, Pending SR, Completed SR.
   One compact bar: range + rows per page | Previous / Page x of y / Next */
.page-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-top: 12px; padding: 8px 8px 8px 16px;
    background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px;
    font-size: 13.5px; color: var(--muted);
}
.page-bar-info { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.page-bar-range { white-space: nowrap; }
.page-bar-range strong { color: var(--ink-2); font-weight: 600; }
.page-bar-size { display: flex; align-items: center; gap: 8px; margin: 0; white-space: nowrap; }
.page-bar-size select {
    height: 32px; padding: 0 26px 0 10px; font: inherit; color: var(--ink-2);
    border: 1px solid var(--line-2); border-radius: 8px; background-color: var(--surface);
    -webkit-appearance: none; appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23667085' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right 8px center; background-size: 10px;
}
.page-bar-size select:focus { outline: 2px solid var(--brand-100); outline-offset: 1px; border-color: var(--brand); }
.page-bar-nav { display: inline-flex; align-items: stretch; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.pb-btn {
    display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 14px;
    background: var(--surface); color: var(--ink-2); font-weight: 600; text-decoration: none;
}
.pb-btn:hover { background: var(--brand-050); color: var(--brand); }
.pb-btn.is-disabled { color: var(--muted); opacity: .5; pointer-events: none; }
.pb-page {
    display: inline-flex; align-items: center; padding: 0 14px; white-space: nowrap;
    border-left: 1px solid var(--line-2); border-right: 1px solid var(--line-2);
}
.pb-page strong { color: var(--ink-2); font-weight: 600; }
@media (max-width: 575.98px) {
    .page-bar { flex-direction: column; align-items: stretch; gap: 10px; padding: 10px 12px; }
    .page-bar-info { justify-content: space-between; gap: 8px; }
    .page-bar-nav { width: 100%; }
    .pb-btn { flex: 1 1 0; justify-content: center; height: 44px; }
    .pb-page { flex: 1.3 1 0; justify-content: center; }
}

/* List pagination (desktop table and mobile cards) */
.list-pager {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
    margin-top: 12px; font-size: 13.5px; color: var(--muted);
}
.pager-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pager-btn {
    min-width: 36px; height: 36px; padding: 0 10px; border-radius: var(--radius-sm);
    border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font-weight: 600;
    display: inline-flex; align-items: center; justify-content: center;
}
.pager-btn:hover:not(:disabled) { background: var(--brand-050); border-color: var(--brand-100); color: var(--brand); }
.pager-btn.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager-btn:disabled { opacity: .45; }
.pager-gap { padding: 0 2px; }
.pager-compact { display: none; font-weight: 600; color: var(--ink-2); padding: 0 6px; }
@media (max-width: 575.98px) {
    .list-pager { justify-content: center; }
    .pager-info { width: 100%; text-align: center; }
    .pager-num, .pager-gap { display: none; }
    .pager-compact { display: inline; }
    .pager-btn { min-width: 44px; height: 44px; }
}

/* ==========================================================================
   Create SR - compact single page (sections always open + sticky jump bar)
   ========================================================================== */
.hero-date { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12px; font-weight: 600; color: var(--muted); }
.hero-date .form-control { min-height: 36px; width: 150px; font-size: 14px; padding: 4px 8px; }

.sec-nav {
    position: sticky; top: var(--topbar-h); z-index: 1010;
    display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
    margin: 0 -4px 10px; padding: 8px 4px;
    background: rgba(244, 246, 249, .95);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.sec-nav::-webkit-scrollbar { display: none; }
.sec-nav a {
    flex: none; display: inline-flex; align-items: center; gap: 6px;
    min-height: 36px; padding: 0 12px; border-radius: 999px;
    background: #fff; border: 1px solid var(--line-2);
    color: var(--ink-2); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.sec-nav a i { font-size: 14px; color: var(--muted); }
.sec-nav a.is-done { border-color: #9fd5b2; background: #eefaf2; color: #1e6b3a; }
.sec-nav a.is-done i::before { content: "\F26A"; color: #1e8a4a; }   /* bi-check-circle-fill */
.sec-nav a.is-active { border-color: var(--brand); background: var(--brand); color: #fff; }
.sec-nav a.is-active i, .sec-nav a.is-active.is-done i::before { color: #fff; }

.f-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); padding: 16px 18px 18px; margin-bottom: 12px;
    scroll-margin-top: calc(var(--topbar-h) + 60px);
}
.f-head { display: flex; align-items: center; gap: 8px; font-size: 15.5px; font-weight: 700; margin: 0 0 12px; }
.f-head > i { color: var(--brand); }
.f-done { margin-left: auto; color: #1e8a4a; display: none; }
.f-card.is-done .f-done { display: inline; }

.info-line {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
    margin-top: 6px; font-size: 13px; color: var(--muted);
}
.info-line[hidden] { display: none; }
.info-line a { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.info-line a[href] { color: var(--brand); }
.info-line i { color: var(--brand); }
.info-line .sep { color: #b4bdc9; }

.tool-summary {
    margin-top: 10px; padding: 10px 12px 12px;
    border-radius: 12px; background: #f7faff; border: 1px solid #d6e3f5;
}
.tool-summary-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 700; color: #1d5fb8; }
.tool-summary-head .btn { min-height: 30px; padding: 0 4px; font-size: 13px; }
.tool-kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 12px; margin: 4px 0 0; }
.tool-kv[hidden] { display: none; }
.tool-kv dt { font-size: 11px; font-weight: 600; color: var(--muted); }
.tool-kv dd { margin: 0; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.tool-summary.is-empty .tool-kv dd { color: #b4bdc9; font-weight: 500; }
.tool-edit { margin-top: 4px; }
.tool-edit[hidden] { display: none; }

.chip-toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-toggles-2 .chip-toggle { flex: 1 1 0; }
.chip-toggle { margin: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.chip-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.chip-toggle span {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%;
    min-height: 44px; padding: 0 16px; border-radius: 999px;
    border: 1.5px solid var(--line-2); background: #fff;
    font-weight: 600; font-size: 14.5px; line-height: 1.15; text-align: center;
    transition: all .12s;
}
.chip-toggle input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip-toggle input:checked + span::before { content: "\2713"; font-weight: 800; }
.chip-toggle input:focus-visible + span { box-shadow: 0 0 0 .22rem rgba(139, 46, 34, .2); }

/* Problem Encountered: checklist of the selected Problem Types (* = mandatory) */
.pcheck-empty { margin: 8px 0 0; color: var(--muted); font-size: 13.5px; }
.pcheck-group { margin-top: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.pcheck-group[hidden] { display: none; }
.pcheck-head { font-weight: 700; font-size: 13px; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.pcheck { display: flex; align-items: flex-start; gap: 10px; min-height: 40px; padding: 8px 6px; margin: 0; border-radius: 8px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.pcheck + .pcheck { border-top: 1px dashed var(--line); }
.pcheck .form-check-input { flex: 0 0 auto; width: 20px; height: 20px; margin: 0; }
.pcheck .form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.pcheck-no { flex: 0 0 auto; min-width: 22px; color: var(--muted); font-weight: 600; }
.pcheck-text { flex: 1 1 auto; overflow-wrap: anywhere; }
.pcheck-req { color: #dc3545; font-weight: 700; margin-left: 3px; }
.pcheck.is-invalid { background: #fdecee; }
.pcheck.is-invalid .form-check-input { border-color: #dc3545; }

.time-row { display: flex; align-items: center; gap: 8px; }
.time-row .form-control { flex: 1; min-width: 0; }
.time-row span { color: var(--muted); font-weight: 700; }

.charges { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line-2); }
.charges-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.charges-row .form-control { max-width: 150px; }

/* ==========================================================================
   Master screens (Add / Edit / Delete)
   ========================================================================== */
.filter-select { max-width: 280px; min-height: 48px; }
.m-card {
    display: flex; align-items: stretch;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); overflow: hidden;
}
.m-card-main {
    flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px;
    padding: 12px 14px; border: 0; background: transparent; text-align: left; color: var(--ink);
}
.m-card-main:active { background: #f5f7fa; }
.m-card-title { font-weight: 700; font-size: 15px; }
.m-card-title small { margin-left: 6px; padding: 1px 7px; border-radius: 6px; background: #eef1f5; color: var(--muted); font-size: 11.5px; font-weight: 600; }
.m-card-line { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-card-line i { color: var(--brand); flex: none; }
.m-card-side {
    flex: none; width: 68px; display: flex; flex-direction: column; align-items: center; justify-content: center;
    border-left: 1px solid var(--line); text-decoration: none; color: var(--brand);
}
.m-card-side strong { font-size: 18px; line-height: 1; }
.m-card-side small { font-size: 11px; color: var(--muted); font-weight: 600; }
.m-card-go { flex: none; display: flex; align-items: center; padding: 0 12px; color: #a7b1be; }
button.fab { border: 0; }

.master-modal .modal-content { border: 0; border-radius: 16px; }
.master-modal .modal-header { border-bottom: 1px solid var(--line); }
.master-modal .modal-title { font-weight: 700; font-size: 17px; }
.master-modal .modal-footer { border-top: 1px solid var(--line); gap: 8px; }
.sub-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 18px 0 8px; font-weight: 700; font-size: 14.5px; }
.sub-head i { color: var(--brand); }
.sub-head small { font-weight: 500; font-size: 12px; color: var(--muted); }
.contact-list { display: flex; flex-direction: column; gap: 8px; }
.contact-row {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #fafbfc;
}
.contact-fields { flex: 1; min-width: 0; display: grid; grid-template-columns: 1.2fr 1fr 1.3fr; gap: 6px; }
.primary-pick { margin: 0; cursor: pointer; flex: none; }
.primary-pick input { position: absolute; opacity: 0; pointer-events: none; }
.primary-pick span {
    width: 40px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px; color: #c3cad4; font-size: 18px;
}
.primary-pick input:checked + span { color: var(--accent); background: #fff8e1; }
@media (max-width: 767.98px) {
    .contact-fields { grid-template-columns: 1fr 1fr; }
    .contact-fields [name=ct_name] { grid-column: 1 / -1; }
}

/* ==========================================================================
   Laptop / desktop polish: no horizontal table scroll, no sidebar scrollbar
   ========================================================================== */

/* Sidebar: compact, never shows a scrollbar */
.sidebar-inner { padding: 14px 12px; scrollbar-width: none; }
.sidebar-inner::-webkit-scrollbar { display: none; }
.sidebar-brand { padding: 2px 6px 12px; margin-bottom: 8px; }
.nav-group-label { margin: 12px 10px 4px; }
.nav-item-link { min-height: 40px; font-size: 14.5px; white-space: nowrap; }
.nav-item-link span { overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer { padding-top: 10px; }
.user-chip { margin-bottom: 0; padding: 8px 8px 8px 10px; }
.user-meta { flex: 1; }
.logout-btn {
    flex: none; width: 36px; height: 36px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--muted); font-size: 18px; text-decoration: none;
}
.logout-btn:hover { background: #fdecea; color: #c0392b; }

/* Tables fit the width: wrap text, icon actions, click row to open */
.sr-table { width: 100%; }
.sr-table td { overflow-wrap: anywhere; }
.sr-table .col-actions { width: 1%; white-space: nowrap; text-align: right; }
.sr-table tr[data-href] { cursor: pointer; }
.btn-act {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; margin-left: 2px; padding: 0;
    border-radius: 9px; border: 1px solid var(--line-2); background: #fff;
    color: var(--ink-2); font-size: 15px; text-decoration: none; vertical-align: middle;
    transition: background .12s, color .12s, border-color .12s;
}
.btn-act:hover { background: #f1f3f6; color: var(--ink); }
.btn-act.is-primary { color: var(--brand); border-color: var(--brand-100); }
.btn-act.is-primary:hover { background: var(--brand-050); border-color: var(--brand); }
.btn-act.is-solid { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-act.is-solid:hover { background: var(--brand-600); color: #fff; }
.btn-act.is-danger:hover { background: #fdecea; color: #c0392b; border-color: #f3b8b1; }

/* Laptop widths (tablet up to 1199px): cards in a 2-column grid instead of a cramped table */
@media (min-width: 768px) and (max-width: 1199.98px) {
    .card-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .card-list > .d-none { display: none; }
}

/* ==========================================================================
   Create SR - Customer / PRODUCT REFERENCE block laid out like the Excel (rows 11-15)
   ========================================================================== */
.hero-fields { display: grid; grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1fr); gap: 8px; flex: 1; max-width: 560px; }
.hero-fields label { margin: 0; display: flex; flex-direction: column; gap: 2px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.hero-fields .form-control { min-height: 36px; font-size: 14px; padding: 4px 8px; }
.form-hero-main .badge-status { align-self: flex-start; margin-top: 4px; }

.xgrid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0 28px; }
.xcol { min-width: 0; }
.xrow {
    display: grid; grid-template-columns: 118px minmax(0, 1fr); align-items: center; gap: 4px 10px;
    padding: 5px 0; border-bottom: 1px solid var(--line);
}
.xcol .xrow:last-child { border-bottom: 0; }
.xlbl { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.xlbl::after { content: " :"; color: var(--muted); }
.xval { font-size: 14.5px; font-weight: 600; min-height: 22px; overflow-wrap: anywhere; }
.xval:empty::before { content: "-"; color: #b4bdc9; font-weight: 400; }
.xrow .form-select, .xrow .form-control { min-height: 40px; }
.xpair { display: grid; grid-template-columns: minmax(0, 1.3fr) auto minmax(0, 1fr); align-items: center; gap: 8px; }
.xcc { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.xinfo { grid-column: 2; margin-top: 0; font-size: 12.5px; }
.xcol-ref { border-left: 1px solid var(--line); padding-left: 20px; }
.xref-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 0 6px; border-bottom: 1px solid var(--line); }
.xref-head span { font-size: 13px; font-weight: 700; text-decoration: underline; letter-spacing: .02em; }
.xref-head .btn { min-height: 28px; padding: 0 4px; font-size: 12.5px; }
.xcol-ref.is-flash .xval { animation: autoFlash 1.1s ease; }
#secCustomer .tool-edit { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line-2); }

.location-list { display: flex; flex-direction: column; gap: 8px; }
.location-row { display: flex; align-items: center; gap: 8px; }
.location-row .form-control { flex: 1; }

@media (max-width: 991.98px) {
    .xgrid { grid-template-columns: minmax(0, 1fr); }
    .xcol-ref { border-left: 0; padding-left: 0; margin-top: 6px; }
}
@media (max-width: 767.98px) {
    .form-hero { flex-direction: column; align-items: stretch; }
    .form-hero-main { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
    .form-hero-label { width: 100%; }
    .hero-fields { grid-template-columns: 1fr 1fr; max-width: none; }
    .hero-fields label:first-child { grid-column: 1 / -1; }
    .xrow { grid-template-columns: 96px minmax(0, 1fr); padding: 4px 0; }
    .xlbl { font-size: 12.5px; }
    .xpair { grid-template-columns: minmax(0, 1fr) auto minmax(0, 0.8fr); gap: 6px; }
}

/* Service item Type column + editable PRODUCT REFERENCE */
.items-table .col-type { width: 120px; }
.xval-edit { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.xval-edit .btn { min-height: 28px; padding: 0 4px; font-size: 12.5px; flex: none; }
.xcol-ref .xrow .form-control { min-height: 38px; }
@media (max-width: 767.98px) {
    .items-table tr.item-row { grid-template-areas: "type desc desc act" "qty price amt amt"; }
    .items-table .col-type { grid-area: type; }
    .items-table .col-type::before { display: none !important; }
}

/* Product / Tool Master: serial number rows */
.serial-list { display: flex; flex-direction: column; gap: 8px; }
.serial-row { display: flex; align-items: flex-start; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #fafbfc; }
.serial-fields { flex: 1; min-width: 0; display: grid; grid-template-columns: 1fr 1.2fr 1fr 1fr; gap: 6px; }
@media (max-width: 767.98px) { .serial-fields { grid-template-columns: 1fr 1fr; } }

/* Attachments (Create / Edit / View SR) */
.att-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.att-list:empty { display: none; }
.att-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: #fafbfc; }
.att-icon { font-size: 22px; color: var(--brand); flex: none; }
.att-name { flex: 1; min-width: 0; display: flex; flex-direction: column; font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.att-name small { font-weight: 500; font-size: 12px; color: var(--muted); }
.att-view { flex: none; min-height: 36px; }
.att-item .btn-remove { height: 36px; }
.att-drop {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 92px; padding: 12px; margin: 0; text-align: center; cursor: pointer;
    border: 1.5px dashed var(--line-2); border-radius: 12px; background: #fafbfc; color: var(--ink-2);
}
.att-drop:hover { border-color: var(--brand); background: var(--brand-050); }
.att-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.att-drop > i { font-size: 26px; color: var(--brand); }
.att-drop b { color: var(--brand); }
.att-drop small { color: var(--muted); font-size: 12px; }
.att-drop.is-busy { opacity: .6; pointer-events: none; }
@media (max-width: 767.98px) { .att-view span { display: none; } }

/* Attachments: small "Add attachment" button (replaces the large drop area) */
.att-add { min-height: 34px; padding: 4px 12px; font-size: 13.5px; gap: 6px; }
.att-add i { font-size: 15px; }

/* Warranty badge (Create / View SR) */
.warranty-badge { display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.warranty-badge[hidden] { display: none; }
.warranty-badge.is-in { background: #e7f6ec; color: #1e6b3a; border: 1px solid #9fd5b2; }
.warranty-badge.is-out { background: #fdecea; color: #a8321f; border: 1px solid #f3b8b1; }
#secCustomer .warranty-badge { grid-column: 2; justify-self: start; }

/* Service Information: End before Start */
.invalid-msg { margin-top: 4px; font-size: 12.5px; font-weight: 600; color: #c0392b; }
.invalid-msg[hidden] { display: none; }

/* Attachments: two small buttons */
.att-buttons { display: flex; flex-wrap: wrap; gap: 8px; }

/* Product / Tool Master serial rows: buy-off + warranty */
.serial-fields { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sn-cell { margin: 0; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sn-cell > span:first-child { font-size: 11px; font-weight: 600; color: var(--muted); }
.sn-warranty { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 4px; }
@media (max-width: 767.98px) { .serial-fields { grid-template-columns: 1fr 1fr; } }

/* Product / Tool Master: Serial Numbers as a grid (header + one line per serial) */
.sn-grid-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.sn-grid { min-width: 1000px; }
.sn-head, .sn-grid .serial-row {
    display: grid; align-items: center; gap: 6px;
    grid-template-columns: 1.1fr 1.2fr 1.1fr 1fr 1.15fr 1.25fr 1fr 40px;
}
.sn-head { padding: 8px 10px; background: #f4f6f9; border-bottom: 1px solid var(--line); font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.sn-grid .serial-list { gap: 0; }
.sn-grid .serial-row { padding: 6px 10px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: #fff; }
.sn-grid .serial-row:last-child { border-bottom: 0; }
.sn-grid .serial-row .form-control, .sn-grid .serial-row .form-select { min-height: 38px; padding-top: 4px; padding-bottom: 4px; font-size: 14px; }
.sn-grid .serial-row .btn-remove { height: 38px; min-width: 0; width: 40px; }
.sn-grid .sn-warranty { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 4px; }
.sn-grid-wrap + .btn-add { margin-top: 10px; }

/* Service items: multiplier + quantity share the Quantity column (same column width) */
.qty-pair { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 4px; }
.qty-pair .form-control { padding-left: 6px; padding-right: 6px; min-width: 0; }
.qty-pair [data-mult] { text-align: center !important; background: #f7f8fa; }

/* Product BOM Master: Part No grid (Part No | Product | Description | Unit Price | delete) */
.bom-grid { min-width: 820px; }
.bom-grid .sn-head, .bom-grid .serial-row { grid-template-columns: 1.3fr 1fr 2fr 0.6fr 0.8fr 40px; }
