/* ==========================================================
   Channa Systems IT Asset Management System
   File    : assets/css/cs-layout.css
   Version : 1.2.0 - new layout (approved proposal)
   ----------------------------------------------------------
   Loaded AFTER cs.css. cs.css itself is unchanged.
   Colours: Channa Systems palette (navy #061326).
   ========================================================== */

:root {
    --cs-navy: #061326;
    --cs-navy-2: #0C2340;
    --cs-primary: #0B6E77;
    --cs-primary-dark: #095A61;
    --cs-ice: #E6F3F4;
    --cs-page: #F3F5F8;
    --cs-ink: #0F1B2D;
    --cs-muted: #5B6B7A;
    --cs-line: #DCE3EA;
    --cs-sidebar-w: 260px;
    --cs-font: 'IBM Plex Sans', 'Segoe UI', Tahoma, Arial, sans-serif;
    --cs-mono: 'IBM Plex Mono', Consolas, 'Courier New', monospace;
}

body {
    font-family: var(--cs-font);
    background: var(--cs-page);
    color: var(--cs-ink);
}

/* ---------- Sidebar ---------- */

.cs-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--cs-sidebar-w);
    background: var(--cs-navy);
    color: #FFFFFF;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 22px 16px 16px;
    box-sizing: border-box;
    overflow-y: auto;
    z-index: 1000;
}

.cs-brand {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 8px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .18);
}

.cs-brand img {
    width: 132px;
    height: auto;
    display: block;
}

.cs-brand span {
    font-size: 13px;
    font-weight: 500;
    color: #B9C6D8;
}

.cs-nav-section {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cs-nav-heading {
    padding: 0 12px 6px;
    font-size: 12px;
    font-weight: 600;
    color: #8FA1B9;
}

.cs-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 8px;
    color: #FFFFFF;
    font-size: 14.5px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color .18s ease, color .18s ease;
}

.cs-nav-link i {
    font-size: 17px;
    line-height: 1;
}

.cs-nav-link:hover,
.cs-nav-link:focus-visible {
    background: rgba(255, 255, 255, .12);
    color: #FFFFFF;
}

.cs-nav-link.active {
    background: #FFFFFF;
    color: var(--cs-primary);
    font-weight: 600;
}

.cs-nav-link:focus-visible,
.cs-sidebar-foot a:focus-visible {
    outline: 2px solid #FFFFFF;
    outline-offset: 2px;
}

.cs-sidebar-foot {
    margin-top: auto;
    padding: 14px 10px 0;
    border-top: 1px solid rgba(255, 255, 255, .18);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12.5px;
    color: #B9C6D8;
}

.cs-sidebar-foot a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    color: #FFFFFF;
    text-decoration: none;
    font-weight: 500;
}

.cs-sidebar-foot a:hover {
    text-decoration: underline;
}

/* ---------- Top bar ---------- */

.cs-topbar {
    margin-left: var(--cs-sidebar-w);
    min-height: 76px;
    padding: 14px 30px;
    box-sizing: border-box;
    background: #FFFFFF;
    border-bottom: 1px solid var(--cs-line);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px 24px;
}

.cs-topbar-section {
    font-size: 13px;
    color: var(--cs-muted);
}

.cs-topbar-title h1 {
    margin: 0;
    font-size: 21px;
    font-weight: 600;
    color: var(--cs-ink);
}

.cs-topbar-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 22px;
}

.cs-topbar-search {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 320px;
    max-width: 100%;
    height: 42px;
    padding: 0 14px;
    box-sizing: border-box;
    border: 1px solid var(--cs-line);
    border-radius: 10px;
    background: var(--cs-page);
    color: var(--cs-muted);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.cs-topbar-search:focus-within {
    border-color: var(--cs-primary);
    box-shadow: 0 0 0 .2rem rgba(11, 110, 119, .20);
    background: #FFFFFF;
}

.cs-topbar-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    font: inherit;
    font-size: 14px;
    color: var(--cs-ink);
}

.cs-topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cs-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--cs-ice);
    color: var(--cs-primary-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex: none;
}

.cs-topbar-user-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.cs-user-name {
    font-size: 14px;
    font-weight: 600;
}

.cs-user-role,
.cs-clock {
    font-size: 12.5px;
    color: var(--cs-muted);
}

