/* Apprise Cyber Task Manager — Main Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary:    #0d1117;
    --bg-secondary:  #161b27;
    --bg-card:       #1c2333;
    --bg-hover:      #212840;
    --navy:          #0a0f1e;
    --cyan:          #00c8ff;
    --cyan-dim:      rgba(0, 200, 255, 0.15);
    --cyan-glow:     0 0 20px rgba(0, 200, 255, 0.3);
    --text-primary:  #e6edf3;
    --text-secondary:#8b949e;
    --text-muted:    #484f58;
    --border:        rgba(255,255,255,0.08);
    --border-cyan:   rgba(0, 200, 255, 0.3);
    --danger:        #f85149;
    --success:       #3fb950;
    --warning:       #d29922;
    --sidebar-width: 240px;
    --radius:        8px;
    --transition:    .2s ease;
}

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

html { font-size: 15px; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────────────── */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--navy);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-logo {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo img {
    max-width: 160px;
    height: auto;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.nav-section {
    padding: 4px 12px 2px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    margin-top: 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: var(--text-secondary);
    font-size: .875rem;
    font-weight: 500;
    transition: all var(--transition);
    border-left: 3px solid transparent;
    position: relative;
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
    text-decoration: none;
}

.nav-item.active {
    color: var(--cyan);
    background: var(--cyan-dim);
    border-left-color: var(--cyan);
}

.nav-item i { width: 18px; text-align: center; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cyan), #0066ff);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .75rem;
    flex-shrink: 0;
    color: white;
}

.user-info .user-name { font-size: .875rem; font-weight: 600; }
.user-info .user-role { font-size: .75rem; color: var(--text-secondary); }

.btn-logout {
    display: flex; align-items: center; gap: 8px;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: .8125rem;
    cursor: pointer;
    transition: all var(--transition);
}
.btn-logout:hover { border-color: var(--danger); color: var(--danger); }

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title { font-size: 1.125rem; font-weight: 600; }
.topbar-actions { display: flex; gap: 12px; align-items: center; }

.page-content {
    padding: 28px;
    flex: 1;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius);
    font-size: .875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--cyan);
    color: var(--navy);
}
.btn-primary:hover {
    background: #00e0ff;
    box-shadow: var(--cyan-glow);
    text-decoration: none;
    color: var(--navy);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--cyan);
    color: var(--cyan);
    text-decoration: none;
}

.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover { background: #ff6b6b; text-decoration: none; color: white; }

.btn-sm { padding: 5px 12px; font-size: .8125rem; }
.btn-xs { padding: 3px 8px; font-size: .75rem; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title { font-size: 1rem; font-weight: 600; }
.card-body { padding: 20px; }

/* ── Stats Cards ─────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: border-color var(--transition);
}
.stat-card:hover { border-color: var(--border-cyan); }

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.stat-icon.cyan    { background: var(--cyan-dim); color: var(--cyan); }
.stat-icon.green   { background: rgba(63,185,80,.15); color: var(--success); }
.stat-icon.red     { background: rgba(248,81,73,.15); color: var(--danger); }
.stat-icon.orange  { background: rgba(210,153,34,.15); color: var(--warning); }

.stat-value { font-size: 1.875rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .8125rem; color: var(--text-secondary); margin-top: 4px; }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    padding: 10px 14px;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    background: var(--bg-primary);
}
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: .875rem;
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-blue   { background: rgba(9,132,227,.2);  color: #74b9ff; border: 1px solid rgba(9,132,227,.3); }
.badge-green  { background: rgba(63,185,80,.2);  color: #56d364; border: 1px solid rgba(63,185,80,.3); }
.badge-pink   { background: rgba(232,62,140,.2); color: #f48fb1; border: 1px solid rgba(232,62,140,.3); }
.badge-tan    { background: rgba(180,140,90,.2);  color: #deb887; border: 1px solid rgba(180,140,90,.3); }
.badge-gray   { background: rgba(110,118,129,.2); color: #8b949e; border: 1px solid rgba(110,118,129,.3); }
.badge-cyan   { background: var(--cyan-dim); color: var(--cyan); border: 1px solid var(--border-cyan); }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label {
    display: block;
    font-size: .8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
    width: 100%;
    padding: 9px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: .875rem;
    font-family: inherit;
    transition: border-color var(--transition);
}
.form-control:focus {
    outline: none;
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(0,200,255,.1);
}
.form-control::placeholder { color: var(--text-muted); }

select.form-control option { background: var(--bg-card); }

textarea.form-control { resize: vertical; min-height: 90px; }

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .875rem;
}
.form-check input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: var(--cyan);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    margin-top: 24px;
}

.field-error {
    color: var(--danger);
    font-size: .75rem;
    margin-top: 4px;
}

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: .875rem;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.alert-success { background: rgba(63,185,80,.15); border: 1px solid rgba(63,185,80,.3); color: #56d364; }
.alert-error   { background: rgba(248,81,73,.15);  border: 1px solid rgba(248,81,73,.3); color: #f85149; }
.alert-warning { background: rgba(210,153,34,.15); border: 1px solid rgba(210,153,34,.3); color: #d29922; }
.alert-info    { background: var(--cyan-dim);       border: 1px solid var(--border-cyan); color: var(--cyan); }

/* ── Kanban phases ───────────────────────────────────────────── */
.kanban-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.phase-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.phase-card:hover { border-color: var(--border-cyan); box-shadow: var(--cyan-glow); }

.phase-card-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.phase-number {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--cyan-dim);
    color: var(--cyan);
    display: flex; align-items: center; justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    flex-shrink: 0;
}
.phase-name { font-weight: 600; font-size: .9375rem; }
.phase-card-body { padding: 14px 16px; }
.phase-assignees { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }

.avatar-sm {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cyan), #0066ff);
    color: white;
    font-size: .6875rem;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--bg-secondary);
    cursor: default;
    position: relative;
}
.avatar-sm[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: .7rem;
    white-space: nowrap;
    border: 1px solid var(--border);
    z-index: 10;
}

