/* =====================================================================
   shared.css — Hitesh Minjan design system, v2
   PLAIN ENGLISH: this one file controls the look of every dashboard.
   Change a color/spacing rule here and it updates everywhere at once.
   v2 redesign: colored-rail task cards, bottom tab bar, floating "+"
   button, glowing briefing card, cleaner header with a menu — based on
   the approved mockup concept.
===================================================================== */
:root{
  /* ---- LIGHT THEME (default) ---- */
  --ink:#12192B; --paper:#FAF9F6; --paper-dim:#F0EEE8; --card:#FFFFFF; --card-2:#F5F3EE;
  --line:#E4E1D8; --sage:#4A7C74; --sage-dark:#356158; --sage-tint:#E7F0EE;
  --coral:#C1554A; --amber:#C9963E; --gold:#B9862F; --teal:#2E8B8F; --violet:#7C6BC7;
  --text-1:#12192B; --text-2:#5B6478; --text-3:#8B92A3;
  --radius:18px; --radius-sm:12px; --shadow:0 4px 16px rgba(18,25,43,0.07);
  --topbar-bg:rgba(250,249,246,0.9); --subtabs-bg:rgba(250,249,246,0.95);
  --briefing-grad-1:rgba(124,107,199,0.10); --briefing-grad-2:rgba(193,85,74,0.06);
  --fab-grad-1:var(--coral); --fab-grad-2:#a8402f;
}

/* ---------- DARK THEME ---------- */
/* Applied when <html data-theme="dark">. Same variable names, so every
   rule below (which all use var(--x)) repaints automatically. */
html[data-theme="dark"]{
  --ink:#f3f1ec; --paper:#0c0d10; --paper-dim:#141519; --card:#1b1c22; --card-2:#202128;
  --line:rgba(255,255,255,0.08); --sage:#5fb490; --sage-dark:#3f8a6c; --sage-tint:rgba(95,180,144,0.14);
  --coral:#ff8a71; --amber:#f2b84b; --gold:#e3b661; --teal:#4fc3c9; --violet:#9d8cf0;
  --text-1:#f3f1ec; --text-2:#a8a6ad; --text-3:#706e77;
  --shadow:0 4px 20px rgba(0,0,0,0.4);
  --topbar-bg:rgba(20,21,25,0.9); --subtabs-bg:rgba(12,13,16,0.95);
  --briefing-grad-1:rgba(157,140,240,0.14); --briefing-grad-2:rgba(255,138,113,0.10);
  --fab-grad-1:var(--coral); --fab-grad-2:#e0654a;
}
html[data-theme="dark"] .brand-mark{background:linear-gradient(135deg,var(--coral),var(--violet));}
html[data-theme="dark"] .modal-bg{background:rgba(0,0,0,0.6);}

*{box-sizing:border-box; margin:0; padding:0;}
body{background:var(--paper); color:var(--text-1); font-family:'Inter',sans-serif; min-height:100vh;}
.serif{font-family:'Fraunces',serif;}
a,button{font-family:inherit; cursor:pointer;}
button{border:none; background:none; color:inherit;}
input,select,textarea{font-family:inherit; color:inherit;}

