/* ============================================================
   Verkefnastjóri — Main Stylesheet
   ============================================================ */

:root {
    --primary:       #4F46E5;
    --primary-dark:  #3730A3;
    --primary-light: #EEF2FF;
    --secondary:     #6B7280;
    --success:       #10B981;
    --warning:       #F59E0B;
    --danger:        #EF4444;
    --info:          #3B82F6;

    --bg:            #F9FAFB;
    --surface:       #FFFFFF;
    --border:        #E5E7EB;
    --border-focus:  #4F46E5;

    --text-primary:  #111827;
    --text-secondary:#6B7280;
    --text-muted:    #9CA3AF;

    --sidebar-bg:    #1E1B4B;
    --sidebar-text:  #C7D2FE;
    --sidebar-hover: rgba(255,255,255,0.08);
    --sidebar-active:#4F46E5;
    --sidebar-width: 260px;

    --radius:        8px;
    --radius-lg:     12px;
    --shadow:        0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md:     0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg:     0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);

    --font:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --transition:    0.2s ease;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
ul { list-style: none; }

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

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
    transition: width var(--transition);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    white-space: nowrap;
}
.sidebar-toggle {
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    border-radius: 4px;
    transition: background var(--transition);
    display: none;
}
.sidebar-toggle:hover { background: var(--sidebar-hover); }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.user-avatar {
    width: 36px; height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.9rem; color: #fff;
    flex-shrink: 0;
}
.user-info { min-width: 0; }
.user-name { font-size: 0.875rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.75rem; color: var(--sidebar-text); }