.phase-due { font-size: .75rem; color: var(--text-secondary); }
.phase-due.overdue { color: var(--danger); }

/* ── Hierarchy list ──────────────────────────────────────────── */
.hierarchy-group { margin-bottom: 8px; }
.hierarchy-category {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    user-select: none;
    font-weight: 600;
}
.hierarchy-category:hover { border-color: var(--border-cyan); }
.hierarchy-category .toggle-icon { transition: transform var(--transition); }
.hierarchy-category.open .toggle-icon { transform: rotate(90deg); }

.hierarchy-children { display: none; padding-left: 20px; margin-top: 4px; }
.hierarchy-children.open { display: block; }

.hierarchy-client {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 4px;
    cursor: pointer;
}
.hierarchy-client:hover { border-color: var(--border-cyan); }

.hierarchy-projects { padding-left: 20px; margin-top: 4px; display: none; }
.hierarchy-projects.open { display: block; }

.project-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 4px;
    font-size: .875rem;
}
.project-row:hover { border-color: var(--border-cyan); }

/* ── Donut chart ─────────────────────────────────────────────── */
.donut-wrap {
    position: relative;
    width: 160px; height: 160px;
    margin: 0 auto 16px;
}
.donut-svg { transform: rotate(-90deg); }
.donut-center {
    position: absolute;
    inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
}
.donut-center .donut-value { font-size: 1.5rem; font-weight: 700; }
.donut-center .donut-label { font-size: .7rem; color: var(--text-secondary); }
.donut-legend { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px; }
.legend-item { display: flex; align-items: center; gap: 5px; font-size: .75rem; color: var(--text-secondary); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ── Activity feed ────────────────────────────────────────────── */
.activity-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: .8125rem;
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--cyan-dim);
    color: var(--cyan);
    display: flex; align-items: center; justify-content: center;
    font-size: .75rem;
    flex-shrink: 0;
}
.activity-body { flex: 1; }
.activity-body strong { font-weight: 600; }
.activity-time { color: var(--text-muted); font-size: .75rem; white-space: nowrap; }

/* ── Filters bar ─────────────────────────────────────────────── */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}
.filters-bar .form-control { width: auto; }
.search-input { min-width: 220px; }

/* ── Workload table ───────────────────────────────────────────── */
.workload-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}
.workload-track {
    flex: 1;
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
}
.workload-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--cyan), #0066ff);
    border-radius: 4px;
    transition: width .4s ease;
}

/* ── Login page ──────────────────────────────────────────────── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    padding: 20px;
}
.login-box {
    width: 100%;
    max-width: 420px;
}
.login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo img { max-width: 200px; }
.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px;
}
.login-title {
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 24px;
}
.login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: .8125rem;
    color: var(--text-secondary);
}

/* ── Install wizard ──────────────────────────────────────────── */
.install-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    padding: 20px;
}
.install-box {
    width: 100%;
    max-width: 600px;
}
.install-steps {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
}
.install-step {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
}
.install-step.done { background: var(--success); }
.install-step.active { background: var(--cyan); }

/* ── Misc ────────────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.page-header h1 { font-size: 1.375rem; font-weight: 700; }
.breadcrumb { font-size: .8125rem; color: var(--text-secondary); margin-top: 4px; }
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--cyan); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.text-muted { color: var(--text-secondary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-cyan { color: var(--cyan); }
.text-right { text-align: right; }
.text-center { text-align: center; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.section-title { font-size: 1rem; font-weight: 600; margin-bottom: 12px; }

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-secondary);
}
.empty-state i { font-size: 2.5rem; margin-bottom: 12px; display: block; color: var(--text-muted); }

.client-logo-thumb {
    width: 36px; height: 36px;
    object-fit: contain;
    border-radius: 4px;
    background: var(--bg-card);
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: .7rem;
    color: var(--text-secondary);
}

.multiselect-wrap { position: relative; }
.multi-options {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-height: 180px;
    overflow-y: auto;
}
.multi-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    cursor: pointer;
    font-size: .875rem;
    transition: background var(--transition);
}
.multi-option:hover { background: var(--bg-hover); }
.multi-option input { accent-color: var(--cyan); }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .kanban-row { grid-template-columns: 1fr 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ── Scrollbar ────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Inline status select ────────────────────────────────────── */
.status-select {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3px 8px;
    font-size: .75rem;
    font-weight: 600;
    color: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}
.status-select:focus { outline: none; border-color: var(--cyan); }

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 99;
}
.sidebar-overlay.open { display: block; }
