/* ============================================================
   Kibog Work Orders Design System
   Standalone — no Metronic dependency (fully removed Jun 2026)
   ============================================================ */

/* ── DESIGN TOKENS ─────────────────────────────────────────── */
:root {
    --kibo-blue:       #1875BA;
    --kibo-navy:       #0F1F3D;
    --kibo-grey:       #4C5563;
    --kibo-teal:       #4C5563;
    --kibo-teal-dark:  #374151;
    --kibo-bg:         #F8F9FC;
    --kibo-card:       #FFFFFF;
    --kibo-border:       #E5E9F2;
    --kibo-input-border: #767676; /* WCAG 1.4.11 — 3:1 contrast against white */
    --kibo-text-1:     #1A1A2E;
    --kibo-text-2:     #6B7280;
    --kibo-text-3:     #9CA3AF;

    /* Status colours */
    --status-open-bg:   #FEF3C7;
    --status-open-txt:  #92400E;
    --status-ack-bg:    #EBF4FB;
    --status-ack-txt:   #0D5A8E;
    --status-prog-bg:   #EDE9FE;
    --status-prog-txt:  #5B21B6;
    --status-res-bg:    #ECFDF5;
    --status-res-txt:   #065F46;
    --status-closed-bg: #F3F4F6;
    --status-closed-txt:#4B5563;

    /* Priority colours */
    --pri-low-txt:    #6B7280;
    --pri-medium-txt: #1875BA;
    --pri-high-txt:   #F59E0B;
    --pri-urgent-txt: #EF4444;
}

/* ── GLOBAL ─────────────────────────────────────────────────── */
.kibog-body {
    font-family: 'DM Sans', sans-serif;
    background: var(--kibo-bg);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── NAVIGATION ─────────────────────────────────────────────── */
.kibo-nav {
    background: var(--kibo-blue);
    min-height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(15,31,61,0.15);
}
.kibo-nav-inner {
    width: 100%;
    padding: 0 32px;
    min-height: 56px;
    display: flex;
    align-items: center;
    gap: 32px;
}
.kibo-logo {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.5px;
    flex-shrink: 0;
}
.kibo-logo span { color: var(--kibo-teal); }
.kibo-nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}
.kibo-nav-link {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.kibo-nav-link:hover { color: #fff; background: rgba(255,255,255,0.1); }
.kibo-nav-link.active { color: #fff; background: rgba(255,255,255,0.15); }
.kibo-nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}
.kibo-nav-user:hover { background: rgba(255,255,255,0.1); }
.kibo-nav-username { font-size: 13px; color: rgba(255,255,255,0.85); font-weight: 500; }
.kibo-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--kibo-teal);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── SUBHEADER ──────────────────────────────────────────────── */
.kibo-subheader {
    background: #fff;
    border-bottom: 1px solid var(--kibo-border);
}
.kibo-subheader-inner {
    width: 100%;
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.kibo-page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--kibo-navy);
    margin: 0;
}
.kibo-breadcrumb {
    font-size: 12px;
    color: var(--kibo-text-3);
    margin-top: 2px;
}
.kibo-subheader-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── ALERTS ─────────────────────────────────────────────────── */
.kibo-alert {
    margin: 16px 0 0;
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.kibo-alert-success { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.kibo-alert-error   { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }

/* ── MAIN + CONTAINER ───────────────────────────────────────── */
.kibo-main { flex: 1; padding: 24px 0 40px; }
.kibo-container { width: 100%; padding: 0 32px; }

/* ── CARDS ──────────────────────────────────────────────────── */
.kibo-card {
    background: var(--kibo-card);
    border-radius: 12px;
    border: 0.5px solid var(--kibo-border);
    padding: 24px;
    margin-bottom: 16px;
}
.kibo-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--kibo-border);
}
.kibo-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--kibo-navy);
    margin: 0;
}

