/* ============================================================
   Ticket Sys — Global Styles
   ============================================================ */

:root {
    --sidebar-w: 220px;
    --sidebar-bg: #3b4856;
    --sidebar-hover: #495869;
    --sidebar-active: #7a9bb5;
    --sidebar-text: #b3c1cc;
    --sidebar-text-bright: #e6eaee;
    --sidebar-section: #8a9aaa;
    --body-bg: #f0f2f5;
    --card-shadow: 0 2px 8px rgba(0,0,0,.05);
    --accent: #7a9bb5;

    /* Font scale */
    --font-2xs: .6rem;
    --font-xs: .65rem;
    --font-sm: .72rem;
    --font-base: .78rem;
    --font-md: .82rem;
    --font-lg: .85rem;

    /* Colors */
    --text-primary: #292524;
    --text-secondary: #8a9aaa;
    --text-muted: #6b7785;
    --border-color: #d8dce3;
    --border-light: #e0e3e8;
    --border-separator: #f0efed;
    --bg-light: #f6f7f9;
    --bg-white: #fff;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--body-bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: .875rem;
    color: var(--text-primary);
}

/* ---- Fixed Sidebar ---- */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1030;
    overflow-y: auto;
    transition: width .2s ease;
}

.sidebar-brand-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,.07);
    padding-right: 8px;
}

.sidebar-brand {
    padding: 18px 20px 14px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: .03em;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.sidebar-brand:hover { color: #fff; }
.sidebar-logo { height: 22px; width: auto; }
.sidebar-collapsed .sidebar .sidebar-logo { height: 18px; }

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--sidebar-section);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: .9rem;
    transition: color .15s, background .15s;
    flex-shrink: 0;
}
.sidebar-toggle:hover {
    color: var(--sidebar-text-bright);
    background: var(--sidebar-hover);
}

.sidebar-section {
    padding: 14px 16px 2px;
    font-size: .6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--sidebar-section);
}

.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0 8px;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 5px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: .78rem;
    font-weight: 500;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.sidebar-nav li a:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-bright);
}
.sidebar-nav li a.active {
    background: var(--sidebar-active);
    color: #fff;
}
.sidebar-nav li a i {
    font-size: .88rem;
    width: 18px;
    text-align: center;
    opacity: .8;
}

.sidebar-footer {
    margin-top: auto;
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,.07);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--sidebar-text);
    font-size: .8rem;
}


.sidebar-user .name {
    font-weight: 600;
    color: var(--sidebar-text-bright);
    font-size: .8rem;
    line-height: 1.2;
}

.sidebar-user .dept {
    font-size: .7rem;
    color: var(--sidebar-section);
}

.sidebar-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.sidebar-actions .btn {
    font-size: .7rem;
    padding: 2px 8px;
}

/* ---- Main Content ---- */
.main-content {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    transition: margin-left .2s ease;
}

.main-content > .content-area {
    padding: 24px 28px;
}

/* ---- Simulation Banner ---- */
.sim-banner {
    background: #fff3cd;
    color: #664d03;
    padding: 8px 20px;
    font-size: .8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border-bottom: 1px solid #ffecb5;
}

/* ---- Toast / Messages ---- */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1080;
}

.ph-toast {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
    font-size: .82rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideIn .3s ease;
}
.ph-toast.success { border-left: 4px solid #43a047; }
.ph-toast.error { border-left: 4px solid #e53935; }
.ph-toast.info { border-left: 4px solid var(--accent); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ---- Cards ---- */
.card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: none;
}

/* ---- Workflow Timeline ---- */
.wf-timeline {
    display: flex;
    align-items: flex-start;
    overflow: visible;
    padding: 4px 0;
    gap: 0;
}
.wf-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 70px;
    flex-shrink: 0;
    cursor: default;
}
.wf-step.active, .wf-step.completed {
    cursor: pointer;
}
.wf-dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .65rem;
    font-weight: 700;
    background: #e8eaed;
    color: var(--text-secondary);
    transition: all .2s;
}
.wf-step.completed .wf-dot {
    background: #5a7a6a;
    color: #fff;
}
.wf-step.active .wf-dot {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(122,155,181,.25);
}
.wf-label {
    font-size: .65rem;
    color: var(--text-secondary);
    margin-top: 2px;
    text-align: center;
    line-height: 1.2;
    max-width: 80px;
    word-break: keep-all;
}
.wf-step.active .wf-label {
    color: var(--text-primary);
    font-weight: 600;
}
.wf-step.completed .wf-label {
    color: #5a7a6a;
}
.wf-time {
    font-size: .58rem;
    color: var(--text-secondary);
    margin-top: 1px;
}
.wf-line {
    flex: 1;
    min-width: 20px;
    height: 2px;
    background: #e8eaed;
    margin-top: 12px;
    transition: background .2s;
}
.wf-line.completed {
    background: #5a7a6a;
}
@media (max-width: 768px) {
    .wf-step { min-width: 56px; }
    .wf-label { font-size: .58rem; max-width: 60px; }
    .wf-dot { width: 22px; height: 22px; font-size: .6rem; }
    .wf-line { margin-top: 10px; }
}

