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

:root {
    --primary: #00838f;
    --primary-dark: #2c3e50;
    --primary-light: #e0f7fa;
    --accent: #00bcd4;
    --danger: #e74c3c;
    --success: #27ae60;
    --warning: #f39c12;
    --purple: #8e44ad;
    --gray-50: #f8f9fa;
    --gray-100: #ecf0f1;
    --gray-200: #dce1e3;
    --gray-300: #bdc3c7;
    --gray-400: #95a5a6;
    --gray-500: #7f8c8d;
    --gray-700: #34495e;
    --gray-900: #2c3e50;
    --white: #fff;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --sidebar-width: 220px;
    --header-height: 48px;
}

body { font-family: var(--font); background: var(--gray-50); color: var(--gray-900); font-size: 14px; line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.header { position: fixed; top: 0; left: 0; right: 0; height: var(--header-height); background: linear-gradient(135deg, #0f2027, #203a43, #2c5364); display: flex; align-items: center; padding: 0; z-index: 100; color: var(--white); }
.header-hamburger { background: none; border: none; color: var(--white); cursor: pointer; padding: 0; margin: 0; border-radius: 0; width: 56px; height: var(--header-height); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.header-hamburger:hover { background: rgba(255,255,255,0.1); }
.header-brand { font-size: 18px; font-weight: 600; color: var(--white); text-decoration: none; padding-left: 24px; }
.header-brand:hover { color: var(--white); text-decoration: none; opacity: 0.85; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; padding-right: 10px; }
.header-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--danger); color: var(--white); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; cursor: pointer; }

/* Sidebar */
.sidebar { position: fixed; top: var(--header-height); left: 0; bottom: 0; width: var(--sidebar-width); background: var(--white); border-right: 1px solid var(--gray-200); overflow: hidden; z-index: 90; transition: width 0.25s ease; }
.sidebar-nav { list-style: none; padding: 8px 0; }
.sidebar-nav li a { display: flex; align-items: center; gap: 12px; padding: 11px 18px; color: var(--gray-700); font-size: 14px; font-weight: 500; transition: background 0.15s; letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; }
.sidebar-nav li a:hover, .sidebar-nav li a.active { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.sidebar-nav li a .nav-icon { width: 20px; height: 20px; flex-shrink: 0; opacity: 0.6; }
.sidebar-nav li a:hover .nav-icon, .sidebar-nav li a.active .nav-icon { opacity: 1; }
.sidebar-nav li a .nav-text { transition: opacity 0.2s ease; }

/* Main */
.main { margin-left: var(--sidebar-width); margin-top: var(--header-height); padding: 24px; min-height: calc(100vh - var(--header-height) - 40px); transition: margin-left 0.25s ease; }

/* Footer */
.footer { margin-left: var(--sidebar-width); padding: 10px 24px; font-size: 12px; color: var(--gray-400); border-top: 1px solid var(--gray-200); display: flex; justify-content: space-between; transition: margin-left 0.25s ease; }

/* Page header / breadcrumb title */
.page-header { margin-bottom: 20px; }
.page-title { font-size: 22px; font-weight: 600; color: var(--gray-900); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-title a { color: var(--primary); text-decoration: none; }
.page-title a:hover { text-decoration: underline; }
.page-title .sep { color: var(--gray-300); font-weight: 400; }
.page-title .current { color: var(--gray-900); }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 600; margin-bottom: 20px; }
.breadcrumb a { color: var(--primary); }
.breadcrumb .sep { color: var(--gray-300); font-weight: 400; }

/* Cards grid */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card { background: var(--white); border: 2px solid var(--accent); border-radius: 8px; overflow: hidden; transition: box-shadow 0.15s; }
.card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.card-body { padding: 16px; text-align: center; }
.card-title { font-size: 16px; font-weight: 600; color: var(--primary); margin-bottom: 4px; }
.card-title a { color: var(--primary); }
.card-subtitle { font-size: 13px; color: var(--gray-500); }
.card-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; border-top: 1px solid var(--gray-100); }
.card-stat { padding: 10px 8px; text-align: center; font-size: 20px; font-weight: 600; color: var(--primary); border-right: 1px solid var(--gray-100); }
.card-stat:last-child { border-right: none; }
.card-stat small { display: block; font-size: 10px; font-weight: 400; color: var(--gray-400); text-transform: uppercase; }

/* Tables */
.table-wrap { background: var(--white); border-radius: 8px; overflow: hidden; border: 1px solid var(--gray-200); }
table { width: 100%; border-collapse: collapse; }
th { background: var(--gray-50); padding: 10px 14px; text-align: left; font-weight: 600; font-size: 13px; color: var(--gray-500); text-transform: uppercase; border-bottom: 2px solid var(--gray-200); }
td { padding: 10px 14px; border-bottom: 1px solid var(--gray-100); font-size: 14px; }
tr:hover td { background: var(--gray-50); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border: none; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; transition: opacity 0.15s; line-height: 1.4; min-height: 36px; }
.btn:hover { opacity: 0.85; text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--white); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-success { background: var(--success); color: var(--white); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-purple { background: var(--purple); color: var(--white); }
.btn-outline { background: var(--white); color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-sm { padding: 8px 12px; font-size: 13px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 13px; color: var(--gray-700); }
.form-label .req { color: var(--danger); }
.form-control { width: 100%; padding: 8px 12px; border: 1px solid var(--gray-200); border-radius: 6px; font-size: 14px; font-family: var(--font); background: var(--white); }
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(0,188,212,0.15); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 180px 1fr; align-items: start; gap: 12px; margin-bottom: 16px; }
.form-row .form-label { padding-top: 8px; margin-bottom: 0; }
.form-card { background: var(--white); border: 1px solid var(--gray-200); border-radius: 8px; padding: 24px; max-width: 700px; }

/* Toggle buttons (type selector) */
.type-btns { display: flex; gap: 0; }
.type-btn { padding: 8px 18px; border: 1px solid var(--gray-200); background: var(--white); cursor: pointer; font-size: 13px; font-weight: 600; color: var(--gray-700); transition: all 0.15s; }
.type-btn:first-child { border-radius: 6px 0 0 6px; }
.type-btn:last-child { border-radius: 0 6px 6px 0; }
.type-btn.active { background: var(--accent); color: var(--white); border-color: var(--accent); }

/* Yes/No toggle */
.toggle { position: relative; display: inline-block; width: 48px; height: 26px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--gray-300); border-radius: 26px; transition: 0.2s; }
.toggle-slider::before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; bottom: 3px; background: var(--white); border-radius: 50%; transition: 0.2s; }
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(22px); }