/* ── STAT CARDS ─────────────────────────────────────────────── */
.kibo-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.kibo-stat {
    background: var(--kibo-card);
    border-radius: 10px;
    border: 0.5px solid var(--kibo-border);
    padding: 16px 20px;
    border-left: 3px solid var(--kibo-border);
}
.kibo-stat-label {
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--kibo-text-3);
    margin-bottom: 6px;
}
.kibo-stat-value {
    font-size: 28px;
    font-weight: 500;
    color: var(--kibo-text-1);
    font-family: 'DM Mono', monospace;
    line-height: 1;
}
.kibo-stat-sub {
    font-size: 11px;
    color: var(--kibo-text-3);
    margin-top: 4px;
}

/* ── STATUS BADGES ──────────────────────────────────────────── */
.kibo-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.kibo-badge-open     { background: var(--status-open-bg);   color: var(--status-open-txt); }
.kibo-badge-acknowledged { background: var(--status-ack-bg); color: var(--status-ack-txt); }
.kibo-badge-in_progress  { background: var(--status-prog-bg); color: var(--status-prog-txt); }
.kibo-badge-resolved { background: var(--status-res-bg);    color: var(--status-res-txt); }
.kibo-badge-closed   { background: var(--status-closed-bg); color: var(--status-closed-txt); }

/* ── PRIORITY COLOURS ───────────────────────────────────────── */
.kibo-pri-low     { color: var(--pri-low-txt); }
.kibo-pri-medium  { color: var(--pri-medium-txt); }
.kibo-pri-high    { color: var(--pri-high-txt); font-weight: 600; }
.kibo-pri-urgent  { color: var(--pri-urgent-txt); font-weight: 700; }

/* ── WO NUMBER ──────────────────────────────────────────────── */
.kibo-wo-number {
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    color: var(--kibo-blue);
    font-weight: 500;
}

