/* ===== DESIGN TOKENS ===== */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a26;
  --bg-card: rgba(26, 26, 38, 0.7);
  --bg-hover: rgba(255,255,255,0.04);
  --bg-glass: rgba(26, 26, 38, 0.6);
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.15);
  --text-primary: #f0f0f5;
  --text-secondary: #8888a0;
  --text-muted: #55556a;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99,102,241,0.25);
  --reental: #3b82f6;
  --reental-bg: rgba(59,130,246,0.12);
  --mdemarketing: #10b981;
  --mdemarketing-bg: rgba(16,185,129,0.12);
  --urgent: #ef4444;
  --high: #f97316;
  --medium: #eab308;
  --low: #94a3b8;
  --todo: #94a3b8;
  --in-progress: #6366f1;
  --blocked: #ef4444;
  --done: #10b981;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --sidebar-w: 260px;
  --topbar-h: 64px;
  --transition: 0.2s cubic-bezier(.4,0,.2,1);
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body { background: var(--bg-primary); color: var(--text-primary); min-height: 100vh; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; font-size: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
h1,h2,h3 { font-weight: 600; }

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-md); font-weight: 500; font-size: .875rem; transition: all var(--transition); white-space: nowrap; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 0 20px var(--accent-glow); }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 0 30px var(--accent-glow); }
.btn-ghost { color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-sm { padding: 6px 10px; font-size: .8rem; }
.btn-full { width: 100%; justify-content: center; padding: 12px; }
.btn-danger:hover { color: var(--urgent) !important; }

/* ===== LOGIN ===== */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; position: fixed; inset: 0; z-index: 500; overflow: hidden; background: var(--bg-primary); }
.login-screen[hidden] { display: none; }
.login-card { position: relative; z-index: 2; background: var(--bg-glass); backdrop-filter: blur(24px); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 48px 40px; width: 100%; max-width: 400px; margin: 20px; }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo-icon { font-size: 48px; margin-bottom: 12px; filter: drop-shadow(0 0 20px var(--accent-glow)); }
.login-logo h1 { font-size: 1.75rem; font-weight: 700; background: linear-gradient(135deg, var(--text-primary), var(--accent-hover)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.login-subtitle { color: var(--text-secondary); margin-top: 4px; font-size: .9rem; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-group label { font-size: .8rem; color: var(--text-secondary); font-weight: 500; }
.input-group input { background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; color: var(--text-primary); transition: border-color var(--transition); }
.input-group input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.login-error { color: var(--urgent); font-size: .8rem; text-align: center; animation: shake .4s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }

/* Login background orbs */
.login-bg-orbs { position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .4; animation: float 8s ease-in-out infinite; }
.orb-1 { width: 300px; height: 300px; background: var(--accent); top: -100px; right: -50px; }
.orb-2 { width: 250px; height: 250px; background: var(--reental); bottom: -80px; left: -60px; animation-delay: 2s; }
.orb-3 { width: 200px; height: 200px; background: var(--mdemarketing); top: 50%; left: 50%; animation-delay: 4s; }
@keyframes float { 0%,100%{transform:translate(0,0)} 50%{transform:translate(20px,-20px)} }

/* ===== APP LAYOUT ===== */
.app { display: flex; min-height: 100vh; }
.app[hidden] { display: none !important; }

/* ===== SIDEBAR ===== */
.sidebar { width: var(--sidebar-w); background: var(--bg-secondary); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; transition: transform var(--transition); }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 16px; border-bottom: 1px solid var(--border); }
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 24px; }
.logo-text { font-size: 1.15rem; font-weight: 700; background: linear-gradient(135deg, var(--text-primary), var(--accent-hover)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.sidebar-toggle { padding: 4px; border-radius: var(--radius-sm); color: var(--text-muted); transition: all var(--transition); }
.sidebar-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; }
.nav-section-title { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); padding: 0 8px; margin-bottom: 4px; display: block; }
.nav-section { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-md); color: var(--text-secondary); font-size: .875rem; font-weight: 450; transition: all var(--transition); width: 100%; text-align: left; }
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: rgba(99,102,241,0.1); color: var(--accent-hover); }
.nav-badge { margin-left: auto; background: var(--bg-tertiary); padding: 2px 8px; border-radius: 99px; font-size: .75rem; font-weight: 600; color: var(--text-muted); }
.company-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-all { background: linear-gradient(135deg, var(--reental), var(--mdemarketing)); }
.dot-reental { background: var(--reental); }
.dot-mdemarketing { background: var(--mdemarketing); }

