/* =========================================================================
   TaskFlow — SOCIAL MEDIA SERVICES
   Design system + layout + components
   ========================================================================= */
:root {
    --primary: #7B68EE;
    --primary-dark: #5A4FCF;
    --primary-light: #EEEBFF;

    --sidebar-bg: #2C2C54;
    --sidebar-bg-2: #25244a;
    --sidebar-text: #A8A8C3;
    --sidebar-active: #7B68EE;

    --todo: #6B7280;
    --in-progress: #3B82F6;
    --review: #F59E0B;
    --done: #10B981;
    --cancelled: #EF4444;

    --low: #6B7280;
    --normal: #3B82F6;
    --high: #F59E0B;
    --urgent: #EF4444;

    --bg-main: #F8F9FA;
    --bg-card: #FFFFFF;
    --border: #E5E7EB;
    --text: #1F2937;
    --text-soft: #6B7280;

    --radius: 10px;
    --radius-sm: 7px;
    --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.04);
    --shadow-lg: 0 10px 30px rgba(16,24,40,.12);
    --sidebar-w: 244px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-main);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; font-weight: 700; color: var(--text); }
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }

/* ---------- App shell ---------- */
.app { min-height: 100vh; }
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
    background: var(--sidebar-bg); color: var(--sidebar-text);
    display: flex; flex-direction: column; z-index: 40;
    transition: transform .2s ease;
}
.sidebar__brand {
    display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px;
    color: #fff; font-weight: 800; font-size: 17px; letter-spacing: .2px;
}
.sidebar__brand .logo {
    width: 30px; height: 30px; border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), #9C8BFF);
    display: grid; place-items: center; color: #fff; font-weight: 800;
}
.sidebar__brand small { display: block; font-size: 10px; color: var(--sidebar-text); font-weight: 600; letter-spacing: .5px; }
.sidebar__nav { padding: 8px; overflow-y: auto; flex: 1; }
.sidebar__section { font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: #6f6f9c; padding: 14px 12px 6px; }
.navlink {
    display: flex; align-items: center; gap: 11px; padding: 9px 12px; margin: 2px 0;
    border-radius: var(--radius-sm); color: var(--sidebar-text); font-weight: 500; cursor: pointer;
}
.navlink:hover { background: var(--sidebar-bg-2); color: #fff; text-decoration: none; }
.navlink.active { background: var(--sidebar-active); color: #fff; }
.navlink svg { width: 18px; height: 18px; flex: none; }
.navlink .count { margin-left: auto; background: rgba(255,255,255,.15); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 10px; }
.sidebar__user { border-top: 1px solid rgba(255,255,255,.08); padding: 12px; display: flex; align-items: center; gap: 10px; }
.sidebar__user .meta { overflow: hidden; }
.sidebar__user .name { color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }

/* role badge */
.role-badge { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700; padding: 2px 7px; border-radius: 6px; }
.role-boss { background: #FDE68A; color: #92400E; }
.role-manager { background: #BFDBFE; color: #1E40AF; }
.role-employee { background: #D1FAE5; color: #065F46; }

/* ---------- Top bar ---------- */
.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 30; background: #fff; border-bottom: 1px solid var(--border);
    height: 60px; display: flex; align-items: center; gap: 14px; padding: 0 20px;
}
.topbar .menu-toggle { display: none; background: none; border: none; cursor: pointer; }
.search {
    flex: 1; max-width: 460px; position: relative;
}
.search input {
    width: 100%; padding: 9px 12px 9px 36px; border: 1px solid var(--border);
    border-radius: 8px; background: var(--bg-main); font-size: 13.5px;
}
.search input:focus { outline: none; border-color: var(--primary); background: #fff; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-soft); width: 16px; height: 16px; }
.search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 10px; color: var(--text-soft); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; background:#fff; }
.topbar__spacer { flex: 1; }
.topbar__actions { display: flex; align-items: center; gap: 8px; }

.iconbtn { position: relative; width: 38px; height: 38px; border: none; background: transparent; border-radius: 8px; cursor: pointer; display: grid; place-items: center; color: var(--text-soft); }
.iconbtn:hover { background: var(--bg-main); color: var(--text); }
.iconbtn .dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; background: var(--cancelled); color: #fff; font-size: 10px; font-weight: 700; border-radius: 9px; display: none; place-items: center; padding: 0 3px; }
.iconbtn .dot.show { display: grid; }

/* dropdowns */
.dropdown { position: relative; }
.dropdown__panel {
    position: absolute; right: 0; top: calc(100% + 8px); width: 340px; max-width: 90vw;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); display: none; overflow: hidden; z-index: 50;
}
.dropdown__panel.open { display: block; }
.dropdown__panel.sm { width: 210px; }
.dropdown__head { padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
.dropdown__item { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #f1f1f4; cursor: pointer; color: var(--text); }
.dropdown__item:hover { background: var(--bg-main); text-decoration: none; }
.dropdown__item.unread { background: #f6f4ff; }
.dropdown__item .t { font-size: 13px; }
.dropdown__item .time { font-size: 11px; color: var(--text-soft); margin-top: 2px; }
.menu-item { display: flex; align-items: center; gap: 9px; padding: 9px 14px; color: var(--text); cursor: pointer; }
.menu-item:hover { background: var(--bg-main); text-decoration: none; }

.avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; flex: none; }
.avatar-btn { padding: 0; border: none; background: none; cursor: pointer; }

/* ---------- Content ---------- */
.content { padding: 22px; flex: 1; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--text-soft); font-size: 13px; margin-top: 2px; }

/* cards */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card__body { padding: 16px; }
.card__head { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

/* stat cards */
.stat { display: flex; align-items: center; gap: 14px; padding: 18px; }
.stat .ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.stat .num { font-size: 26px; font-weight: 800; line-height: 1; }
.stat .lbl { color: var(--text-soft); font-size: 12.5px; margin-top: 4px; }
.ico.bg-purple { background: var(--primary-light); color: var(--primary-dark); }
.ico.bg-blue { background: #DBEAFE; color: #1D4ED8; }
.ico.bg-red { background: #FEE2E2; color: #B91C1C; }
.ico.bg-green { background: #D1FAE5; color: #047857; }
.ico.bg-amber { background: #FEF3C7; color: #B45309; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.status-todo { background: #F3F4F6; color: #4B5563; }
.badge.status-in_progress { background: #DBEAFE; color: #1D4ED8; }
.badge.status-review { background: #FEF3C7; color: #B45309; }
.badge.status-done { background: #D1FAE5; color: #047857; }
.badge.status-cancelled { background: #FEE2E2; color: #B91C1C; }
.badge.prio-low { background: #F3F4F6; color: #4B5563; }
.badge.prio-normal { background: #DBEAFE; color: #1D4ED8; }
.badge.prio-high { background: #FEF3C7; color: #B45309; }
.badge.prio-urgent { background: #FEE2E2; color: #B91C1C; }
.pill { display: inline-flex; align-items:center; gap:6px; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 20px; background: var(--primary-light); color: var(--primary-dark); }

/* tables */
.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-soft); padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid #f1f1f4; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafaff; }
.table .row-overdue { background: #FEF2F2; }
.table .row-overdue:hover { background: #FEE9E9; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.u-cell { display: flex; align-items: center; gap: 8px; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 8px; font-weight: 600; font-size: 13.5px; border: 1px solid transparent; cursor: pointer; background: #fff; color: var(--text); transition: .12s; }
.btn:hover { text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-outline { border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg-main); }
.btn-danger { background: var(--cancelled); color: #fff; }
.btn-danger:hover { background: #DC2626; color:#fff; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* forms */
.form-row { margin-bottom: 15px; }
.form-row label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.form-row .hint { color: var(--text-soft); font-size: 12px; margin-top: 4px; }
.input, .select, textarea.input, select.select {
    width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 13.5px; font-family: inherit; background: #fff; color: var(--text);
}
.input:focus, .select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(123,104,238,.15); }
textarea.input { resize: vertical; min-height: 90px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

/* flash / alerts */
.alert { padding: 11px 14px; border-radius: 8px; font-size: 13.5px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-success { background: #ECFDF5; border-color: #A7F3D0; color: #065F46; }
.alert-error { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
.alert-info { background: #EFF6FF; border-color: #BFDBFE; color: #1E40AF; }

/* misc */
.muted { color: var(--text-soft); }
.text-overdue { color: var(--cancelled); font-weight: 600; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.mt-0{margin-top:0}.mb-0{margin-bottom:0}.mt-16{margin-top:16px}.mb-16{margin-bottom:16px}
.empty { text-align: center; padding: 48px 20px; color: var(--text-soft); }
.empty svg { width: 46px; height: 46px; opacity: .4; margin-bottom: 10px; }
.progress { height: 8px; background: #EEF0F4; border-radius: 6px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 6px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.filters .form-row { margin: 0; }
.tag { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; color: #fff; }

/* pagination */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 18px; }
.pagination a, .pagination span { padding: 6px 11px; border: 1px solid var(--border); border-radius: 7px; background: #fff; font-size: 13px; }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-brand {
    background: radial-gradient(1200px 500px at 10% 0%, #6f5bff 0%, transparent 60%), linear-gradient(160deg, #2C2C54, #4a3fb0);
    color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: center;
}
.login-brand .logo-lg { width: 56px; height: 56px; border-radius: 14px; background: linear-gradient(135deg, var(--primary), #9C8BFF); display: grid; place-items: center; font-weight: 800; font-size: 26px; margin-bottom: 26px; }
.login-brand h1 { color: #fff; font-size: 40px; line-height: 1.1; margin-bottom: 14px; }
.login-brand p { color: #cfcdf2; font-size: 16px; max-width: 420px; }
.login-brand .points { margin-top: 30px; display: grid; gap: 12px; }
.login-brand .point { display: flex; gap: 10px; align-items: center; color: #e7e6ff; font-size: 14px; }
.login-brand .point .c { width: 24px; height: 24px; border-radius: 7px; background: rgba(255,255,255,.14); display: grid; place-items: center; }
.login-form-side { display: grid; place-items: center; padding: 40px; background: #fff; }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 24px; }
.login-card .sub { color: var(--text-soft); margin-bottom: 22px; }
.login-demo { margin-top: 18px; border: 1px dashed var(--border); border-radius: 10px; padding: 12px 14px; font-size: 12.5px; color: var(--text-soft); background: var(--bg-main); }
.login-demo b { color: var(--text); }
.login-demo code { background: #fff; border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; cursor: pointer; }

/* ---------- Responsive ---------- */
.backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
@media (max-width: 1024px) {
    .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .topbar .menu-toggle { display: grid; }
    .backdrop.show { display: block; }
    .login-wrap { grid-template-columns: 1fr; }
    .login-brand { display: none; }
    .grid.cols-4, .grid.cols-3, .grid.cols-2, .form-grid { grid-template-columns: 1fr; }
    .search kbd { display: none; }
}