/* ---- Notification Panel ---- */
.sidebar-notification {
    position: relative;
}
.sidebar-notification:hover {
    background: var(--sidebar-hover);
}
.notif-panel {
    position: fixed;
    left: 260px;
    top: 40px;
    width: 340px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    z-index: 1060;
}
.sidebar-collapsed .notif-panel {
    left: 64px;
}
.notif-item {
    display: flex;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-separator);
    cursor: pointer;
    font-size: .78rem;
    transition: background .15s;
}
.notif-item:hover {
    background: #f8f7f6;
}
.notif-item.unread {
    background: rgba(122,155,181,.06);
}
.notif-item .notif-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .75rem;
    background: rgba(122,155,181,.15);
    color: var(--accent);
}
.notif-item .notif-body {
    flex: 1;
    min-width: 0;
}
.notif-item .notif-msg {
    color: var(--text-primary);
    line-height: 1.3;
}
.notif-item .notif-time {
    color: var(--text-secondary);
    font-size: .7rem;
}
@media (max-width: 768px) {
    .notif-panel {
        left: 10px;
        right: 10px;
        width: auto;
    }
}

/* ---- Mention Dropdown ---- */
.mention-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
    z-index: 1050;
    margin-bottom: 4px;
}
.mention-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: .82rem;
}
.mention-item:hover, .mention-item.active {
    background: rgba(122,155,181,.1);
}
.mention-item .mention-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    flex-shrink: 0;
}
.mention-item .mention-icon.user {
    background: rgba(122,155,181,.15);
    color: var(--accent);
}
.mention-item .mention-icon.dept {
    background: rgba(255,152,0,.1);
    color: #f57c00;
}
.mention-item .mention-name {
    font-weight: 500;
    color: var(--text-primary);
}
.mention-item .mention-dept {
    font-size: .72rem;
    color: var(--text-secondary);
}

.dash-card {
    transition: border-color .2s, box-shadow .2s;
}
.dash-card.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(122, 155, 181, .3);
}

/* ---- Detail Page Utilities ---- */
.editable-input {
    border: 1px solid transparent;
    background: transparent;
    padding: 2px 6px;
    font-size: var(--font-md);
    transition: border-color .15s, background .15s;
}
.editable-input:focus {
    border-color: var(--border-color);
    background: var(--bg-white);
}
.info-table { font-size: var(--font-md); }
.info-table td { padding: 1px 8px; }
.info-table .info-label {
    width: 80px;
    font-size: var(--font-base);
    color: var(--text-secondary);
}
.info-table tr + tr td { border-top: 1px solid var(--border-separator); }
.info-table tr:first-child td { border-top: none; }

.btn-action {
    font-size: var(--font-sm);
    padding: 1px 10px;
}

.text-accent { color: var(--accent); }
.text-meta { font-size: var(--font-sm); color: var(--text-secondary); }
.text-tiny { font-size: var(--font-2xs); }

.workflow-bar {
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    margin-top: 6px;
    padding: 6px 10px;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    overflow: visible;
}
.workflow-divider {
    width: 1px;
    background: var(--border-light);
    align-self: stretch;
    margin: 0 14px;
    flex-shrink: 0;
}

/* ---- Tables ---- */
.table thead th {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    background: #495869;
    color: #e6eaee;
    border: none;
}

.table td {
    font-size: .82rem;
    vertical-align: middle;
}

.table .child-row td {
    background: #e8edf3;
}