.cs-clock {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ---------- Footer ---------- */

.cs-footer {
    margin-left: var(--cs-sidebar-w);
    padding: 16px 30px;
    color: var(--cs-muted);
    border-top: 1px solid var(--cs-line);
    background: transparent;
}

/* ---------- Cards ---------- */

.card {
    border: 1px solid var(--cs-line);
    border-radius: 12px;
    box-shadow: none;
}

.card.shadow,
.card.shadow-sm {
    box-shadow: 0 1px 2px rgba(6, 19, 38, .05) !important;
}

.card-header,
.card-header.cs-header,
.card-header.bg-primary,
.card-header.bg-info {
    background: #FFFFFF !important;
    color: var(--cs-ink) !important;
    border-bottom: 1px solid var(--cs-line);
    padding: 16px 20px;
    font-weight: 600;
}

.card-header h1, .card-header h2, .card-header h3,
.card-header h4, .card-header h5, .card-header h6,
.card-header.cs-header h5,
.card-header .text-white {
    color: var(--cs-ink) !important;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

/* Header buttons that were white-on-blue stay visible on white */
.card-header .cs-btn-light {
    border-color: var(--cs-line);
    background: #FFFFFF;
    color: var(--cs-primary);
}

.card-header .cs-btn-light:hover {
    background: var(--cs-ice);
    color: var(--cs-primary-dark);
}

/* ---------- Tables ---------- */

.table thead,
.table thead th {
    background: #FAFBFC;
    color: var(--cs-muted);
    border-color: var(--cs-line);
}

.table thead th {
    font-size: 12.5px;
    font-weight: 600;
    padding: 11px 14px;
    white-space: nowrap;
}

.table tbody td {
    padding: 11px 14px;
    border-color: var(--cs-line);
}

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

/* ---------- Buttons ---------- */

.btn {
    border-radius: 9px;
    font-weight: 600;
}

.btn-sm {
    border-radius: 8px;
}

.btn-primary,
.cs-btn {
    background: var(--cs-primary);
    border-color: var(--cs-primary);
    color: #FFFFFF;
}

.btn-primary:hover,
.btn-primary:focus,
.cs-btn:hover {
    background: var(--cs-primary-dark);
    border-color: var(--cs-primary-dark);
    color: #FFFFFF;
}

.btn-secondary {
    background: #FFFFFF;
    border-color: var(--cs-line);
    color: var(--cs-ink);
}

.btn-secondary:hover,
.btn-secondary:focus {
    background: var(--cs-page);
    border-color: #C5D0DA;
    color: var(--cs-ink);
}

/* ---------- Forms ---------- */

.form-label {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--cs-ink);
}

.form-control,
.form-select {
    border-color: var(--cs-line);
    border-radius: 9px;
}

/* ---------- Badges ---------- */

.badge {
    border-radius: 999px;
    padding: .4em .75em;
    font-weight: 600;
}

/* ---------- Asset tags & serial numbers ---------- */

.cs-mono {
    font-family: var(--cs-mono);
}

/* Asset tag links in tables: one line, fixed-width digits */
.table a[href^="view_asset.php"]:not(.btn) {
    white-space: nowrap;
    font-family: var(--cs-mono);
    font-weight: 600;
    text-decoration: none;
}

/* ==========================================================
   PAGE COMPONENTS (Dashboard, All Assets, Asset Details, Login)
   ========================================================== */

.cs-page {
    margin-left: var(--cs-sidebar-w);
    padding: 26px 30px 36px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    max-width: 1500px;
    box-sizing: border-box;
}

.cs-panel {
    background: #FFFFFF;
    border: 1px solid var(--cs-line);
    border-radius: 12px;
}

.cs-panel-pad { padding: 22px 24px; }

.cs-panel h2,
.cs-h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--cs-ink);
}

.cs-row {
    display: flex;
    flex-wrap: wrap;
    gap: 22px;
    align-items: flex-start;
}

.cs-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.cs-muted { color: var(--cs-muted); }

.cs-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 34px;
    font-size: 14px;
    font-weight: 600;
    color: var(--cs-primary);
    text-decoration: none;
}

.cs-link:hover { color: var(--cs-primary-dark); text-decoration: underline; }

.cs-btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px;
    border-radius: 9px;
    border: 1px solid var(--cs-line);
    background: #FFFFFF;
    color: var(--cs-ink);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease;
}

.cs-btn-ghost:hover { background: var(--cs-page); border-color: #C5D0DA; color: var(--cs-ink); }

.cs-btn-main {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 18px;
    border-radius: 9px;
    border: 1px solid var(--cs-primary);
    background: var(--cs-primary);
    color: #FFFFFF;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s ease;
}

.cs-btn-main:hover { background: var(--cs-primary-dark); border-color: var(--cs-primary-dark); color: #FFFFFF; }

/* ---------- Status badges ---------- */

.cs-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
}

.cs-status::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex: none;
}

