/* Material Design 3 Theme */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --md-primary: #1a73e8;
    --md-primary-container: #d3e3fd;
    --md-on-primary: #fff;
    --md-on-primary-container: #041e49;
    --md-secondary: #5f6368;
    --md-surface: #fff;
    --md-surface-dim: #f1f3f4;
    --md-surface-container: #f8f9fa;
    --md-surface-container-high: #e8eaed;
    --md-surface-container-highest: #dadce0;
    --md-on-surface: #1f1f1f;
    --md-on-surface-variant: #5f6368;
    --md-outline: #dadce0;
    --md-outline-variant: #e8eaed;
    --md-error: #d93025;
    --md-error-container: #fce8e6;
    --md-success: #1e8e3e;
    --md-success-container: #e6f4ea;
    --md-warning: #f9ab00;
    --md-warning-container: #fef7e0;
    --md-info: #1a73e8;
    --md-elevation-1: 0 1px 2px 0 rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
    --md-elevation-2: 0 1px 2px 0 rgba(60,64,67,.3), 0 2px 6px 2px rgba(60,64,67,.15);
    --md-elevation-3: 0 4px 8px 3px rgba(60,64,67,.15), 0 1px 3px rgba(60,64,67,.3);
    --md-shape-s: 8px;
    --md-shape-m: 12px;
    --md-shape-l: 16px;
    --md-shape-xl: 28px;
    --sidebar-w: 260px;
    --header-h: 56px;
    --sidebar-bg: #1a1c1e;
    --app-bg: url('/static/back.avif') center/cover no-repeat fixed, var(--md-surface-dim);
}

body {
    font-family: 'Google Sans', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--md-surface-dim);
    color: var(--md-on-surface);
    height: 100vh;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.5;
}

/* ===== Login ===== */
.login-container {
    display: flex; align-items: center; justify-content: center;
    height: 100vh; background: var(--md-surface-dim);
}
.login-box {
    background: var(--md-surface); border-radius: var(--md-shape-l); padding: 48px 40px; width: 380px;
    box-shadow: var(--md-elevation-3);
}
.login-box h1 { text-align: center; margin-bottom: 4px; color: var(--md-on-surface); font-size: 24px; font-weight: 400; }
.login-box p { text-align: center; color: var(--md-on-surface-variant); margin-bottom: 32px; font-size: 14px; }
.login-box input {
    width: 100%; padding: 14px 16px; border: 1px solid var(--md-outline);
    border-radius: var(--md-shape-s); font-size: 14px; margin-bottom: 16px; outline: none;
    background: var(--md-surface); transition: border-color 0.2s;
}
.login-box input:focus { border-color: var(--md-primary); border-width: 2px; padding: 13px 15px; }
.login-box button {
    width: 100%; padding: 12px; background: var(--md-primary); color: var(--md-on-primary);
    border: none; border-radius: var(--md-shape-xl); font-size: 14px; font-weight: 500;
    cursor: pointer; letter-spacing: 0.25px; transition: box-shadow 0.2s, background 0.2s;
}
.login-box button:hover { box-shadow: var(--md-elevation-1); background: #1765cc; }
.login-error { color: var(--md-error); text-align: center; font-size: 13px; margin-bottom: 12px; display: none; }

/* ===== App Layout ===== */
.app { display: flex; height: 100vh; }

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-w); background: var(--sidebar-bg); color: #e3e3e3;
    display: flex; flex-direction: column; flex-shrink: 0;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}
