/* ═══════════════════════════════════════════════════════════
   Service Line Inventory — Frontend v1.0.3
   ═══════════════════════════════════════════════════════════ */

.sli-wrap *, .sli-wrap *::before, .sli-wrap *::after { box-sizing: border-box; margin: 0; padding: 0; }

.sli-wrap {
    font-family: 'Segoe UI', Calibri, Arial, sans-serif;
    font-size: 13px;
    color: #1a202c;
    background: #f0f4f8;
}

/* ══════════════════════
   TITLE BAR
   ══════════════════════ */
.sli-sheet-titlebar {
    background: #fff;
    border-bottom: 1px solid #dde3ea;
    padding: 12px 18px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sli-sheet-title-left { display: flex; align-items: center; gap: 10px; }
.sli-sheet-logo svg  { width: 26px; height: 26px; display: block; }
.sli-sheet-name      { font-size: 17px; font-weight: 600; color: #202124; line-height: 1.2; }
.sli-sheet-meta      { font-size: 11.5px; color: #5f6368; margin-top: 2px; }
.sli-sheet-meta strong { color: #1a202c; font-weight: 700; }

/* ══════════════════════
   TOOLBAR
   ══════════════════════ */
.sli-toolbar {
    background: #fff;
    border-bottom: 1px solid #dde3ea;
    padding: 10px 18px 8px;
}
.sli-toolbar-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.sli-search-field-wrap { position: relative; flex: 1 1 260px; }
.sli-search-icon {
    position: absolute; left: 10px; top: 50%;
    transform: translateY(-50%);
    width: 15px; height: 15px;
    stroke: #9aa5b4; stroke-width: 2; fill: none; stroke-linecap: round;
    pointer-events: none;
}
.sli-address-input {
    width: 100%;
    padding: 7px 10px 7px 32px;
    border: 1px solid #cbd5e0;
    border-radius: 5px;
    font-size: 13px;
    background: #f8fafc;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.sli-address-input:focus {
    border-color: #1e3a5f;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(30,58,95,.12);
}
.sli-material-filter {
    padding: 7px 10px;
    border: 1px solid #cbd5e0;
    border-radius: 5px;
    font-size: 13px;
    background: #f8fafc;
    cursor: pointer;
    outline: none;
    min-width: 190px;
}
.sli-search-btn {
    padding: 7px 20px;
    background: #1e3a5f;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    white-space: nowrap;
}
.sli-search-btn:hover { background: #2d5a8e; }
.sli-clear-btn {
    padding: 6px 14px;
    background: none;
    color: #5f6368;
    border: 1px solid #cbd5e0;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
}
.sli-clear-btn:hover { border-color: #1e3a5f; color: #1e3a5f; }
.sli-results-meta {
    width: 100%;
    font-size: 12px;
    color: #5f6368;
    padding-top: 6px;
}
.sli-results-meta strong { color: #1a202c; }

/* ══════════════════════
   TABLE SHELL
   ══════════════════════ */
.sli-sheet-area {
    background: #fff;
    border: 1px solid #c8d5e0;
    margin: 10px 0 0;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.sli-loading {
    display: flex; align-items: center; justify-content: center;
    gap: 10px; padding: 60px; color: #5f6368;
}
.sli-spinner {
    width: 22px; height: 22px;
    border: 3px solid #e0e4ea;
    border-top-color: #1e3a5f;
    border-radius: 50%;
    animation: sli-spin .7s linear infinite;
}
@keyframes sli-spin { to { transform: rotate(360deg); } }
.sli-empty { text-align: center; padding: 60px; color: #5f6368; }
.sli-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ══════════════════════
   THE TABLE
   ══════════════════════ */
.sli-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

/* ── Group header row (coloured bands) ── */
.sli-thead-group th {
    text-align: center;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #fff !important;
    padding: 9px 14px;
    border: 1px solid rgba(255,255,255,.2);
    white-space: nowrap;
}
/* Row-number and actions corner cells */
th.sli-th-rownum,
th.sli-th-actions-head {
    background: #edf2f7 !important;
    border: 1px solid #c8d5e0 !important;
    color: transparent !important;
}
/* Section colours */
th.sli-group-location       { background: #1e3a5f !important; }
th.sli-group-system         { background: #1a3a5c !important; }
th.sli-group-customer       { background: #4a6fa5 !important; }
th.sli-group-classification { background: #5b8fa8 !important; }

/* ── Column sub-header row ── */
.sli-thead-cols th {
    font-weight: 700;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #fff !important;
    padding: 7px 12px;
    border: 1px solid rgba(255,255,255,.18);
    vertical-align: bottom;
    line-height: 1.4;
}
/* Sub-header section colours (slightly lighter) */
th.sli-col-id,
th.sli-col-address          { background: #2d5a8e !important; }
th.sli-col-sys-material,
th.sli-col-sys-size,
th.sli-col-sys-verified     { background: #2c4f78 !important; }
th.sli-col-cust-material,
th.sli-col-cust-size,
th.sli-col-cust-verified    { background: #6589b8 !important; }
th.sli-col-classification   { background: #7aafc8 !important; }

/* Column widths */
th.sli-col-id            { width: 80px;  min-width: 70px; }
th.sli-col-address       { min-width: 180px; }
th.sli-col-sys-material  { min-width: 150px; }
th.sli-col-sys-size      { width: 80px;  min-width: 70px; text-align: center; }
th.sli-col-sys-verified  { min-width: 120px; text-align: center; }
th.sli-col-cust-material { min-width: 150px; }
th.sli-col-cust-size     { width: 80px;  min-width: 70px; text-align: center; }
th.sli-col-cust-verified { min-width: 120px; text-align: center; }
th.sli-col-classification{ min-width: 160px; }

/* ── Data rows ── */
.sli-table tbody tr:nth-child(odd)  td { background: #ffffff; }
.sli-table tbody tr:nth-child(even) td { background: #eaf3fa; }
.sli-table tbody tr:hover           td { background: #d6eaf8 !important; cursor: default; }

.sli-table td {
    padding: 7px 12px;
    border: 1px solid #d0dce8;
    vertical-align: middle;
    font-size: 12.5px;
    color: #1a202c;
    line-height: 1.4;
}

/* Row number cell */
td.sli-td-rownum {
    text-align: center;
    color: #9aa5b4;
    font-size: 11px;
    background: #f5f8fb !important;
    border-right: 2px solid #c8d5e0 !important;
    min-width: 40px;
    width: 40px;
    user-select: none;
}
td.sli-td-id     { text-align: center; font-size: 12px; color: #4a5568; }
td.sli-td-size   { text-align: center; }
td.sli-td-verified { text-align: center; }

/* ── Verified ── */
.sli-yes { color: #2e7d32; font-weight: 600; }
.sli-no  { color: #5f6368; }

/* ── Classification badges ── */
.sli-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}
.sli-badge-lead    { background: #ffebee; color: #c62828; }
.sli-badge-galv    { background: #fff3e0; color: #bf6500; }
.sli-badge-unknown { background: #f3f4f6; color: #6b7280; }
.sli-badge-nonlead { background: #e8f5e9; color: #2e7d32; }
.sli-badge-other   { background: #e8f1fb; color: #1a5276; }

/* ── Details button ── */
.sli-detail-btn {
    padding: 4px 12px;
    background: #fff;
    color: #1e3a5f;
    border: 1.5px solid #1e3a5f;
    border-radius: 4px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all .12s;
}
.sli-detail-btn:hover { background: #1e3a5f; color: #fff; }

/* ══════════════════════
   TAB BAR
   ══════════════════════ */
.sli-tab-bar {
    background: #edf2f7;
    border-top: 1px solid #c8d5e0;
    padding: 0 12px;
    display: flex;
    align-items: flex-end;
    height: 30px;
    gap: 4px;
}
.sli-tab {
    display: inline-flex; align-items: center;
    padding: 0 16px; height: 26px;
    border: 1px solid #c8d5e0; border-bottom: none;
    border-radius: 4px 4px 0 0;
    font-size: 12px; font-weight: 600;
    background: #fff; color: #1a202c;
}

/* ══════════════════════
   PAGINATION
   ══════════════════════ */
.sli-pagination {
    display: flex; align-items: center; justify-content: center;
    flex-wrap: wrap; gap: 4px;
    padding: 12px 16px;
    border-top: 1px solid #dde3ea;
    background: #f8fafc;
}
.sli-page-btn {
    min-width: 32px; height: 32px; padding: 0 8px;
    border: 1px solid #cbd5e0; border-radius: 4px;
    background: #fff; color: #1a202c;
    font-size: 12px; cursor: pointer; transition: all .12s;
}
.sli-page-btn:hover:not(:disabled):not(.sli-page-active) {
    border-color: #1e3a5f; color: #1e3a5f;
}
.sli-page-btn.sli-page-active {
    background: #1e3a5f; border-color: #1e3a5f;
    color: #fff; font-weight: 700;
}
.sli-page-btn:disabled { opacity: .4; cursor: default; }
.sli-page-ellipsis { color: #9aa5b4; padding: 0 2px; line-height: 32px; }

/* ══════════════════════
   DETAIL DRAWER
   ══════════════════════ */
.sli-drawer-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.38); z-index: 9998;
    backdrop-filter: blur(2px);
}
.sli-overlay-open { display: block; animation: sli-fade .2s ease; }
.sli-drawer {
    position: fixed; top: 0; right: -520px;
    width: min(520px, 100vw); height: 100vh;
    background: #fff; z-index: 9999;
    box-shadow: -4px 0 24px rgba(0,0,0,.18);
    transition: right .28s cubic-bezier(.4,0,.2,1);
    display: flex; flex-direction: column;
}
.sli-drawer-open { right: 0 !important; }
.sli-drawer-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    background: #1e3a5f; flex-shrink: 0;
}
.sli-drawer-header h3 { margin: 0; color: #fff; font-size: 14px; font-weight: 700; flex: 1; }
.sli-drawer-close {
    background: rgba(255,255,255,.15); border: none; color: #fff;
    width: 28px; height: 28px; border-radius: 50%;
    font-size: 14px; cursor: pointer; display: flex;
    align-items: center; justify-content: center; transition: background .12s;
}
.sli-drawer-close:hover { background: rgba(255,255,255,.3); }
.sli-drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px 32px; }
.sli-drawer-section { margin-bottom: 18px; }
.sli-drawer-section h4 {
    margin: 0 0 8px; font-size: 10.5px; font-weight: 700;
    color: #fff; text-transform: uppercase; letter-spacing: .07em;
    padding: 5px 10px; border-radius: 3px;
}
.sli-sec-location h4  { background: #1e3a5f; }
.sli-sec-system   h4  { background: #1a3a5c; }
.sli-sec-customer h4  { background: #4a6fa5; }
.sli-sec-classify h4  { background: #5b8fa8; }
.sli-sec-replace  h4  { background: #4a5568; }

.sli-drawer-body dl {
    display: grid; grid-template-columns: 145px 1fr;
    border: 1px solid #e2e8f0; border-radius: 4px; overflow: hidden;
}
.sli-drawer-body dt {
    font-size: 11px; font-weight: 600; color: #4a5568;
    background: #f8fafc; padding: 6px 10px;
    border-bottom: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    display: flex; align-items: center;
}
.sli-drawer-body dd {
    margin: 0; font-size: 12.5px; color: #1a202c;
    padding: 6px 10px;
    border-bottom: 1px solid #e2e8f0;
    display: flex; align-items: center;
}
.sli-drawer-body dt:last-of-type,
.sli-drawer-body dd:last-child { border-bottom: none; }

.sli-no-data {
    padding: 48px; text-align: center;
    color: #5f6368; border: 1px dashed #cbd5e0;
    border-radius: 6px; margin-top: 10px;
}

@keyframes sli-fade  { from { opacity: 0 } to { opacity: 1 } }
@keyframes sli-spin  { to   { transform: rotate(360deg) } }

/* ══════════════════════
   RESPONSIVE
   ══════════════════════ */
@media (max-width: 700px) {
    .sli-toolbar-inner { flex-direction: column; align-items: stretch; }
    .sli-search-btn, .sli-clear-btn, .sli-material-filter { width: 100%; }
    th.sli-col-sys-size, th.sli-col-sys-verified,
    /* th.sli-col-cust-size, th.sli-col-cust-verified { display: none; }
    td.sli-td-sys-size, td.sli-td-sys-verified,
    td.sli-td-cust-size, td.sli-td-cust-verified   { display: none; } */
    .sli-thead-group th, .sli-thead-cols th { white-space: normal; }
    td.sli-td-sys-material, td.sli-td-cust-material { white-space: normal; }
    .sli-drawer-body dl { grid-template-columns: 1fr; }
    .sli-drawer-body dt { border-right: none; }
}