.cs-status-assigned    { background: #E3F2F3; color: #095A61; }
.cs-status-available   { background: #E3F3EA; color: #126B3F; position: relative; }
.cs-status-maintenance { background: #FFF3D1; color: #6E4B00; }
.cs-status-retired     { background: #ECEFF2; color: #47525E; }

/* Available: soft pulse on the dot */
.cs-status-available::after {
    content: "";
    position: absolute;
    left: 10px;
    top: 50%;
    width: 6px;
    height: 6px;
    margin-top: -3px;
    border-radius: 50%;
    background: #2E9E62;
    animation: cs-live 2s ease-out infinite;
}

@keyframes cs-live {
    0%   { transform: scale(1); opacity: .55; }
    70%  { transform: scale(3); opacity: 0; }
    100% { transform: scale(3); opacity: 0; }
}

/* ---------- Dashboard ---------- */

.cs-fleet-total { font-size: 44px; font-weight: 600; line-height: 1; }

.cs-fleet-bar {
    display: flex;
    gap: 3px;
    height: 14px;
    border-radius: 7px;
    overflow: hidden;
    background: var(--cs-page);
}

.cs-fleet-bar span {
    display: block;
    min-width: 6px;
    transform-origin: left center;
    animation: cs-grow .7s cubic-bezier(.2, .7, .2, 1) backwards;
}

.cs-fleet-bar span:nth-child(2) { animation-delay: .08s; }
.cs-fleet-bar span:nth-child(3) { animation-delay: .16s; }
.cs-fleet-bar span:nth-child(4) { animation-delay: .24s; }

@keyframes cs-grow {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

.cs-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 18px 48px;
}

.cs-legend-item { display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
.cs-legend-name { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--cs-muted); }
.cs-legend-name i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.cs-legend-num { font-size: 26px; font-weight: 600; }
.cs-legend-pct { font-size: 13px; color: var(--cs-muted); margin-left: 6px; }

.cs-attention { list-style: none; margin: 0; padding: 0; }

.cs-attention li {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-top: 1px solid var(--cs-line);
}

.cs-attention-count {
    min-width: 44px;
    height: 32px;
    padding: 0 8px;
    box-sizing: border-box;
    border-radius: 8px;
    background: #FFF3D1;
    color: #6E4B00;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cs-bars { display: flex; flex-direction: column; gap: 12px; }

.cs-bar-row {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.cs-bar-row > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cs-bar-track { height: 10px; border-radius: 5px; background: var(--cs-ice); overflow: hidden; }
.cs-bar-fill { display: block; height: 100%; border-radius: 5px; background: var(--cs-primary); transform-origin: left center; animation: cs-grow .7s cubic-bezier(.2, .7, .2, 1) .1s backwards; }

.cs-empty { padding: 28px 0; text-align: center; color: var(--cs-muted); }

/* ---------- All Assets ---------- */

.cs-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 22px;
    border-bottom: 1px solid var(--cs-line);
}

.cs-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding: 0 2px;
    font-size: 14.5px;
    font-weight: 500;
    color: var(--cs-muted);
    text-decoration: none;
}

.cs-tab:hover { color: var(--cs-ink); }

.cs-tab span {
    font-size: 12px;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 999px;
    background: #EDF0F3;
    color: var(--cs-muted);
}

.cs-tab.active { color: var(--cs-primary); font-weight: 600; box-shadow: inset 0 -2px 0 var(--cs-primary); }
.cs-tab.active span { background: var(--cs-ice); color: var(--cs-primary-dark); }

.cs-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    padding: 18px;
}

.cs-filters label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--cs-muted);
    margin: 0;
}

.cs-filters .form-control,
.cs-filters .form-select { height: 40px; font-size: 14px; }

.cs-filters .cs-filter-search { flex: 1 1 260px; }
.cs-filters .cs-filter-select { flex: 0 1 190px; }

.cs-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0 18px 14px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #FFF3D1;
    color: #6E4B00;
    font-size: 13.5px;
    font-weight: 600;
}

.cs-chip a { color: #6E4B00; }

.cs-bulkbar {
    display: none;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    background: var(--cs-navy);
    color: #FFFFFF;
}

.cs-bulkbar.show { display: flex; animation: cs-slide .22s ease-out; }

@keyframes cs-slide {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
}

.cs-bulkbar button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}