/* Filter bar */
.filter-bar { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.filter-bar select { max-width: 300px; }

/* Action bar */
.action-bar { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }

/* Page top bar: title + actions on same line */
.page-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-top .breadcrumb { margin-bottom: 0; }
.page-top .action-bar { margin-bottom: 0; }

/* Section headers */
.section-title { font-size: 16px; font-weight: 600; text-align: center; margin: 0 0 8px; color: var(--gray-700); }
.section-count { display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: var(--white); min-width: 24px; height: 24px; border-radius: 4px; font-size: 13px; font-weight: 600; padding: 0 6px; }

/* Kanban board */
.kanban { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.kanban-column { background: var(--gray-50); border-radius: 8px; padding: 12px; min-height: 200px; }
.kanban-column .table-wrap { background: transparent; border: none; }
.kanban-column table { background: var(--white); border-radius: 6px; overflow: hidden; }
.kanban-column tr:last-child td { border-bottom: none; }
@media (max-width: 900px) { .kanban { grid-template-columns: 1fr; } }

/* Issue row styling */
.issue-row-bug td:first-child { border-left: 4px solid var(--danger); }
.issue-row-task td:first-child { border-left: 4px solid var(--gray-700); }
.issue-row-support td:first-child { border-left: 4px solid var(--purple); }
.issue-row-request td:first-child { border-left: 4px solid var(--warning); }
.ref-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.ref-bug { background: #fde8e8; color: var(--danger); }
.ref-task { background: var(--gray-100); color: var(--gray-700); }
.ref-support { background: #f3e5f5; color: var(--purple); }
.ref-request { background: #fff3e0; color: var(--warning); }

/* Workflow pipeline */
.workflow { display: flex; align-items: flex-start; justify-content: center; gap: 0; margin: 24px 0; position: relative; }
.workflow::before { content: ''; position: absolute; top: 36px; left: 15%; right: 15%; height: 3px; background: var(--gray-200); z-index: 0; }
.workflow-step { display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; z-index: 1; flex: 1; max-width: 160px; }
.workflow-icon { width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 28px; border: 3px solid var(--gray-200); background: var(--white); color: var(--gray-300); }
.workflow-step.done .workflow-icon { background: var(--primary); border-color: var(--primary); color: var(--white); }
.workflow-step.current .workflow-icon { border-color: var(--accent); color: var(--accent); }
.workflow-label { font-size: 13px; font-weight: 600; color: var(--gray-500); }
.workflow-step.done .workflow-label { color: var(--primary); }
.workflow-meta { font-size: 11px; color: var(--gray-400); text-align: center; }

/* Issue detail */
.issue-content { background: var(--white); border: 2px solid var(--accent); border-radius: 8px; padding: 20px; margin-bottom: 20px; }
.issue-field-label { font-size: 12px; color: var(--gray-400); text-transform: uppercase; margin-bottom: 2px; }
.issue-field-value { margin-bottom: 14px; white-space: pre-wrap; }
.issue-link { display: inline-block; background: var(--primary); color: var(--white); padding: 8px 16px; border-radius: 6px; font-size: 13px; word-break: break-all; }

/* Comments */
.comments { margin-top: 20px; }
.comment-form { display: flex; gap: 8px; margin-bottom: 20px; }
.comment-form input { flex: 1; }
.comment { background: var(--white); border-radius: 8px; padding: 12px; margin-bottom: 8px; border: 1px solid var(--gray-100); }
.comment-author { font-weight: 600; font-size: 13px; }
.comment-date { font-size: 11px; color: var(--gray-400); }
.comment-body { margin-top: 4px; font-size: 14px; }

/* Status badges */
.status-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.status-queued { background: #fff3e0; color: #e65100; }
.status-in-progress { background: #e3f2fd; color: #1565c0; }
.status-completed { background: #e8f5e9; color: #2e7d32; }
.status-reviewed { background: #f3e5f5; color: #7b1fa2; }

/* Pagination */
.pagination { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-size: 13px; color: var(--gray-500); }

/* Tabs */
.tabs { display: flex; gap: 0; margin-bottom: 20px; border-bottom: 2px solid var(--gray-200); }
.tab { padding: 10px 20px; font-weight: 600; font-size: 14px; color: var(--gray-500); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; text-decoration: none; }
.tab:hover { color: var(--primary); text-decoration: none; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Login page */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--gray-50); }
.login-card { background: var(--white); border-radius: 12px; padding: 40px; width: 100%; max-width: 400px; box-shadow: 0 4px 24px rgba(0,0,0,0.08); text-align: center; }
.login-card h1 { font-size: 24px; margin-bottom: 4px; color: var(--primary-dark); }
.login-card p { color: var(--gray-500); margin-bottom: 24px; }
.login-card .form-group { text-align: left; }
.login-error { background: #fde8e8; color: var(--danger); padding: 8px 12px; border-radius: 6px; font-size: 13px; margin-bottom: 16px; }

/* Advance button */
.advance-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; background: var(--accent); color: var(--white); border: none; border-radius: 6px; cursor: pointer; font-size: 16px; font-weight: 700; }
.advance-btn:hover { opacity: 0.85; }

/* Header client name */
.header-client-name { font-weight: 400; opacity: 0.7; font-size: 15px; }

/* Client picker */
.client-picker-wrap { position: relative; }
.client-picker-btn { background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.25); color: var(--white); cursor: pointer; border-radius: 6px; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; transition: background 0.15s; }
.client-picker-btn:hover { background: rgba(255,255,255,0.25); }
.client-picker { display: none; position: absolute; top: 40px; right: 0; background: var(--white); border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); min-width: 220px; z-index: 200; overflow: hidden; }
.client-picker.show { display: block; }
.client-picker-title { padding: 10px 16px; font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--gray-400); letter-spacing: 0.05em; border-bottom: 1px solid var(--gray-100); }
.client-picker-item { display: block; padding: 9px 16px; color: var(--gray-700); font-size: 14px; text-decoration: none; cursor: pointer; }
.client-picker-item:hover { background: var(--gray-50); color: var(--primary); text-decoration: none; }
.client-picker-item.active { color: var(--primary); font-weight: 600; }

/* User menu dropdown */
.header-avatar-wrap { position: relative; }
.user-menu { display: none; position: absolute; top: 40px; right: 0; background: var(--white); border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); min-width: 200px; z-index: 200; overflow: hidden; }
.user-menu.show { display: block; }
.user-menu-header { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); font-weight: 600; color: var(--gray-900); }
.user-menu-header small { font-weight: 400; color: var(--gray-400); font-size: 12px; }
.user-menu a { display: block; padding: 10px 16px; color: var(--gray-700); font-size: 14px; text-decoration: none; }
.user-menu a:hover { background: var(--gray-50); color: var(--primary); }

/* Sidebar collapsed state - icon only */
.sidebar.collapsed { width: 56px; }
.sidebar.collapsed .sidebar-nav li a { padding: 11px 18px; }
.sidebar.collapsed .sidebar-nav li a .nav-text { opacity: 0; width: 0; overflow: hidden; }
.sidebar.collapsed ~ .main { margin-left: 56px; }
.sidebar.collapsed ~ .footer { margin-left: 56px; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .sidebar.open { display: block; z-index: 95; }
    .main, .footer { margin-left: 0; }
    .card-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .workflow { flex-wrap: wrap; }
    .page-top { flex-direction: column; align-items: flex-start; }
}