/* ---- Tabs ---- */
.nav-tabs { border-bottom-color: var(--border-color); }
.nav-tabs .nav-link { color: var(--text-secondary); font-size: .82rem; }
.nav-tabs .nav-link:hover { color: var(--accent); }
.nav-tabs .nav-link.active { color: var(--text-primary); font-weight: 600; border-color: var(--border-color) var(--border-color) #fff; }

/* ---- Priority Selector ---- */
.priority-group { display:flex; border:1px solid var(--border-color); border-radius:6px; overflow:hidden; }
.priority-radio { display:inline-flex; align-items:center; justify-content:center; gap:4px; padding:5px 0; border:none; border-right:1px solid var(--border-color); background:#fff; cursor:pointer; font-size:.75rem; flex:1; transition:background .15s; }
.priority-radio:last-child { border-right:none; }
.priority-radio input { display:none; }
.priority-radio:hover { background:#f5f5f4; }
.priority-radio.active { background:rgba(122,155,181,.15); font-weight:600; }
.priority-dot { width:8px; height:8px; border-radius:50%; display:inline-block; }
.priority-dot-high { background:#fd7e14; }
.priority-dot-normal { background:#0d6efd; }
.priority-dot-urgent { background:#dc3545; }

/* ---- Page Header ---- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-header h4 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

/* ---- Kanban ---- */
.kanban-wrapper {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
}
.kanban-column {
    min-width: 240px;
    flex: 1;
    background: #f5f5f4;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 140px);
}
.kanban-header {
    padding: 10px 12px;
    font-weight: 600;
    font-size: .82rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.kanban-body {
    padding: 8px;
    overflow-y: auto;
    flex: 1;
}
.kanban-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 6px;
    cursor: grab;
    transition: box-shadow .15s;
}
.kanban-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.kanban-card.dragging { opacity: .5; }
.kanban-card .ticket-no { font-size: .7rem; color: #a8a29e; font-weight: 600; }
.kanban-card .ticket-title { font-size: .82rem; color: #263238; text-decoration: none; display: block; margin: 2px 0; }
.kanban-card .ticket-meta { font-size: .7rem; color: #d6d3d1; display: flex; justify-content: space-between; align-items: center; }

/* ---- Badges ---- */
.badge { font-weight: 500; font-size: .72rem; }
.status-badge {
    display: inline-block;
    min-width: 58px;
    text-align: center;
    padding: 2px 8px 2px 6px;
    border-radius: 3px;
    font-size: .72rem;
    font-weight: 600;
    background: transparent;
}

/* ---- Buttons ---- */
.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: #6888a0; border-color: #6888a0; }

/* ---- Sidebar Collapsed ---- */
.sidebar-collapsed .sidebar {
    width: 60px;
}
.sidebar-collapsed .sidebar .sidebar-logo,
.sidebar-collapsed .sidebar .brand-text,
.sidebar-collapsed .sidebar .sidebar-section,
.sidebar-collapsed .sidebar .sidebar-nav li a span,
.sidebar-collapsed .sidebar .sidebar-user .name,
.sidebar-collapsed .sidebar .sidebar-user .dept,
.sidebar-collapsed .sidebar .sidebar-actions {
    display: none;
}
.sidebar-collapsed .sidebar .sidebar-brand {
    padding: 18px 0 14px;
    justify-content: center;
}
.sidebar-collapsed .sidebar .sidebar-brand-wrap {
    flex-direction: column;
    align-items: center;
    padding-right: 0;
}
.sidebar-collapsed .sidebar .sidebar-toggle {
    position: static;
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 8px 0;
}
.sidebar-collapsed .sidebar .sidebar-toggle i::before {
    content: "\f285"; /* bi-chevron-right */
}
.sidebar-collapsed .sidebar .sidebar-nav li a {
    justify-content: center;
    padding: 10px 0;
}
.sidebar-collapsed .sidebar .sidebar-nav li a i {
    font-size: 1.1rem;
    width: auto;
}
.sidebar-collapsed .sidebar .sidebar-footer {
    padding: 8px;
    text-align: center;
}
.sidebar-collapsed .sidebar .sidebar-user {
    justify-content: center;
}
.sidebar-collapsed .main-content {
    margin-left: 60px;
}

/* ---- Mobile Topbar ---- */
.mobile-topbar {
    display: none;
    background: var(--sidebar-bg);
    color: #fff;
    padding: 10px 16px;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1020;
}
.mobile-topbar .brand {
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
}
.mobile-topbar .hamburger {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 1029;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .mobile-topbar { display: flex; }

    .sidebar {
        width: var(--sidebar-w);
        transform: translateX(-100%);
        transition: transform .25s ease;
    }
    .sidebar-mobile-open .sidebar {
        transform: translateX(0);
    }
    .sidebar-mobile-open .sidebar-overlay {
        display: block;
    }
    .sidebar .sidebar-toggle { display: none; }

    .main-content {
        margin-left: 0;
    }
    .sidebar-collapsed .main-content {
        margin-left: 0;
    }

    .main-content > .content-area {
        padding: 16px;
    }
}