.cs-bulkbar .cs-bulk-primary { background: #FFFFFF; color: var(--cs-primary); border: 1px solid #FFFFFF; }
.cs-bulkbar .cs-bulk-secondary { background: transparent; color: #FFFFFF; border: 1px solid rgba(255, 255, 255, .6); }
.cs-bulkbar .cs-bulk-clear { margin-left: auto; background: transparent; border: 0; color: #FFFFFF; text-decoration: underline; }

.cs-assets-table { min-width: 1020px; }
.cs-assets-table td { vertical-align: middle; }
.cs-assets-table tbody tr.selected > td { background: var(--cs-ice); }
.cs-assets-table input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--cs-primary); cursor: pointer; }
.cs-sub { font-size: 12.5px; color: var(--cs-muted); }
.cs-serial { font-family: var(--cs-mono); font-size: 13px; color: #33414E; }

/* Row that was just saved / transferred: brief glow */
.cs-assets-table tbody tr.cs-flash td { animation: cs-flash 2.4s ease-out; }

@keyframes cs-flash {
    0%, 30% { background: #CDEBEE; }
    100%    { background: transparent; }
}

.cs-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    font-size: 14px;
    color: var(--cs-muted);
}

.cs-pages { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.cs-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    color: var(--cs-ink);
    text-decoration: none;
    font-weight: 500;
}

.cs-page-link:hover { background: var(--cs-page); color: var(--cs-ink); }
.cs-page-link.active { background: var(--cs-primary); color: #FFFFFF; font-weight: 600; }
.cs-page-link.disabled { color: #AAB5BF; pointer-events: none; }

.cs-row-actions .btn { border-radius: 8px; }

/* ---------- Asset details ---------- */

.cs-asset-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px 24px;
    padding: 22px 26px;
}

.cs-asset-tag { font-family: var(--cs-mono); font-size: 30px; font-weight: 600; }

.cs-details {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 32px;
}

.cs-details dt { font-size: 12.5px; font-weight: 600; color: var(--cs-muted); }
.cs-details dd { margin: 4px 0 0; font-size: 15px; word-break: break-word; }
.cs-details dd.cs-none { color: var(--cs-muted); }

.cs-timeline { list-style: none; margin: 0; padding: 0; }

.cs-timeline li {
    position: relative;
    display: grid;
    grid-template-columns: 16px 140px minmax(0, 1fr);
    gap: 16px;
    padding-bottom: 22px;
}

.cs-timeline li::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 22px;
    bottom: -4px;
    width: 2px;
    background: var(--cs-line);
}

.cs-timeline li:last-child::before { display: none; }

.cs-tl-dot {
    width: 16px;
    height: 16px;
    margin-top: 3px;
    box-sizing: border-box;
    border-radius: 50%;
    border: 2px solid #9FB3C4;
    background: #FFFFFF;
}

.cs-timeline li:first-child .cs-tl-dot { border-color: var(--cs-primary); background: var(--cs-primary); }
.cs-tl-date { font-size: 13.5px; color: var(--cs-muted); padding-top: 1px; }
.cs-tl-title { font-size: 15px; font-weight: 600; }
.cs-tl-sub { font-size: 13.5px; color: var(--cs-muted); }

.cs-qr-preview {
    width: 110px;
    height: 110px;
    border: 1px solid var(--cs-line);
    border-radius: 8px;
    background: #FFFFFF;
    image-rendering: pixelated;
    flex: none;
}

/* ---------- Login / OTP ---------- */

.cs-auth {
    min-height: 100vh;
    display: flex;
    flex-wrap: wrap;
    background: var(--cs-page);
    font-family: var(--cs-font);
    color: var(--cs-ink);
}

.cs-auth-brand {
    flex: 1 1 420px;
    background: var(--cs-navy);
    color: #FFFFFF;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 40px;
    padding: 56px 64px;
    box-sizing: border-box;
}

.cs-auth-brand img { width: 190px; height: auto; display: block; }
.cs-auth-brand h1 { margin: 0; font-size: 40px; line-height: 1.15; font-weight: 600; }
.cs-auth-brand p { margin: 12px 0 0; font-size: 17px; line-height: 1.55; color: #B9C6D8; max-width: 460px; }
.cs-auth-brand small { font-size: 13px; color: #8FA1B9; }

.cs-auth-main {
    flex: 1 1 480px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    box-sizing: border-box;
}

.cs-auth-form { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 20px; }
.cs-auth-step { font-size: 13px; font-weight: 600; color: var(--cs-primary); }
.cs-auth-form h2 { margin: 4px 0 0; font-size: 28px; font-weight: 600; }
.cs-auth-form .form-control { height: 46px; font-size: 15px; }
.cs-auth-form .btn-primary { height: 48px; font-size: 15px; }
.cs-otp-input { text-align: center; font-family: var(--cs-mono); font-size: 24px !important; letter-spacing: .5em; }

@media (max-width: 720px) {
    .cs-auth-brand { padding: 32px 28px; flex-basis: 100%; }
    .cs-auth-brand h1 { font-size: 30px; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
    .cs-status-available::after { animation: none; opacity: 0; }
}