.nav-menu { padding: 12px 0; flex: 1; }
.nav-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(199,210,254,0.4);
    padding: 16px 16px 6px;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    color: var(--sidebar-text);
    border-radius: 6px;
    margin: 1px 8px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    text-decoration: none;
}
.nav-link:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.nav-item.active .nav-link { background: var(--sidebar-active); color: #fff; }
.nav-icon { width: 18px; height: 18px; min-width: 18px; min-height: 18px; max-width: 18px; max-height: 18px; flex-shrink: 0; display: block; }
.nav-link svg, .sidebar svg { max-width: 28px; max-height: 28px; }
.nav-logout { color: #FCA5A5; }
.nav-logout:hover { background: rgba(239,68,68,0.15); color: #FCA5A5; }

/* ---- Main Content ---- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition);
}
.content-wrapper {
    padding: 32px;
    max-width: 1400px;
}

/* ---- Page Header ---- */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
    flex-wrap: wrap;
}
.page-title { font-size: 1.6rem; font-weight: 700; color: var(--text-primary); }
.page-subtitle { font-size: 0.875rem; color: var(--text-secondary); margin-top: 2px; }
.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---- Breadcrumb ---- */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep { color: var(--text-muted); }

/* ---- Cards ---- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card-title { font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.card-body { padding: 24px; }
.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ---- Stats Grid ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
}
.stat-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.stat-icon.blue   { background: #EFF6FF; color: var(--info); }
.stat-icon.green  { background: #ECFDF5; color: var(--success); }
.stat-icon.yellow { background: #FFFBEB; color: var(--warning); }
.stat-icon.purple { background: var(--primary-light); color: var(--primary); }
.stat-icon.red    { background: #FEF2F2; color: var(--danger); }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; }

/* ---- Tables ---- */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead th {
    background: var(--bg);
    padding: 11px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #FAFAFA; }
.table-actions { display: flex; gap: 6px; align-items: center; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-icon { padding: 7px; }

.btn-primary   { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-secondary { background: var(--surface); color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-success   { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #059669; }
.btn-danger    { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #DC2626; }
.btn-warning   { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-warning:hover { background: #D97706; }
.btn-ghost     { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--bg); color: var(--text-primary); }

/* ---- Forms ---- */
.form-group { margin-bottom: 20px; }
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-control {
    width: 100%;
    padding: 9px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-family: var(--font);
    color: var(--text-primary);
    background: var(--surface);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-hint { font-size: 0.78rem; color: var(--text-secondary); margin-top: 4px; }
.form-error { font-size: 0.78rem; color: var(--danger); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* Checkbox / Toggle */
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check-input {
    width: 18px; height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}
.form-check-label { font-size: 0.875rem; cursor: pointer; }

/* Permission matrix */
.permission-matrix { width: 100%; border-collapse: collapse; }
.permission-matrix th, .permission-matrix td {
    padding: 10px 14px;
    border: 1px solid var(--border);
    text-align: center;
    font-size: 0.875rem;
}
.permission-matrix th { background: var(--bg); font-weight: 600; }
.permission-matrix td:first-child { text-align: left; font-weight: 500; }
.permission-matrix input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-open    { background: #EFF6FF; color: #1D4ED8; }
.badge-active  { background: #ECFDF5; color: #065F46; }
.badge-done    { background: #F0FDF4; color: #166534; }
.badge-hold    { background: #FFFBEB; color: #92400E; }

.priority {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 600;
}
.priority::before { content: '●'; font-size: 0.6rem; }
.priority-low    { color: var(--success); }
.priority-medium { color: var(--warning); }
.priority-high   { color: #F97316; }
.priority-urgent { color: var(--danger); }

/* ---- Flash Messages ---- */
.flash {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    animation: fadeIn 0.3s ease;
}
.flash-icon { font-size: 1rem; }
.flash-success { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.flash-error   { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.flash-warning { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }
.flash-info    { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }

/* ---- Login Page ---- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1E1B4B 0%, #312E81 50%, #4338CA 100%);
    padding: 20px;
}
.login-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 28px;
}
.login-logo-icon {
    width: 48px; height: 48px;
    background: var(--primary);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
}
.login-logo-text { font-size: 1.4rem; font-weight: 700; color: var(--text-primary); }
.login-title { font-size: 1.5rem; font-weight: 700; text-align: center; margin-bottom: 6px; }
.login-subtitle { text-align: center; color: var(--text-secondary); font-size: 0.875rem; margin-bottom: 28px; }

/* ---- Dashboard ---- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 24px;
}
.recent-list { list-style: none; }
.recent-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}
.recent-item:last-child { border-bottom: none; }
.recent-item-title { font-size: 0.875rem; font-weight: 500; color: var(--text-primary); }
.recent-item-meta  { font-size: 0.75rem; color: var(--text-secondary); }

/* ---- WYSIWYG Editor ---- */
.editor-container { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.editor-container .ql-toolbar { border: none; border-bottom: 1px solid var(--border); background: var(--bg); }
.editor-container .ql-container { border: none; font-family: var(--font); font-size: 0.875rem; min-height: 200px; }
.editor-content { padding: 12px; }

/* ---- Task Tree ---- */
.task-tree { }
.task-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    overflow: hidden;
    transition: box-shadow var(--transition);
}
.task-item:hover { box-shadow: var(--shadow-md); }
.task-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
}
.task-expand-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 2px;
    font-size: 0.75rem;
    transition: transform var(--transition);
    flex-shrink: 0;
}
.task-expand-btn.open { transform: rotate(90deg); }
.task-title { font-weight: 500; flex: 1; font-size: 0.9rem; }
.task-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.task-assignee {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.assignee-avatar {
    width: 22px; height: 22px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
}
.subtasks {
    padding: 0 16px 12px 44px;
    display: none;
}
.subtasks.open { display: block; }
.subtask-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 0.85rem;
}
.subtask-item:last-child { margin-bottom: 0; }

/* ---- Progress Bar ---- */
.progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* ---- Dept/Project Cards ---- */
.dept-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}
.dept-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: box-shadow var(--transition), transform var(--transition);
    position: relative;
}
.dept-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.dept-card-name { font-size: 1.05rem; font-weight: 700; margin-bottom: 6px; }
.dept-card-meta { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 14px; }
.dept-card-footer { display: flex; align-items: center; justify-content: space-between; }
.dept-card-actions { display: flex; gap: 6px; }

/* ---- Modals ---- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.25s ease;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1.1rem; font-weight: 600; }
.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.3rem;
    line-height: 1;
    padding: 4px;
    border-radius: 4px;
    transition: background var(--transition);
}
.modal-close:hover { background: var(--bg); color: var(--text-primary); }
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ---- Completion comment style ---- */
.comment-lokun {
    background: #F0FDF4;
    border-left: 3px solid var(--success);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding-left: 4px;
}
.comment-lokun .comment-avatar {
    background: var(--success);
    font-size: 0.9rem;
}

/* ---- Empty States ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.4; }
.empty-state-title { font-size: 1.1rem; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.empty-state-text { font-size: 0.875rem; margin-bottom: 20px; }

/* ---- Tag/Group chips ---- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}
.chip-list { display: flex; flex-wrap: wrap; gap: 5px; }

/* ---- Detail View ---- */
.detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    align-items: start;
}
.detail-meta-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.detail-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    gap: 12px;
}
.detail-meta-row:last-child { border-bottom: none; }
.detail-meta-label { color: var(--text-secondary); font-weight: 500; flex-shrink: 0; }
.detail-meta-value { color: var(--text-primary); text-align: right; }

/* ---- Comments ---- */
.comment-list { }
.comment-item {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}
.comment-avatar {
    width: 34px; height: 34px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}
.comment-body {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
}
.comment-meta { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 4px; }
.comment-meta strong { color: var(--text-primary); }
.comment-text { font-size: 0.875rem; }

/* ---- Animations ---- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Mobile Top Bar ---- */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 56px;
    background: var(--sidebar-bg);
    z-index: 200;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.mobile-topbar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
}
.mobile-topbar-toggle {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mobile-topbar-toggle:hover { background: var(--sidebar-hover); }
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 150;
}
.sidebar-overlay.open { display: block; }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .form-row-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
    :root { --sidebar-width: 0px; }
    /* Sidebar slides in from left as an overlay */
    .sidebar {
        width: 260px;
        transform: translateX(-260px);
        z-index: 300;
        transition: transform var(--transition);
    }
    .sidebar.open { transform: translateX(0); }
    /* Ensure nav icons stay small inside the sidebar at all times */
    .nav-icon { width: 18px !important; height: 18px !important; min-width: 18px !important; min-height: 18px !important; max-width: 18px !important; max-height: 18px !important; }
    .nav-link svg { width: 18px !important; height: 18px !important; }
    /* Show mobile top bar */
    .mobile-topbar { display: flex; }
    /* Push content down below the top bar */
    .main-content { margin-left: 0; padding-top: 56px; }
    .content-wrapper { padding: 20px 16px; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .dept-grid { grid-template-columns: 1fr; }
    .login-card { padding: 28px 20px; }
    /* Hide the in-sidebar toggle on mobile (we use the top bar instead) */
    .sidebar-toggle { display: none; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
}

/* ---- Quill overrides ---- */
.ql-editor { min-height: 180px; font-family: var(--font); font-size: 0.875rem; }
.ql-toolbar.ql-snow { border-radius: var(--radius) var(--radius) 0 0; }
.ql-container.ql-snow { border-radius: 0 0 var(--radius) var(--radius); }

/* ---- Misc ---- */
.text-muted { color: var(--text-secondary); }
.text-small { font-size: 0.8rem; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.w-full { width: 100%; }
.hidden { display: none; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.ql-editor p { margin-bottom: 8px; }
.wysiwyg-output { font-size: 0.875rem; line-height: 1.7; }
.wysiwyg-output ul, .wysiwyg-output ol { padding-left: 20px; margin-bottom: 8px; }
.wysiwyg-output strong { font-weight: 600; }
.wysiwyg-output em { font-style: italic; }
.wysiwyg-output h1, .wysiwyg-output h2, .wysiwyg-output h3 { margin-bottom: 8px; }

/* ============================================================
   CONTEXT BANNER (task vs subtask indicator)
   ============================================================ */
.context-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius);
    font-size: 0.82rem;
    margin-bottom: 12px;
    font-weight: 500;
}
.context-task {
    background: #EEF2FF;
    color: #3730A3;
    border-left: 4px solid #6366F1;
}
.context-subtask {
    background: #F0FDF4;
    color: #14532D;
    border-left: 4px solid #22C55E;
}
.context-banner a { color: inherit; }
.context-banner a:hover { opacity: 0.8; }

/* ============================================================
   BREADCRUMB NAV
   ============================================================ */
.breadcrumb-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 14px;
    padding: 8px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.breadcrumb-nav a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition);
}
.breadcrumb-nav a:hover { color: var(--primary-dark); text-decoration: underline; }
.bc-sep { color: var(--text-muted, #9CA3AF); font-size: 0.9rem; }
.bc-current { color: var(--text-primary); font-weight: 600; }

/* ============================================================
   DUE DATE BADGES
   ============================================================ */
.due-date {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 2px 7px;
    border-radius: 999px;
    background: #F3F4F6;
    color: var(--text-secondary);
    white-space: nowrap;
}
.due-overdue {
    background: #FEE2E2;
    color: #B91C1C;
}
.due-soon {
    background: #FEF3C7;
    color: #92400E;
}

/* ============================================================
   INLINE STATUS SELECT
   ============================================================ */
.inline-status-select {
    font-size: 0.75rem;
    padding: 3px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg);
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition);
    max-width: 120px;
}
.inline-status-select:hover { border-color: var(--primary); }
.inline-status-select:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(99,102,241,0.15); }

/* ============================================================
   NAV BADGE (sidebar task counter)
   ============================================================ */
.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #EF4444;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
}

/* ============================================================
   SUBTASK ROWS
   ============================================================ */
.subtask-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    gap: 10px;
    transition: background var(--transition);
}
.subtask-row:hover { background: #F9FAFB; }
.subtask-overdue { border-color: #FCA5A5; background: #FFF5F5; }
.subtask-overdue:hover { background: #FEF2F2; }
.subtask-check-btn:hover {
    border-color: var(--success) !important;
    background: #D1FAE5 !important;
}

/* ============================================================
   FILE ATTACHMENTS
   ============================================================ */
.attachment-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.attachment-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    transition: background var(--transition);
}
.attachment-item:hover { background: #F9FAFB; }
.attachment-icon { font-size: 1.3rem; flex-shrink: 0; }
.attachment-info { flex: 1; min-width: 0; }
.attachment-name {
    display: block;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--primary);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.attachment-name:hover { text-decoration: underline; }
.attachment-meta { font-size: 0.72rem; color: var(--text-secondary); }

/* Upload zone */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    transition: border-color var(--transition), background var(--transition);
    cursor: pointer;
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--primary);
    background: #EEF2FF;
}
.upload-zone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    pointer-events: none;
}
.upload-file-list { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.upload-file-item {
    font-size: 0.78rem;
    color: var(--text-secondary);
    background: #F3F4F6;
    border-radius: 4px;
    padding: 4px 8px;
    text-align: left;
}

/* ============================================================
   FORM HINT
   ============================================================ */
.form-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ============================================================
   EDITOR CONTAINER (Quill wrapper)
   ============================================================ */
.editor-container {
    border-radius: var(--radius);
    overflow: hidden;
}

/* ============================================================
   COMMENT LOKUN (completion entries)
   ============================================================ */
.comment-lokun {
    border-left: 3px solid var(--success);
    background: #F0FDF4;
}
.comment-lokun .comment-body {
    background: #F0FDF4;
    border-color: #BBF7D0;
}

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar { background: var(--bg); }
.form-control-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
    height: 32px;
}

/* ============================================================
   STAT CARD ICONS (colored)
   ============================================================ */
.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.stat-icon.blue   { background: #EEF2FF; color: #4F46E5; }
.stat-icon.green  { background: #D1FAE5; color: #059669; }
.stat-icon.purple { background: #F5F3FF; color: #7C3AED; }
.stat-icon.red    { background: #FEE2E2; color: #DC2626; }
.stat-icon.orange { background: #FEF3C7; color: #D97706; }

/* ============================================================
   BTN SUCCESS
   ============================================================ */
.btn-success {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}
.btn-success:hover { background: #059669; border-color: #059669; }

/* ============================================================
   SIDEBAR FOOTER — Nokkur Skref branding
   ============================================================ */
.sidebar-footer {
    margin-top: auto;
    padding: 16px 18px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}
.sidebar-footer-logo {
    display: block;
    width: 110px;
    margin: 0 auto 10px;
    /* Invert the black logo to white so it shows on the dark sidebar */
    filter: invert(1) brightness(2);
    opacity: 0.75;
    transition: opacity 0.2s;
}
.sidebar-footer-logo:hover { opacity: 1; }
.sidebar-footer-text {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.5;
    margin: 0 0 4px;
}
.sidebar-footer-text strong {
    color: rgba(255, 255, 255, 0.75);
    font-weight: 600;
}
.sidebar-footer-copy {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.3);
    margin: 0;
    letter-spacing: 0.02em;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ACTIVITY FEED — Nýjustu breytingar
   ═══════════════════════════════════════════════════════════════════════════ */

.feed-container { display: flex; flex-direction: column; gap: 0; max-width: 820px; }

/* Date separator */
.feed-date-sep {
    display: flex; align-items: center; gap: 12px;
    margin: 20px 0 8px;
    color: var(--text-muted);
    font-size: 0.72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.07em;
}
.feed-date-sep::before, .feed-date-sep::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}
.feed-date-sep:first-child { margin-top: 0; }

/* Feed item card */
.feed-item {
    display: flex; gap: 14px;
    padding: 13px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 8px;
    transition: box-shadow 0.15s, border-color 0.15s;
}
.feed-item:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(79,70,229,0.08); }

/* Icon */
.feed-icon-wrap {
    flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.05rem;
    background: var(--bg); border: 1px solid var(--border);
}
.feed-comment  .feed-icon-wrap { background: #eff6ff; border-color: #bfdbfe; }
.feed-lokun    .feed-icon-wrap { background: #f0fdf4; border-color: #bbf7d0; }
.feed-new      .feed-icon-wrap { background: #faf5ff; border-color: #e9d5ff; }
.feed-project  .feed-icon-wrap { background: #fff7ed; border-color: #fed7aa; }
.feed-change   .feed-icon-wrap { background: #fefce8; border-color: #fde68a; }

/* Body */
.feed-body { flex: 1; min-width: 0; }
.feed-header-line {
    display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 4px;
}
.feed-actor { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.feed-time  { font-size: 0.72rem; color: var(--text-muted); margin-left: auto; white-space: nowrap; }

/* Type badge */
.feed-badge {
    display: inline-flex; align-items: center;
    padding: 1px 7px; border-radius: 20px;
    font-size: 0.68rem; font-weight: 700; letter-spacing: 0.03em;
}
.feed-badge-comment { background: #dbeafe; color: #1d4ed8; }
.feed-badge-lokun   { background: #dcfce7; color: #15803d; }
.feed-badge-new     { background: #f3e8ff; color: #7e22ce; }
.feed-badge-project { background: #ffedd5; color: #c2410c; }
.feed-badge-change  { background: #fef9c3; color: #854d0e; }
.feed-badge-other   { background: var(--bg); color: var(--text-muted); }

/* Text */
.feed-text { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.5; margin-bottom: 4px; word-break: break-word; }
.feed-completion-text { color: #15803d; font-style: italic; }
.feed-change-text { color: var(--text-muted); }

/* Context line */
.feed-context { font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; }
.feed-link { color: var(--primary); text-decoration: none; font-weight: 500; }
.feed-link:hover { text-decoration: underline; }
.feed-link-muted { color: var(--text-secondary); font-weight: 400; }

/* Dashboard mini-feed widget */
.dashboard-feed-widget {
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
}
.dashboard-feed-widget .widget-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--bg);
}
.dashboard-feed-widget .widget-title { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.dashboard-feed-widget .widget-link  { font-size: 0.8rem; color: var(--primary); text-decoration: none; }
.dashboard-feed-widget .widget-link:hover { text-decoration: underline; }

.feed-mini-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 18px; border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}
.feed-mini-item:last-child { border-bottom: none; }
.feed-mini-item:hover { background: var(--bg); }
.feed-mini-icon  { flex-shrink: 0; font-size: 1rem; margin-top: 1px; }
.feed-mini-body  { flex: 1; min-width: 0; }
.feed-mini-actor { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); }
.feed-mini-desc  { font-size: 0.78rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-mini-time  { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; margin-top: 2px; }

/* Filter bar for feed */
.feed-filter-bar {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    margin-bottom: 20px; padding: 14px 18px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
.feed-filter-bar select, .feed-filter-bar input {
    padding: 7px 11px; border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 0.8rem; font-family: var(--font); background: var(--bg); color: var(--text-primary);
    outline: none;
}
.feed-filter-bar select:focus, .feed-filter-bar input:focus { border-color: var(--primary); }
.feed-filter-label { font-size: 0.8rem; font-weight: 500; color: var(--text-secondary); white-space: nowrap; }

/* ── @-tagging in athugasemdir ─────────────────────────────────────────── */
.mention-dropdown {
    position: absolute;
    z-index: 1000;
    left: 0;
    right: auto;
    bottom: calc(100% + 6px);
    width: min(360px, 100%);
    max-height: 260px;
    overflow-y: auto;
    margin: 0;
    padding: 6px;
    list-style: none;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .18);
}
.mention-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: 7px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: .875rem;
}
.mention-item:hover,
.mention-item.active { background: #eef2ff; }
.mention-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
}
.mention-name { font-weight: 600; }
.mention-handle { margin-left: auto; color: var(--text-muted); font-size: .78rem; }
.mention-tag {
    display: inline-block;
    padding: 0 4px;
    border-radius: 4px;
    background: #e0e7ff;
    color: #3730a3;
    font-weight: 700;
    white-space: nowrap;
}
.feed-badge-mention { background: #ede9fe; color: #6d28d9; }
.feed-item.feed-mention {
    border-left: 3px solid #8b5cf6;
    background: linear-gradient(90deg, #faf5ff 0%, #fff 55%);
}
.feed-mention .feed-icon-wrap { background: #ede9fe; color: #6d28d9; font-weight: 800; }
.feed-mention-text { color: #4c1d95; }
@media (max-width: 640px) {
    .mention-dropdown { width: 100%; bottom: calc(100% + 4px); }
    .mention-handle { display: none; }
}