/* ── BUTTONS ────────────────────────────────────────────────── */
.kibo-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}
/* Primary: solid grey — the ONE main action per screen */
.kibo-btn-primary { background: var(--kibo-teal); color: #fff; }
.kibo-btn-primary:hover { background: var(--kibo-teal-dark); color: #fff; }
/* Secondary: outlined grey — Back, Cancel, Clear (clearly a button, clearly subordinate) */
.kibo-btn-secondary { background: #fff; color: #4C5563; border: 1.5px solid #9CA3AF; }
.kibo-btn-secondary:hover { background: #F9FAFB; border-color: #6B7280; color: #374151; }
/* Outline: blue-accented — supporting actions like Export, Filter, View */
.kibo-btn-outline { background: #fff; color: var(--kibo-blue); border: 1.5px solid #C5D4E8; }
.kibo-btn-outline:hover { border-color: var(--kibo-blue); background: #EBF4FB; color: var(--kibo-blue); }
.kibo-btn-danger { background: #FEF2F2; color: #991B1B; }
.kibo-btn-danger:hover { background: #FEE2E2; }
.kibo-btn-sm { padding: 6px 12px; font-size: 12px; }

/* ── FORMS ──────────────────────────────────────────────────── */
.kibo-form-group { margin-bottom: 20px; }
.kibo-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}
.kibo-label .required { color: #EF4444; margin-left: 2px; }
.kibo-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--kibo-input-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    color: var(--kibo-text-1);
    background: #fff;
    transition: border-color 0.15s;
    outline: none;
}
.kibo-input:focus { border-color: var(--kibo-blue); box-shadow: 0 0 0 3px #EBF4FB; }
.kibo-input::placeholder { color: var(--kibo-text-3); }
.kibo-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--kibo-input-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    color: var(--kibo-text-1);
    background: #fff;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%236B7280' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}
.kibo-select:focus { border-color: var(--kibo-blue); box-shadow: 0 0 0 3px #EBF4FB; }
.kibo-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--kibo-input-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    color: var(--kibo-text-1);
    background: #fff;
    outline: none;
    resize: vertical;
    min-height: 100px;
}
.kibo-textarea:focus { border-color: var(--kibo-blue); box-shadow: 0 0 0 3px #EBF4FB; }

/* ── CATEGORY TILES ─────────────────────────────────────────── */
.kibo-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
}
.kibo-tile {
    border: 1px solid var(--kibo-border);
    border-radius: 8px;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: #fff;
}
.kibo-tile:hover { border-color: var(--kibo-blue); background: var(--kibo-bg); }
.kibo-tile.selected { border-color: var(--kibo-blue); background: #EBF4FB; border-width: 2px; }
.kibo-tile-icon { font-size: 20px; margin-bottom: 4px; display: block; }
.kibo-tile-label { font-size: 11px; color: var(--kibo-text-2); }
.kibo-tile.selected .kibo-tile-label { color: #0D5A8E; font-weight: 600; }

/* ── WORK ORDER LIST ROWS ───────────────────────────────────── */
.kibo-wo-list { display: flex; flex-direction: column; gap: 8px; }
.kibo-wo-row {
    background: #fff;
    border: 0.5px solid var(--kibo-border);
    border-radius: 8px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.kibo-wo-row:hover {
    border-color: var(--kibo-blue);
    box-shadow: 0 2px 8px rgba(24,117,186,0.08);
}
.kibo-wo-row-main { flex: 1; min-width: 0; }
.kibo-wo-row-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--kibo-text-1);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kibo-wo-row-meta {
    font-size: 12px;
    color: var(--kibo-text-3);
}

/* ── PRIORITY SELECTOR ──────────────────────────────────────── */
.kibo-priority-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.kibo-priority-btn {
    padding: 9px 8px;
    border: 1px solid var(--kibo-border);
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    background: #fff;
    transition: all 0.15s;
    color: var(--kibo-text-2);
}
.kibo-priority-btn:hover { border-color: var(--kibo-blue); }
.kibo-priority-btn.selected { border-width: 2px; }
.kibo-priority-btn[data-priority="low"].selected    { border-color: #6B7280; background: #F9FAFB; color: #374151; }
.kibo-priority-btn[data-priority="medium"].selected { border-color: var(--kibo-blue); background: #EBF4FB; color: #0D5A8E; }
.kibo-priority-btn[data-priority="high"].selected   { border-color: #F59E0B; background: #FFFBEB; color: #92400E; }
.kibo-priority-btn[data-priority="urgent"].selected { border-color: #EF4444; background: #FEF2F2; color: #991B1B; }

/* ── TIMELINE ───────────────────────────────────────────────── */
.kibo-timeline { position: relative; padding-left: 20px; }
.kibo-tl-item { position: relative; padding-bottom: 20px; }
.kibo-tl-item::before {
    content: '';
    position: absolute;
    left: -15px;
    top: 10px;
    width: 1px;
    height: 100%;
    background: var(--kibo-border);
}
.kibo-tl-item:last-child::before { display: none; }
.kibo-tl-dot {
    position: absolute;
    left: -19px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.kibo-tl-title { font-size: 13px; font-weight: 600; color: var(--kibo-text-1); }
.kibo-tl-meta  { font-size: 11px; color: var(--kibo-text-3); margin-top: 2px; }

/* ── EMPTY STATE ────────────────────────────────────────────── */
.kibo-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--kibo-text-3);
}
.kibo-empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }
.kibo-empty-title { font-size: 16px; font-weight: 600; color: var(--kibo-text-2); margin-bottom: 6px; }
.kibo-empty-sub   { font-size: 13px; margin-bottom: 20px; }

/* ── TWO COLUMN LAYOUT ──────────────────────────────────────── */
.kibo-two-col {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 20px;
    align-items: start;
}

/* ── DETAIL ROWS ────────────────────────────────────────────── */
.kibo-detail-row {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #F5F5F5;
    font-size: 13px;
}
.kibo-detail-row:last-child { border-bottom: none; }
.kibo-detail-label { color: var(--kibo-text-3); width: 140px; flex-shrink: 0; }
.kibo-detail-value { color: var(--kibo-text-1); font-weight: 500; flex: 1; }

/* ── FOOTER ─────────────────────────────────────────────────── */
.kibo-footer {
    background: #fff;
    border-top: 1px solid var(--kibo-border);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--kibo-text-3);
}
.kibo-footer-links { display: flex; gap: 16px; }
.kibo-footer-links a { color: var(--kibo-text-3); text-decoration: none; }
.kibo-footer-links a:hover { color: var(--kibo-text-2); }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .kibo-two-col { grid-template-columns: 1fr; }
    .kibo-priority-grid { grid-template-columns: repeat(2, 1fr); }
    .kibo-nav-links { display: none !important; }   /* replaced by mobile drawer */
    #kibo-nav-right { margin-left: 0 !important; }  /* hamburger owns the right margin */
    #kibo-hamburger { display: flex !important; }    /* show hamburger on mobile */
    .kibo-nav-inner { gap: 8px; padding: 0 12px; }
    .kibo-subheader-inner { flex-direction: column; align-items: flex-start; }
    .kibo-container { padding: 0 16px; }
    .kibo-stat-value { font-size: 22px; }
}

@media (max-width: 375px) {
    .kibo-tiles { grid-template-columns: repeat(3, 1fr); }
    .kibo-priority-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── ACCESSIBILITY (WCAG 2.1 AA) ───────────────────────────── */

/* Skip navigation link — Bootstrap 5 visually-hidden-focusable pattern.
   Hidden via sr-only clip. On focus: position:static so it appears in normal
   document flow above the nav — immune to body transforms and overflow:hidden. */
.kibo-skip-link {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    text-decoration: none;
}
.kibo-skip-link:focus,
.kibo-skip-link:focus-visible,
.kibo-skip-link[data-skip-focused] {
    position: static !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    padding: 12px 20px !important;
    margin: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
    background: #0F1F3D !important;
    color: #fff !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    text-align: center !important;
    outline: 3px solid #1875BA !important;
    outline-offset: -3px !important;
    box-sizing: border-box !important;
}

/* Universal keyboard focus ring — WCAG 2.1 AA */
:focus-visible {
    outline: 2px solid var(--kibo-blue, #1875BA) !important;
    outline-offset: 2px !important;
    border-radius: 3px;
}

/* Dark sidebar surfaces — use white focus ring for contrast */
.kadmin-sidebar :focus-visible,
#kibo-mobile-nav :focus-visible {
    outline-color: rgba(255,255,255,0.85) !important;
}

/* Custom toggle switch — 1.4.11 non-text contrast
   OFF track: #6B7280 (4.84:1 on white — passes 3:1)
   ON  track: #1875BA (Kibog Blue)
   Focus ring shown on sibling track when checkbox receives keyboard focus */
.kibo-toggle-wrap { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.kibo-toggle-track { position: absolute; inset: 0; border-radius: 99px; transition: background 0.2s; }
.kibo-toggle-thumb { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: left 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.kibo-toggle-wrap input[type="checkbox"]:focus-visible ~ .kibo-toggle-track {
    outline: 2px solid #1875BA;
    outline-offset: 2px;
}

/* Screen-reader-only utility class */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}
/* ── Avatar / symbol replacements ─────────────────────────────── */
.symbol { display: inline-flex; align-items: center; }
.symbol.symbol-35 .symbol-label { width: 35px; height: 35px; font-size: 14px; }
.symbol-label {
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; font-weight: 700;
    background-color: rgba(255,255,255,0.3);
}
.bg-white-o-30 { background-color: rgba(255,255,255,0.3) !important; }
/* svg-icon sizing (previously from style.bundle.css) */
.svg-icon { display: inline-flex; align-items: center; justify-content: center; }
.svg-icon.svg-icon-3x svg { width: 36px; height: 36px; }
.svg-icon-success svg path { fill: #1875BA; }