/* Priority filter chips */
.priority-filters { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 4px; }
.priority-chip { padding: 5px 10px; border-radius: 99px; font-size: .75rem; font-weight: 500; color: var(--text-muted); border: 1px solid var(--border); transition: all var(--transition); display: flex; align-items: center; gap: 4px; }
.priority-chip:hover { border-color: var(--border-hover); color: var(--text-secondary); }
.priority-chip.active { background: rgba(99,102,241,0.12); border-color: var(--accent); color: var(--accent-hover); }
.prio-dot { width: 6px; height: 6px; border-radius: 50%; }
.prio-dot.urgent { background: var(--urgent); }
.prio-dot.high { background: var(--high); }
.prio-dot.medium { background: var(--medium); }
.prio-dot.low { background: var(--low); }

/* Sidebar footer */
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.sync-status { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: .8rem; color: var(--text-muted); }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; }
.sync-dot.synced { background: var(--done); box-shadow: 0 0 6px var(--done); }
.sync-dot.syncing { background: var(--medium); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ===== MAIN CONTENT ===== */
.main-content { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }

/* Topbar */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 0 24px; height: var(--topbar-h); border-bottom: 1px solid var(--border); background: rgba(10,10,15,0.8); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 50; gap: 16px; }
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title h1 { font-size: 1.15rem; font-weight: 700; }
.topbar-count { font-size: .8rem; color: var(--text-muted); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.mobile-menu-btn { display: none; padding: 4px; color: var(--text-secondary); }
.search-box { display: flex; align-items: center; gap: 8px; background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 7px 12px; transition: border-color var(--transition); min-width: 200px; }
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-box svg { color: var(--text-muted); flex-shrink: 0; }
.search-box input { background: none; border: none; outline: none; color: var(--text-primary); width: 100%; }
.search-box input::placeholder { color: var(--text-muted); }

/* ===== KANBAN ===== */
.kanban-view { flex: 1; overflow-x: auto; padding: 24px; }
.kanban-board { display: flex; gap: 16px; min-height: calc(100vh - var(--topbar-h) - 48px); }
.kanban-column { flex: 1; min-width: 260px; max-width: 340px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; }
.kanban-column-header { padding: 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.column-title { display: flex; align-items: center; gap: 8px; }
.column-title h2 { font-size: .9rem; font-weight: 600; }
.column-count { background: var(--bg-tertiary); padding: 1px 7px; border-radius: 99px; font-size: .75rem; font-weight: 600; color: var(--text-muted); }
.column-dot { width: 10px; height: 10px; border-radius: 50%; }
.column-dot.todo { background: var(--todo); }
.column-dot.in-progress { background: var(--in-progress); }
.column-dot.blocked { background: var(--blocked); }
.column-dot.done { background: var(--done); }
.column-add-btn { padding: 4px; border-radius: var(--radius-sm); color: var(--text-muted); transition: all var(--transition); }
.column-add-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.kanban-cards { flex: 1; padding: 12px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 60px; }

/* Kanban Card */
.kanban-card { background: var(--bg-card); backdrop-filter: blur(8px); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; cursor: pointer; transition: all var(--transition); position: relative; }
.kanban-card:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kanban-card.dragging { opacity: .5; transform: rotate(2deg); }
.kanban-card .card-company { display: inline-flex; align-items: center; gap: 5px; font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 99px; margin-bottom: 8px; }
.kanban-card .card-company.reental { background: var(--reental-bg); color: var(--reental); }
.kanban-card .card-company.mdemarketing { background: var(--mdemarketing-bg); color: var(--mdemarketing); }
.kanban-card .card-title { font-size: .875rem; font-weight: 550; line-height: 1.4; margin-bottom: 10px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.kanban-card .card-footer { display: flex; align-items: center; justify-content: space-between; }
.kanban-card .card-priority { font-size: .7rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.card-priority.urgent { background: rgba(239,68,68,0.15); color: var(--urgent); }
.card-priority.high { background: rgba(249,115,22,0.15); color: var(--high); }
.card-priority.medium { background: rgba(234,179,8,0.15); color: var(--medium); }
.card-priority.low { background: rgba(148,163,184,0.1); color: var(--low); }
.kanban-card .card-date { font-size: .7rem; color: var(--text-muted); }
.kanban-card .card-source { position: absolute; top: 10px; right: 10px; font-size: .65rem; color: var(--text-muted); opacity: .6; }
.kanban-card .card-type-icon { font-size: .75rem; }

/* Drop zone indicator */
.kanban-cards.drag-over { background: rgba(99,102,241,0.05); border-radius: var(--radius-md); outline: 2px dashed var(--accent); outline-offset: -4px; }

/* ===== LIST VIEW ===== */
.list-view { flex: 1; padding: 24px; }
.list-container { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.list-header { display: grid; grid-template-columns: 80px 1fr 120px 100px 80px 100px 60px; padding: 12px 16px; background: var(--bg-tertiary); border-bottom: 1px solid var(--border); font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.list-row { display: grid; grid-template-columns: 80px 1fr 120px 100px 80px 100px 60px; padding: 12px 16px; border-bottom: 1px solid var(--border); align-items: center; transition: background var(--transition); cursor: pointer; font-size: .875rem; }
.list-row:hover { background: var(--bg-hover); }
.list-row:last-child { border-bottom: none; }
.list-status-dot { width: 10px; height: 10px; border-radius: 50%; margin: 0 auto; }
.list-company-badge { font-size: .7rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; display: inline-block; }
.list-priority-badge { font-size: .7rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; display: inline-block; }
.list-source { font-size: .75rem; color: var(--text-muted); }
.list-date { font-size: .8rem; color: var(--text-secondary); }
.list-action-btn { padding: 4px; border-radius: var(--radius-sm); color: var(--text-muted); transition: all var(--transition); }
.list-action-btn:hover { color: var(--urgent); background: rgba(239,68,68,0.1); }

/* ===== EMPTY STATE ===== */
.empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: var(--text-muted); padding: 40px; }
.empty-illustration { color: var(--text-muted); margin-bottom: 8px; }
.empty-state h3 { font-size: 1.1rem; color: var(--text-secondary); }
.empty-state p { font-size: .9rem; }

/* ===== MODALS ===== */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn .2s; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }
.modal-content { position: relative; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-xl); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: slideUp .3s cubic-bezier(.16,1,.3,1); }
.modal-detail { max-width: 580px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 1.1rem; }
.modal-close { padding: 4px; border-radius: var(--radius-sm); color: var(--text-muted); transition: all var(--transition); }
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
@keyframes slideUp { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }

/* Task Form */
.task-form { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: .8rem; font-weight: 500; color: var(--text-secondary); }
.form-group input, .form-group select, .form-group textarea { background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 12px; transition: border-color var(--transition); }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238888a0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); }

/* Detail modal */
.detail-header-left { display: flex; gap: 8px; }
.detail-header-actions { display: flex; gap: 4px; align-items: center; }
.detail-company-badge, .detail-source-badge { font-size: .7rem; font-weight: 600; padding: 3px 10px; border-radius: 99px; }
.detail-body { padding: 24px; }
.detail-body h2 { font-size: 1.25rem; margin-bottom: 16px; line-height: 1.4; }
.detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.detail-meta-item { display: flex; flex-direction: column; gap: 4px; }
.meta-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 600; }
.detail-priority, .detail-status, .detail-type, .detail-date { font-size: .85rem; font-weight: 500; }
.detail-description { font-size: .9rem; color: var(--text-secondary); line-height: 1.7; white-space: pre-wrap; padding-top: 16px; border-top: 1px solid var(--border); }