.sidebar.collapsed { width: 64px; min-width: 64px; }
.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .sidebar-user,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-section,
.sidebar.collapsed .sidebar-footer { display: none; }
.sidebar.collapsed .nav-item {
    justify-content: center; padding: 12px 0; margin: 2px 8px; border-radius: var(--md-shape-xl);
    font-size: 20px;
}
.sidebar-header {
    padding: 16px 16px; font-size: 16px; font-weight: 500;
    display: flex; align-items: center; gap: 10px;
    min-height: 56px;
}
.sidebar-toggle {
    margin-left: auto; background: none; border: none; color: #e3e3e3;
    cursor: pointer; font-size: 20px; padding: 4px 8px; border-radius: var(--md-shape-xl);
    opacity: 0.7; transition: all 0.2s;
}
.sidebar-toggle:hover { opacity: 1; background: rgba(255,255,255,0.08); }
.sidebar-header svg { width: 24px; height: 24px; }
.sidebar-user {
    padding: 12px 16px; border-top: 1px solid rgba(255,255,255,0.08);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-size: 13px; margin: 0 0 8px;
}
.sidebar-user .name { font-weight: 500; font-size: 14px; color: #fff; }
.sidebar-user .role { opacity: 0.5; margin-top: 2px; font-size: 12px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 4px 0; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; cursor: pointer; font-size: 14px;
    border-radius: var(--md-shape-xl); margin: 2px 12px;
    transition: background 0.2s; color: #c4c7c5;
    font-weight: 400;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #e3e3e3; }
.nav-item.active { background: rgba(138,180,248,0.16); color: #8ab4f8; font-weight: 500; }
.nav-section {
    padding: 16px 16px 6px; font-size: 11px; text-transform: uppercase;
    letter-spacing: 1.5px; opacity: 0.4; font-weight: 500;
}
.sidebar-footer {
    padding: 12px 16px; border-top: 1px solid rgba(255,255,255,0.08);
}
.btn-logout {
    width: 100%; padding: 10px; background: rgba(255,255,255,0.06);
    color: #c4c7c5; border: 1px solid rgba(255,255,255,0.1); border-radius: var(--md-shape-xl);
    cursor: pointer; font-size: 13px; font-weight: 500; transition: all 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* ===== Main Content ===== */
.main {
    flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden;
    background: var(--app-bg);
}
/* The active view fills the remaining height as a flex column so inner
   panels/boards size correctly and scroll internally (no magic numbers). */
#viewContent {
    flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
}
.topbar {
    height: var(--header-h); background: var(--md-surface);
    display: flex; align-items: center; padding: 0 20px; gap: 16px;
    color: var(--md-on-surface); flex-shrink: 0;
    box-shadow: 0 1px 0 var(--md-outline-variant);
    z-index: 10;
}
.topbar h2 { font-size: 18px; font-weight: 400; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ===== Search ===== */
.search-bar { position: relative; }
.search-bar input {
    width: 240px; padding: 8px 12px 8px 36px; border: none;
    border-radius: var(--md-shape-xl); font-size: 14px;
    background: var(--md-surface-container); color: var(--md-on-surface);
    outline: none; transition: all 0.2s;
}
.search-bar input::placeholder { color: var(--md-on-surface-variant); }
.search-bar input:focus { background: var(--md-surface-container-high); width: 320px; box-shadow: var(--md-elevation-1); }
.search-bar .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 16px; color: var(--md-on-surface-variant); }
.search-results {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--md-surface);
    border-radius: var(--md-shape-m); box-shadow: var(--md-elevation-3);
    max-height: 360px; overflow-y: auto; z-index: 100; min-width: 320px;
}
.search-result-item {
    padding: 10px 16px; cursor: pointer; border-bottom: 1px solid var(--md-outline-variant);
    font-size: 13px; transition: background 0.15s;
}
.search-result-item:hover { background: var(--md-surface-container); }
.search-result-type {
    display: inline-block; padding: 2px 8px; border-radius: var(--md-shape-s);
    font-size: 10px; font-weight: 500; margin-right: 8px;
}
.search-type-task { background: var(--md-primary-container); color: var(--md-on-primary-container); }
.search-type-user { background: #e8def8; color: #4a4458; }
.search-type-document { background: var(--md-warning-container); color: #663c00; }

/* ===== Notifications ===== */
.notif-bell {
    position: relative; cursor: pointer; font-size: 22px;
    color: var(--md-on-surface-variant); padding: 6px 8px;
    border-radius: var(--md-shape-xl); transition: background 0.2s;
}
.notif-bell:hover { background: var(--md-surface-container); }
.notif-bell .badge {
    position: absolute; top: 2px; right: 4px; background: var(--md-error);
    color: #fff; font-size: 10px; font-weight: 600; border-radius: 50%;
    width: 18px; height: 18px; display: flex; align-items: center; justify-content: center;
}
.notif-dropdown {
    position: absolute; top: calc(100% + 4px); right: 0; width: 380px; background: var(--md-surface);
    border-radius: var(--md-shape-m); box-shadow: var(--md-elevation-3);
    max-height: 440px; overflow-y: auto; z-index: 200;
}
.notif-header {
    padding: 16px 20px; border-bottom: 1px solid var(--md-outline-variant); display: flex;
    align-items: center; justify-content: space-between; font-weight: 500; font-size: 14px;
}
.notif-item {
    padding: 12px 20px; border-bottom: 1px solid var(--md-outline-variant); cursor: pointer;
    font-size: 13px; transition: background 0.15s;
}
.notif-item:hover { background: var(--md-surface-container); }
.notif-item.unread { background: #e8f0fe; }
.notif-item .notif-title { font-weight: 500; margin-bottom: 2px; }
.notif-item .notif-msg { color: var(--md-on-surface-variant); }
.notif-item .notif-time { font-size: 11px; color: var(--md-on-surface-variant); margin-top: 4px; }

/* ===== Filter Bar ===== */
.filter-bar {
    display: flex; gap: 10px; padding: 10px 16px; background: var(--md-surface);
    align-items: center; flex-wrap: wrap; flex-shrink: 0;
    border-bottom: 1px solid var(--md-outline-variant);
}
.filter-bar select, .filter-bar input {
    padding: 6px 12px; border: 1px solid var(--md-outline); border-radius: var(--md-shape-s);
    font-size: 13px; background: var(--md-surface); outline: none;
    transition: border-color 0.2s;
}
.filter-bar select:focus, .filter-bar input:focus { border-color: var(--md-primary); }
.filter-bar label { font-size: 12px; color: var(--md-on-surface-variant); font-weight: 500; }

/* ===== Board Selector ===== */
.board-selector {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; background: var(--md-surface);
    gap: 8px; flex-wrap: wrap; flex-shrink: 0;
    border-bottom: 1px solid var(--md-outline-variant);
}
.board-tabs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.board-tab {
    padding: 6px 16px; border: none; border-radius: var(--md-shape-xl);
    background: var(--md-surface-container); cursor: pointer; font-size: 13px; font-weight: 500;
    color: var(--md-on-surface-variant); transition: all 0.2s;
}
.board-tab:hover { background: var(--md-surface-container-high); color: var(--md-on-surface); }
.board-tab.active {
    background: var(--md-primary-container); color: var(--md-on-primary-container);
    font-weight: 600;
}
.board-tab-add {
    background: transparent; border: 1px dashed var(--md-outline); color: var(--md-on-surface-variant);
}
.board-tab-add:hover { border-color: var(--md-primary); color: var(--md-primary); }
.board-actions { display: flex; gap: 6px; }

/* ===== Board (Columns) ===== */
.board {
    flex: 1; min-width: 0; min-height: 0; display: flex; gap: 16px; padding: 16px;
    overflow: auto; align-items: flex-start;
}
.board::-webkit-scrollbar { width: 10px; height: 12px; }
.board::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.25); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
.board::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.4); background-clip: padding-box; border: 2px solid transparent; }
.board::-webkit-scrollbar-track { background: transparent; }
.column {
    --col-color: var(--md-outline);
    background: color-mix(in srgb, var(--col-color) 22%, var(--md-surface-container));
    border-radius: var(--md-shape-m);
    min-width: 300px; max-width: 320px; width: 300px;
    display: flex; flex-direction: column;
    flex-shrink: 0;
    box-shadow: var(--md-elevation-1);
}
.column-header {
    padding: 12px 14px; font-size: 13px; font-weight: 600;
    display: flex; align-items: center; justify-content: space-between;
    letter-spacing: 0.3px;
    color: var(--md-on-surface);
}
.column-title { display: flex; align-items: center; min-width: 0; }
.column-title > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.column-title-dot { display: none; }
.column-header-right { display: flex; align-items: center; gap: 6px; }
.column-header .count {
    background: rgba(0,0,0,0.08);
    color: var(--md-on-surface);
    border-radius: var(--md-shape-xl);
    padding: 2px 10px; font-size: 12px; font-weight: 600;
}
.column-action-btn {
    background: none; border: none; cursor: pointer; font-size: 14px;
    color: var(--md-on-surface-variant); padding: 4px 6px; border-radius: var(--md-shape-xl); line-height: 1;
    opacity: 0; transition: all 0.2s;
}
.column:hover .column-action-btn { opacity: 1; }
.column-action-btn:hover { background: var(--md-surface-container-high); color: var(--md-primary); }
.column-action-delete:hover { color: var(--md-error); }
.column-cards {
    padding: 4px 8px 8px;
    display: flex; flex-direction: column; gap: 8px;
}

.column-footer { padding: 4px 8px 8px; }
.btn-add-card {
    width: 100%; padding: 8px 12px; background: none; border: none;
    border-radius: var(--md-shape-s); cursor: pointer; font-size: 13px;
    color: var(--md-on-surface-variant); text-align: left;
    transition: all 0.2s; font-weight: 500;
}
.btn-add-card:hover { background: var(--md-surface-container-high); color: var(--md-primary); }

.column-add {
    background: transparent; border: 2px dashed var(--md-outline);
    min-width: 220px; max-width: 220px; width: 220px;
    cursor: pointer; display: flex; align-items: flex-start;
    justify-content: center; transition: all 0.2s;
    border-radius: var(--md-shape-m);
}
.column-add:hover { border-color: var(--md-primary); background: rgba(26,115,232,0.04); }

/* ===== Cards ===== */
.card {
    background: var(--md-surface); border-radius: var(--md-shape-s);
    padding: 8px 10px; cursor: pointer;
    box-shadow: var(--md-elevation-1);
    transition: box-shadow 0.2s, transform 0.15s;
    border: 1px solid transparent;
}
.card:hover { box-shadow: var(--md-elevation-2); transform: translateY(-1px); border-color: var(--md-outline-variant); }
.card-title { font-size: 13px; font-weight: 500; margin-bottom: 4px; color: var(--md-on-surface); line-height: 1.35; }
.card-meta { display: flex; gap: 4px; flex-wrap: wrap; font-size: 10px; }
.card-badge {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 1px 6px; border-radius: var(--md-shape-s); font-weight: 500;
    font-size: 10px;
}

/* ===== Avatars ===== */
.avatar {
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 600; border-radius: 50%;
    flex-shrink: 0; box-sizing: border-box;
    border: 2px solid var(--md-surface);
    text-transform: uppercase; line-height: 1;
}
.avatar-xs { width: 20px; height: 20px; font-size: 9px; }
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-md { width: 32px; height: 32px; font-size: 12px; }

.card-foot {
    display: flex; align-items: center; justify-content: flex-end;
    margin-top: 6px;
}
.card-avatars { display: flex; flex-direction: row-reverse; }
.card-avatars .avatar { margin-right: -6px; }
.card-avatars .avatar:first-child { margin-right: 0; }
.badge-deadline { background: var(--md-warning-container); color: #663c00; }
.badge-overdue { background: var(--md-error-container); color: var(--md-error); }
.badge-priority-high { background: var(--md-error-container); color: var(--md-error); }
.badge-priority-medium { background: var(--md-warning-container); color: #663c00; }
.badge-priority-low { background: var(--md-success-container); color: #0d652d; }
.badge-user { background: var(--md-primary-container); color: var(--md-on-primary-container); }
.badge-tag { background: #e8def8; color: #4a4458; }

/* Checklist on card */
.card-checklist-bar {
    margin-top: 6px; height: 4px; background: var(--md-outline-variant); border-radius: 2px; overflow: hidden;
}
.card-checklist-fill { height: 100%; border-radius: 2px; transition: width 0.3s; }
.card-checklist-text { font-size: 10px; color: var(--md-on-surface-variant); margin-top: 2px; }

/* ===== Dashboard ===== */
.dashboard-combined {
    flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 24px;
}
.dashboard-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px; padding: 20px;
}
.dashboard-section {
    margin: 0 20px 20px; background: var(--md-surface); border-radius: var(--md-shape-m);
    padding: 20px; box-shadow: var(--md-elevation-1);
}
.dashboard-section h3 { color: var(--md-on-surface); font-size: 16px; font-weight: 500; }
.dashboard-section-header {
    display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.stat-card {
    background: var(--md-surface); border-radius: var(--md-shape-m); padding: 24px;
    box-shadow: var(--md-elevation-1); text-align: center;
    transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: var(--md-elevation-2); }
.stat-card .number { font-size: 36px; font-weight: 600; }
.stat-card .label { font-size: 12px; color: var(--md-on-surface-variant); margin-top: 6px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-completed .number { color: var(--md-success); }
.stat-progress .number { color: var(--md-primary); }
.stat-overdue .number { color: var(--md-error); }
.stat-late .number { color: #e37400; }
.stat-soon .number { color: var(--md-warning); }
.stat-total .number { color: var(--md-on-surface); }

/* Workload */
.workload-section { padding: 0 20px 20px; }
.workload-section h3 { font-size: 16px; margin-bottom: 12px; color: var(--md-on-surface); }

/* ===== Content Panels ===== */
.content-panel {
    flex: 1; min-height: 0; overflow-y: auto; padding: 20px;
}

/* ===== Tables ===== */
.data-table {
    width: 100%; background: var(--md-surface); border-radius: var(--md-shape-m);
    overflow: hidden; box-shadow: var(--md-elevation-1);
}
.data-table table { width: 100%; border-collapse: collapse; }
.data-table th {
    background: var(--md-surface-container); padding: 12px 16px; text-align: left;
    font-size: 12px; font-weight: 500; letter-spacing: 0.5px;
    color: var(--md-on-surface-variant); border-bottom: 1px solid var(--md-outline-variant);
}
.data-table td {
    padding: 12px 16px; font-size: 13px;
    border-bottom: 1px solid var(--md-outline-variant);
}
.data-table tr:hover td { background: var(--md-surface-container); }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border: none; border-radius: var(--md-shape-xl);
    font-size: 13px; cursor: pointer; font-weight: 500;
    transition: all 0.2s; letter-spacing: 0.25px;
}
.btn:hover { box-shadow: var(--md-elevation-1); }
.btn-primary { background: var(--md-primary); color: var(--md-on-primary); }
.btn-primary:hover { background: #1765cc; }
.btn-success { background: var(--md-success); color: #fff; }
.btn-success:hover { background: #137333; }
.btn-danger { background: var(--md-error); color: #fff; }
.btn-danger:hover { background: #c5221f; }
.btn-warning { background: var(--md-warning); color: #fff; }
.btn-secondary { background: var(--md-surface-container-high); color: var(--md-on-surface); }
.btn-secondary:hover { background: var(--md-surface-container-highest); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-white {
    background: var(--md-primary-container); color: var(--md-on-primary-container);
    border: none;
}
.btn-white:hover { background: #c2d9fc; }
.btn-white.active { background: var(--md-primary); color: var(--md-on-primary); }

/* ===== Modals ===== */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4); display: flex;
    align-items: center; justify-content: center; z-index: 1000;
    backdrop-filter: blur(2px);
}
.modal {
    background: var(--md-surface); border-radius: var(--md-shape-l); width: 620px; max-width: 95vw;
    max-height: 85vh; overflow-y: auto; box-shadow: var(--md-elevation-3);
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px; border-bottom: 1px solid var(--md-outline-variant);
}
.modal-header h3 { font-size: 18px; font-weight: 500; }
.modal-close {
    width: 36px; height: 36px; border: none; background: var(--md-surface-container);
    border-radius: 50%; cursor: pointer; font-size: 18px;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
.modal-close:hover { background: var(--md-surface-container-high); }
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px; border-top: 1px solid var(--md-outline-variant);
    display: flex; gap: 8px; justify-content: flex-end;
}

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; font-size: 12px; font-weight: 500;
    color: var(--md-on-surface-variant); margin-bottom: 6px;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 14px; border: 1px solid var(--md-outline);
    border-radius: var(--md-shape-s); font-size: 14px; outline: none;
    font-family: inherit; background: var(--md-surface);
    transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--md-primary); border-width: 2px; padding: 9px 13px;
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* ===== Checklist in modal ===== */
.checklist-section { margin-top: 12px; }
.checklist-title-row {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;
}
.checklist-title-row h4 { font-size: 14px; font-weight: 500; }
.checklist-progress {
    height: 6px; background: var(--md-outline-variant); border-radius: 3px;
    margin-bottom: 10px; overflow: hidden;
}
.checklist-progress-fill {
    height: 100%; background: var(--md-success); border-radius: 3px; transition: width 0.3s;
}
.checklist-progress-text { font-size: 11px; color: var(--md-on-surface-variant); margin-bottom: 4px; }
.checklist-item { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.checklist-item input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; accent-color: var(--md-primary); }
.checklist-item .item-text { font-size: 13px; flex: 1; }
.checklist-item .item-text.checked { text-decoration: line-through; color: var(--md-on-surface-variant); }
.checklist-item .item-delete { cursor: pointer; color: var(--md-on-surface-variant); font-size: 16px; padding: 2px; border-radius: 50%; }
.checklist-item .item-delete:hover { color: var(--md-error); background: var(--md-error-container); }
.checklist-add { display: flex; gap: 8px; margin-top: 8px; }
.checklist-add input {
    flex: 1; padding: 6px 12px; border: 1px solid var(--md-outline);
    border-radius: var(--md-shape-s); font-size: 13px;
}

/* ===== Status Badges ===== */
.status-badge {
    display: inline-block; padding: 4px 10px; border-radius: var(--md-shape-xl);
    font-size: 11px; font-weight: 500;
}
.status-new { background: var(--md-primary-container); color: var(--md-on-primary-container); }
.status-in_progress { background: var(--md-warning-container); color: #663c00; }
.status-returned { background: var(--md-error-container); color: var(--md-error); }
.status-completed { background: var(--md-success-container); color: #0d652d; }
.status-registered { background: var(--md-primary-container); color: var(--md-on-primary-container); }
.status-directed { background: var(--md-warning-container); color: #663c00; }
.status-archived { background: var(--md-surface-container-high); color: var(--md-on-surface-variant); }
.status-pending { background: var(--md-warning-container); color: #663c00; }
.status-approved { background: var(--md-success-container); color: #0d652d; }
.status-rejected { background: var(--md-error-container); color: var(--md-error); }

/* ===== Role Badges ===== */
.role-badge {
    display: inline-block; padding: 2px 8px; border-radius: var(--md-shape-xl);
    font-size: 10px; font-weight: 500; margin: 1px;
}
.role-admin { background: #e8def8; color: #4a4458; }
.role-rahbar { background: var(--md-primary-container); color: var(--md-on-primary-container); }
.role-nazoratchi { background: var(--md-warning-container); color: #663c00; }
.role-kanselariya { background: #c8e6c9; color: #1b5e20; }
.role-ijrochi { background: var(--md-surface-container-high); color: var(--md-on-surface-variant); }

/* ===== Comments ===== */
.comment-list { margin-top: 12px; }
.comment-item { padding: 10px 0; border-bottom: 1px solid var(--md-outline-variant); }
.comment-item:last-child { border: none; }
.comment-meta { font-size: 12px; color: var(--md-on-surface-variant); margin-bottom: 4px; }
.comment-meta strong { color: var(--md-on-surface); }
.comment-text { font-size: 14px; }
.comment-input { display: flex; gap: 8px; margin-top: 12px; }
.comment-input input { flex: 1; }

/* ===== Calendar ===== */
.calendar-container { padding: 20px; overflow-y: auto; flex: 1; min-height: 0; }
.calendar-nav {
    display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 20px;
}
.calendar-nav h3 { font-size: 18px; color: var(--md-on-surface); min-width: 200px; text-align: center; font-weight: 400; }
.calendar-grid {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px;
    background: var(--md-outline-variant); border-radius: var(--md-shape-m); overflow: hidden;
    box-shadow: var(--md-elevation-1);
}
.calendar-header-cell {
    background: var(--md-surface-container); padding: 10px; text-align: center;
    font-size: 12px; font-weight: 500; color: var(--md-on-surface-variant);
}
.calendar-cell {
    min-height: 100px; padding: 6px; background: var(--md-surface);
    vertical-align: top;
}
.calendar-cell.other-month { background: var(--md-surface-container); }
.calendar-cell.today { background: #e8f0fe; }
.calendar-day { font-size: 12px; font-weight: 500; margin-bottom: 4px; color: var(--md-on-surface-variant); }
.calendar-task {
    font-size: 11px; padding: 3px 6px; margin-bottom: 2px;
    border-radius: var(--md-shape-s); cursor: pointer; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.calendar-task.priority-high { background: var(--md-error-container); color: var(--md-error); }
.calendar-task.priority-medium { background: var(--md-warning-container); color: #663c00; }
.calendar-task.priority-low { background: var(--md-success-container); color: #0d652d; }
.calendar-task.status-completed { background: var(--md-success-container); color: #0d652d; opacity: 0.7; }

/* ===== Activity ===== */
.activity-list { margin-top: 8px; }
.activity-item {
    padding: 6px 0; font-size: 12px; color: var(--md-on-surface-variant);
    border-bottom: 1px solid var(--md-outline-variant);
}
.activity-item strong { color: var(--md-on-surface); }

/* ===== Report ===== */
.report-section { padding: 20px; }
.report-section h3 { color: var(--md-on-surface); margin-bottom: 12px; }
.report-period { display: flex; gap: 8px; margin-bottom: 16px; }
.report-period button { padding: 6px 16px; }
.report-period button.active { background: var(--md-primary); color: var(--md-on-primary); font-weight: 500; }

/* ===== Assignees ===== */
.assignee-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.assignee-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--md-primary-container); color: var(--md-on-primary-container); padding: 4px 12px;
    border-radius: var(--md-shape-xl); font-size: 12px; font-weight: 500;
}
.assignee-chip .remove { cursor: pointer; font-weight: 600; }
.assignee-chip .remove:hover { color: var(--md-error); }

/* ===== Tags ===== */
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-item {
    display: inline-block; padding: 3px 10px; border-radius: var(--md-shape-xl);
    font-size: 11px; font-weight: 500; background: #e8def8; color: #4a4458;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--md-outline); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--md-on-surface-variant); }

/* ===== Toast ===== */
.toast-container {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 2000;
    display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
    padding: 12px 24px; border-radius: var(--md-shape-s); color: #fff;
    font-size: 14px; font-weight: 500; min-width: 280px; text-align: center;
    box-shadow: var(--md-elevation-3);
    animation: toastIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.toast-success { background: #323232; color: #a8dab5; }
.toast-error { background: #323232; color: #f28b82; }
.toast-info { background: #323232; color: #8ab4f8; }

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

/* ===== Language Selector ===== */
.lang-select {
    height: 32px; padding: 0 8px;
    border: 1px solid var(--md-outline); border-radius: var(--md-shape-xl);
    background: var(--md-surface); color: var(--md-on-surface);
    font-size: 12px; font-weight: 600; letter-spacing: 0.4px;
    cursor: pointer; outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.lang-select:hover { border-color: var(--md-on-surface-variant); }
.lang-select:focus { border-color: var(--md-primary); box-shadow: 0 0 0 2px var(--md-primary-container); }
.login-lang { display: flex; justify-content: flex-end; margin-bottom: 8px; }

/* ===== Topbar Icon Button ===== */
.topbar-icon-btn {
    cursor: pointer; font-size: 20px; line-height: 1;
    color: var(--md-on-surface-variant); padding: 6px 8px;
    border-radius: var(--md-shape-xl); transition: background 0.2s;
    background: none; border: none;
}
.topbar-icon-btn:hover { background: var(--md-surface-container); }

/* ===== Background Picker ===== */
.bg-preset-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
}
.bg-preset {
    height: 80px; border-radius: var(--md-shape-m); cursor: pointer;
    display: flex; align-items: flex-end; padding: 10px;
    position: relative; overflow: hidden;
    border: 2px solid transparent;
    transition: transform 0.15s, border-color 0.2s;
    background-size: cover; background-position: center;
}
.bg-preset:hover { border-color: var(--md-primary); transform: scale(1.02); }
.bg-preset.active { border-color: var(--md-primary); }
.bg-preset .label {
    background: rgba(0,0,0,0.55); color: #fff; padding: 3px 10px;
    border-radius: var(--md-shape-s); font-size: 12px; font-weight: 500;
}
.bg-fit-options { display: flex; gap: 6px; flex-wrap: wrap; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar { position: fixed; z-index: 100; transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .search-bar input { width: 160px; }
    .search-bar input:focus { width: 220px; }
}

/* ===== Drag & Drop ===== */
.card.dragging { opacity: 0.4; transform: rotate(1deg); }
.column.drag-over { background: var(--md-surface-container-high); outline: 2px dashed var(--md-primary); outline-offset: -2px; border-radius: var(--md-shape-m); }

/* ===== Empty State ===== */
.empty-state {
    text-align: center; padding: 40px 20px; color: var(--md-on-surface-variant);
}
.empty-state svg { width: 48px; height: 48px; opacity: 0.3; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ===== Toggle ===== */
.toggle-active {
    cursor: pointer; padding: 3px 10px; border-radius: var(--md-shape-xl);
    font-size: 11px; font-weight: 500;
}
.toggle-active.on { background: var(--md-success-container); color: #0d652d; }
.toggle-active.off { background: var(--md-error-container); color: var(--md-error); }

/* ===== Tabs ===== */
.tab-bar { display: flex; gap: 0; }
.tab-bar button {
    padding: 8px 16px; border: none; background: var(--md-surface-container);
    color: var(--md-on-surface-variant); cursor: pointer; font-size: 13px; font-weight: 500;
    transition: all 0.2s;
}
.tab-bar button:first-child { border-radius: var(--md-shape-s) 0 0 var(--md-shape-s); }
.tab-bar button:last-child { border-radius: 0 var(--md-shape-s) var(--md-shape-s) 0; }
.tab-bar button:hover { background: var(--md-surface-container-high); }
.tab-bar button.active { background: var(--md-primary); color: var(--md-on-primary); }

/* ===== Rule Cards ===== */
.rule-card {
    background: var(--md-surface); border-radius: var(--md-shape-m); padding: 16px 20px;
    margin-bottom: 12px; box-shadow: var(--md-elevation-1);
    display: flex; justify-content: space-between; align-items: center;
    transition: box-shadow 0.2s;
}
.rule-card:hover { box-shadow: var(--md-elevation-2); }
.rule-card .rule-info { flex: 1; }
.rule-card .rule-name { font-weight: 500; font-size: 14px; margin-bottom: 4px; }
.rule-card .rule-detail { font-size: 12px; color: var(--md-on-surface-variant); }
.rule-card .rule-actions { display: flex; gap: 8px; align-items: center; }

/* ===== Multi-select ===== */
.multi-select { position: relative; }
.multi-select-dropdown {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--md-surface); border: 2px solid var(--md-primary); border-top: none;
    border-radius: 0 0 var(--md-shape-s) var(--md-shape-s); max-height: 160px; overflow-y: auto; z-index: 50;
    box-shadow: var(--md-elevation-2);
}
.multi-select-option {
    padding: 8px 14px; cursor: pointer; font-size: 13px;
    display: flex; align-items: center; gap: 10px;
    transition: background 0.15s;
}
.multi-select-option:hover { background: var(--md-surface-container); }
.multi-select-option input { width: 16px; height: 16px; accent-color: var(--md-primary); }

/* ===== Analytics ===== */
.risk-critical { color: var(--md-error); font-weight: 600; }
.risk-high { color: #e37400; font-weight: 600; }
.risk-normal { color: var(--md-success); }

.workload-bar {
    display: inline-block; height: 12px; border-radius: 6px;
    background: var(--md-outline-variant); overflow: hidden; width: 100px;
}
.workload-bar-fill { height: 100%; border-radius: 6px; }

.export-btn {
    display: inline-flex; align-items: center; gap: 4px;
    text-decoration: none;
}