/* =====================================================================
   HEADER (cleaned up: brand + avatar + one menu button)
===================================================================== */
.topbar{
  position:sticky; top:0; z-index:50;
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 20px; background:var(--topbar-bg); backdrop-filter:blur(10px);
  border-bottom:1px solid var(--line);
}
.brand{display:flex; align-items:center; gap:10px; font-family:'Fraunces',serif; font-weight:600; font-size:17px;}
.brand-mark{width:32px; height:32px; border-radius:9px; background:linear-gradient(135deg,var(--coral),var(--violet));
  display:flex; align-items:center; justify-content:center; color:#fff; font-size:15px; flex-shrink:0;}

.who{display:flex; align-items:center; gap:10px; position:relative;}
.avatar-btn{
  width:34px; height:34px; border-radius:50%;
  background:linear-gradient(135deg,var(--coral),var(--violet));
  display:flex; align-items:center; justify-content:center;
  font-size:12.5px; font-weight:700; color:#fff; flex-shrink:0;
}

/* Dropdown menu that opens from the avatar button */
.menu-dropdown{
  position:absolute; top:44px; right:0; z-index:60;
  background:var(--card); border:1px solid var(--line); border-radius:14px;
  box-shadow:var(--shadow); min-width:200px; padding:6px; overflow:hidden;
}
.menu-header{padding:10px 12px 8px; border-bottom:1px solid var(--line); margin-bottom:4px;}
.menu-name{font-weight:600; font-size:13.5px;}
.menu-role{font-size:11px; color:var(--text-2); text-transform:uppercase; letter-spacing:0.04em; margin-top:2px;}
.menu-item{
  display:flex; align-items:center; gap:10px; width:100%;
  padding:10px 12px; border-radius:9px; font-size:13.5px; font-weight:500;
  text-align:left; color:var(--text-1);
}
.menu-item:hover{background:var(--paper-dim);}
.menu-item .mi-ic{font-size:15px; width:18px; text-align:center; flex-shrink:0;}
.menu-item.danger{color:var(--coral);}

/* =====================================================================
   BOTTOM TAB BAR (replaces old top .tabs row)
===================================================================== */
.tabbar{
  position:fixed; bottom:0; left:0; right:0; z-index:80;
  height:64px; padding-bottom:env(safe-area-inset-bottom, 0);
  background:var(--topbar-bg); backdrop-filter:blur(20px);
  border-top:1px solid var(--line);
  display:flex; align-items:stretch; justify-content:space-around;
  max-width:100vw;
}
.tabitem{
  flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:2px; font-size:10.5px; font-weight:600; color:var(--text-3);
}
.tabitem .ic{font-size:19px; line-height:1;}
.tabitem.active{color:var(--gold);}

/* Old top-tab class kept as an alias so nothing breaks if referenced elsewhere */
.tabs{display:none;}

/* =====================================================================
   FLOATING ADD BUTTON
===================================================================== */
.fab{
  position:fixed; right:18px; z-index:70;
  bottom:calc(64px + env(safe-area-inset-bottom, 0) + 16px);
  width:52px; height:52px; border-radius:50%;
  background:linear-gradient(135deg,var(--fab-grad-1),var(--fab-grad-2));
  display:flex; align-items:center; justify-content:center;
  font-size:26px; color:#fff; font-weight:400;
  box-shadow:0 10px 24px rgba(193,85,74,0.35);
}

.page{max-width:1000px; margin:0 auto; padding:18px 18px calc(64px + env(safe-area-inset-bottom, 0) + 28px);}
.hidden{display:none !important;}

/* =====================================================================
   GENERIC CARD / BUTTON / FORM STYLES
===================================================================== */
.card{background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:18px; margin-bottom:14px;}
.btn{display:inline-flex; align-items:center; gap:6px; padding:9px 16px; border-radius:10px; font-size:13.5px; font-weight:600;
  border:1px solid var(--line); background:var(--card); color:var(--text-1);}
.btn-primary{background:var(--sage); border-color:var(--sage); color:#fff;}
.btn-sm{padding:6px 12px; font-size:12.5px;}
input[type=text],input[type=email],input[type=password],input[type=number],select,textarea{
  width:100%; padding:9px 12px; border:1px solid var(--line); border-radius:9px; font-size:13.5px; background:var(--card); color:var(--text-1);}
label{font-size:12px; color:var(--text-2); font-weight:600; display:block; margin-bottom:5px;}
.field{margin-bottom:12px;}

.auth-wrap{max-width:380px; margin:14vh auto; padding:0 20px; text-align:center;}
.auth-wrap .brand-mark{width:48px; height:48px; font-size:20px; border-radius:13px; margin:0 auto 16px;}

.role-pill{background:var(--sage-tint); color:var(--sage-dark); padding:3px 10px; border-radius:20px; font-weight:600; font-size:11px; text-transform:uppercase;}

/* =====================================================================
   HOME: hero greeting + briefing
===================================================================== */
.hero-greeting{
  font-family:'Fraunces',serif; font-weight:600; font-size:27px; line-height:1.15;
  background:linear-gradient(90deg,var(--sage-dark),var(--gold));
  -webkit-background-clip:text; background-clip:text; color:transparent;
  margin-bottom:4px;
}
.hero-date{color:var(--text-3); font-size:13px; margin-bottom:18px;}

.briefing{
  position:relative; overflow:hidden;
  background:linear-gradient(135deg, var(--briefing-grad-1) 0%, var(--briefing-grad-2) 100%);
  border:1px solid var(--line); border-radius:var(--radius);
  padding:18px; margin-bottom:20px; cursor:pointer;
  display:flex; align-items:center; gap:16px;
  transition:transform .15s ease, box-shadow .15s ease;
}
.briefing::before{
  content:""; position:absolute; inset:0; pointer-events:none;
  background:radial-gradient(circle at 90% -10%, rgba(157,140,240,0.28), transparent 60%);
}
.briefing:hover{transform:translateY(-2px); box-shadow:var(--shadow);}
.briefing-body{flex:1; min-width:0; position:relative; z-index:1;}
.briefing-chevron{font-size:22px; color:var(--violet); flex-shrink:0; opacity:0.8; position:relative; z-index:1;}
.briefing-label{
  display:flex; align-items:center; gap:8px;
  font-size:11px; font-weight:700; letter-spacing:0.08em; text-transform:uppercase;
  color:var(--violet); margin-bottom:8px;
}
.briefing-dot{width:6px; height:6px; border-radius:50%; background:var(--violet); box-shadow:0 0 8px var(--violet); animation:pulse 2s infinite;}
@keyframes pulse{0%,100%{opacity:1;} 50%{opacity:0.4;}}
.briefing-text{font-size:13.5px; line-height:1.55; color:var(--text-1);}
.briefing-text strong{font-weight:600; color:var(--sage-dark);}

/* =====================================================================
   HOME: quick action row + stat buttons
===================================================================== */
.quickrow{display:flex; gap:8px; margin-bottom:22px;}
.qbtn{
  flex:1; background:var(--card); border:1px solid var(--line); border-radius:14px;
  padding:12px 10px; text-align:center; font-size:12px; font-weight:600; color:var(--text-1);
}
.qbtn .ic{font-size:18px; display:block; margin-bottom:4px;}

.stat-btn-row{display:grid; grid-template-columns:repeat(3, 1fr); gap:10px; margin-bottom:24px;}
.stat-btn{
  background:var(--card); border:1px solid var(--line); border-radius:16px;
  padding:14px 10px; text-align:center; cursor:pointer;
  transition:all .15s ease; box-shadow:0 2px 8px rgba(18,25,43,0.04);
}
.stat-btn:hover{transform:translateY(-2px); box-shadow:var(--shadow); border-color:var(--stat-color, var(--sage));}
.stat-btn-num{font-family:'Fraunces',serif; font-weight:600; font-size:26px; line-height:1; color:var(--stat-color, var(--text-1));}
.stat-btn-label{font-size:11px; font-weight:600; color:var(--text-2); margin-top:5px; text-transform:uppercase; letter-spacing:0.03em;}
.stat-btn.is-zero .stat-btn-num{color:var(--text-3);}

.sectiontitle{
  font-size:12.5px; font-weight:700; color:var(--text-2);
  text-transform:uppercase; letter-spacing:0.06em; margin:4px 0 10px;
}

/* =====================================================================
   TASK CARDS — colored left rail (urgency/category at a glance)
   PLAIN ENGLISH: a thin colored stripe down the left edge instantly
   tells you overdue (coral) vs. in-progress (teal) vs. normal (amber),
   without reading the text first.
===================================================================== */
.task-card{
  background:var(--card); border:1px solid var(--line); border-radius:var(--radius-sm);
  padding:13px 14px; margin-bottom:10px; font-size:13.5px; cursor:pointer;
  position:relative; overflow:hidden;
}
.task-card::before{content:""; position:absolute; left:0; top:0; bottom:0; width:3px; background:var(--text-3);}
.task-card.tc-overdue::before{background:var(--coral);}
.task-card.tc-today::before{background:var(--teal);}
.task-card.tc-upcoming::before{background:var(--amber);}
.task-card.tc-done{opacity:0.6;}
.task-card.tc-done::before{background:var(--sage);}
.task-card:hover{border-color:var(--sage);}

.tc-project{font-size:11px; color:var(--text-3); font-weight:600; display:flex; align-items:center; gap:5px; margin-bottom:5px;}
.tc-title{font-size:14px; font-weight:600; color:var(--text-1); margin-bottom:8px;}
.tc-title.done{text-decoration:line-through; color:var(--text-3);}
.tc-meta{display:flex; justify-content:space-between; align-items:center; gap:8px;}
.tc-due{font-size:11.5px; color:var(--text-3);}
.tc-due.overdue{color:var(--coral); font-weight:600;}
.task-owner{font-size:11px; color:var(--text-3); margin-top:4px;}

.comment-preview{
  display:flex; align-items:center; gap:5px; margin-top:8px; padding-top:8px;
  border-top:1px solid var(--line); font-size:11px; color:var(--text-3);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}

.board{display:grid; grid-template-columns:repeat(3,1fr); gap:14px; margin-top:16px;}
.col-head{
  font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:0.04em;
  color:var(--text-2); margin-bottom:8px; display:flex; align-items:center; gap:6px;
}
.col-count{background:var(--card-2); border-radius:10px; padding:1px 7px; font-size:10.5px; color:var(--text-3);}
.dot-todo{width:7px; height:7px; border-radius:50%; background:var(--text-3); display:inline-block;}
.dot-progress{width:7px; height:7px; border-radius:50%; background:var(--amber); display:inline-block;}
.dot-done{width:7px; height:7px; border-radius:50%; background:var(--sage); display:inline-block;}

/* =====================================================================
   MISC (modals, tables, toast, lists — unchanged behavior, retoned)
===================================================================== */
.modal-bg{position:fixed; inset:0; background:rgba(18,25,43,0.35); display:flex; align-items:center; justify-content:center; z-index:200; padding:16px;}
.modal{background:var(--card); border-radius:16px; padding:22px; width:92%; max-width:440px; max-height:86vh; overflow:auto;}
.modal h3{font-family:'Fraunces',serif; margin-bottom:14px;}
.confirm-modal{z-index:250;}
.confirm-modal .modal{max-width:340px; text-align:center;}
.confirm-modal p{font-size:14px; color:var(--text-1); line-height:1.5; margin-bottom:18px;}
.comment{padding:8px 0; border-bottom:1px solid var(--line); font-size:13px;}
.comment b{font-size:12.5px;}
.comment-meta{color:var(--text-3); font-size:11px;}

.proj-row{display:flex; justify-content:space-between; align-items:center; cursor:pointer;}
.proj-row:hover{color:var(--sage-dark);}

.toast{position:fixed; bottom:84px; left:50%; transform:translateX(-50%); background:var(--ink); color:var(--paper);
  padding:10px 18px; border-radius:10px; font-size:13px; opacity:0; transition:opacity .2s; pointer-events:none; z-index:300;}
.toast.show{opacity:1;}

table{width:100%; border-collapse:collapse; font-size:13px;}
th,td{text-align:left; padding:8px 6px; border-bottom:1px solid var(--line);}

.simple-list-item{display:flex; align-items:center; gap:12px; padding:12px 14px; background:var(--card); border:1px solid var(--line);
  border-radius:12px; margin-bottom:10px; font-size:14px;}
.simple-list-item input[type=checkbox]{width:20px; height:20px; flex-shrink:0;}

/* ---------- Project sub-tab row (Board/Notes/Milestones/...) ---------- */
.subtabs-row{
  display:flex; flex-wrap:wrap; gap:6px;
  margin-bottom:14px; padding:10px 0;
  position:sticky; top:57px; z-index:40;
  background:var(--subtabs-bg); backdrop-filter:blur(8px);
  border-bottom:1px solid var(--line);
}
.subtabs-row .btn-sm.active{background:var(--gold); border-color:var(--gold); color:#1a1508;}