/* ===== TOAST ===== */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 18px; font-size: .85rem; color: var(--text-primary); box-shadow: var(--shadow-lg); animation: slideInRight .3s cubic-bezier(.16,1,.3,1); display: flex; align-items: center; gap: 8px; max-width: 360px; }
.toast.success { border-color: var(--done); }
.toast.error { border-color: var(--urgent); }
.toast-icon { font-size: 1rem; }
@keyframes slideInRight { from{opacity:0;transform:translateX(40px)} to{opacity:1;transform:translateX(0)} }

/* ===== LOADING ===== */
[hidden] { display: none !important; }
.loading-overlay { position: fixed; inset: 0; z-index: 250; background: rgba(10,10,15,0.9); display: flex; align-items: center; justify-content: center; }
.loading-spinner { display: flex; flex-direction: column; align-items: center; gap: 16px; color: var(--text-secondary); }
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to{transform:rotate(360deg)} }

/* ===== SIDEBAR OVERLAY (MOBILE) ===== */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 90; }
.sidebar-overlay.active { display: block; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.active { display: block; }
  .main-content { margin-left: 0; }
  .mobile-menu-btn { display: flex; }
  .kanban-board { flex-direction: column; }
  .kanban-column { max-width: 100%; min-width: 100%; }
  .list-header, .list-row { grid-template-columns: 40px 1fr 90px 80px 60px; }
  .col-source, .col-date { display: none; }
  .list-source, .list-date { display: none; }
  .topbar { padding: 0 16px; }
  .search-box { min-width: 120px; }
  .btn span { display: none; }
  .btn svg { margin: 0; }
  .btn-primary span { display: inline; }
  .form-row { grid-template-columns: 1fr; }
  .detail-meta { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .search-box { display: none; }
  .kanban-view { padding: 12px; }
  .kanban-cards { padding: 8px; }
  .modal-content { border-radius: var(--radius-lg); }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }
