/* =========================================
   INFU v2 — Mobile-first, Pink Minimal
   ========================================= */

/* ---------- TOKENS ---------- */
:root {
  --pink:        #e91e8c;
  --pink-soft:   #ff6ec4;
  --pink-bg:     #fff0f8;
  --pink-border: #fbc8e8;

  --bg:          #f5f6fa;
  --surface:     #ffffff;
  --surface2:    #f0f1f6;
  --border:      #e4e6f0;
  --text:        #12131a;
  --text2:       #5c5f7a;
  --text3:       #9496b0;

  --green:  #00c48c; --green-bg:  #e6faf5;
  --red:    #f24444; --red-bg:    #fff0f0;
  --amber:  #f5a623; --amber-bg:  #fff8ea;
  --blue:   #3b82f6; --blue-bg:   #eff6ff;
  --purple: #7c3aed; --purple-bg: #f3eeff;

  --s-pending: #fff3cd; --s-pending-t: #7a5200;
  --s-doing:   #d1e8ff; --s-doing-t:   #0a4a8a;
  --s-script:  #e9d5ff; --s-script-t:  #5b1fa8;
  --s-shoot:   #fce4f3; --s-shoot-t:   #8a1258;
  --s-review:  #ffe4cc; --s-review-t:  #8a3a00;
  --s-publish: #ccf7ee; --s-publish-t: #005c42;
  --s-done:    #c8f5d8; --s-done-t:    #004d1a;

  --t-photo: #f43f5e; --t-photo-bg: #fff1f2;
  --t-live:  #00c48c; --t-live-bg:  #e6faf5;
  --t-ad:    #7c3aed; --t-ad-bg:    #f3eeff;
  --t-event: #f5a623; --t-event-bg: #fff8ea;

  --r-s: 8px; --r-m: 12px; --r-l: 16px; --r-xl: 20px;
  --shadow-s: 0 1px 4px rgba(0,0,0,.06);
  --shadow-m: 0 4px 16px rgba(0,0,0,.08);
  --shadow-l: 0 12px 36px rgba(0,0,0,.12);

  --sidebar-w: 220px;
  --topbar-h:  52px;
  --nav-h:     62px;

  --font: 'Inter','Noto Sans Thai',-apple-system,BlinkMacSystemFont,sans-serif;
}

/* ---------- DARK MODE ---------- */
[data-theme="dark"] {
  --bg:       #0d0e17;
  --surface:  #181924;
  --surface2: #21223a;
  --border:   #2a2c45;
  --text:     #f0f1ff;
  --text2:    #8e90b0;
  --text3:    #5a5c78;
  --pink-bg:  #1f0a18;
  --pink-border: #4a1034;
  --shadow-s: 0 1px 4px rgba(0,0,0,.3);
  --shadow-m: 0 4px 16px rgba(0,0,0,.4);
  --shadow-l: 0 12px 36px rgba(0,0,0,.5);
  --s-pending: #3d2b00; --s-pending-t: #fcd34d;
  --s-doing:   #0c1a3d; --s-doing-t:   #93c5fd;
  --s-script:  #2d1463; --s-script-t:  #c4b5fd;
  --s-shoot:   #4a0f2d; --s-shoot-t:   #f9a8d4;
  --s-review:  #4a1e00; --s-review-t:  #fcd34d;
  --s-publish: #003a30; --s-publish-t: #6ee7b7;
  --s-done:    #003d18; --s-done-t:    #86efac;
  --t-photo-bg: #3d0613; --t-live-bg: #003820;
  --t-ad-bg:   #2d1463; --t-event-bg: #3d2000;
  --green-bg:  #003d2a; --red-bg: #3d0a0a;
  --amber-bg:  #3d2200; --blue-bg: #0c1a3d;
  --purple-bg: #1e0a3d;
}
[data-theme="dark"] .top-bar { background: rgba(13,14,23,.9); }
[data-theme="dark"] .mobile-nav { background: var(--surface); }
[data-theme="dark"] .auth-wrap { background: var(--bg); }
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select { background: var(--surface2); color: var(--text); }

/* ---------- RESET ---------- */
*,*::before,*::after { box-sizing:border-box; margin:0; padding:0; }
html { font-size:16px; overflow-x:hidden; -webkit-text-size-adjust:100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--pink); text-decoration: none; }
img { max-width:100%; display:block; }
input,select,textarea,button { font-family:inherit; font-size:.875rem; }

/* ---------- AUTH ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg,#fff0f8 0%,#fce7f3 40%,#f3e8ff 100%);
  padding: 1.5rem;
}
[data-theme="dark"] .auth-wrap {
  background: linear-gradient(160deg,#1f0a18 0%,#0d0e17 60%,#0d0f1f 100%);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-l);
  padding: 2rem;
}
.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.logo-icon {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--pink) 0%, var(--pink-soft) 100%);
  border-radius: var(--r-l);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 8px 24px rgba(233,30,140,.35);
  margin-bottom: .75rem;
}
.auth-logo h1 { font-size: 1.5rem; font-weight: 800; }
.auth-subtitle { font-size: .8rem; color: var(--text2); margin-top: .25rem; }
.auth-tab { display: none; }
.auth-tab.active { display: block; }
.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-divider {
  display: flex; align-items: center; gap: 1rem;
  margin: 1.25rem 0; color: var(--text3); font-size: .8rem;
}
.auth-divider::before,.auth-divider::after { content:''; flex:1; height:1px; background:var(--border); }
.auth-switch { text-align:center; margin-top:1.25rem; font-size:.8rem; color:var(--text2); }
.auth-error {
  display:none; background:var(--red-bg); color:var(--red);
  padding:.75rem 1rem; border-radius:var(--r-s); font-size:.8rem; margin-top:1rem;
}
.auth-error.visible { display:block; }
.auth-success {
  display:none; background:var(--green-bg); color:var(--green);
  padding:.75rem 1rem; border-radius:var(--r-s); font-size:.8rem; margin-top:1rem;
}
.auth-success.visible { display:block; }
/* alias for old class names */
.auth-screen { display:contents; }

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .4rem; padding: .5rem 1rem; border-radius: var(--r-s);
  border: 1.5px solid transparent; font-weight: 600; font-size: .875rem;
  cursor: pointer; transition: all .15s ease; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--pink);
  color: #fff;
  border-color: var(--pink);
  box-shadow: 0 4px 14px rgba(233,30,140,.3);
}
.btn-primary:hover { background: #c4007a; border-color: #c4007a; }

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover { background: var(--surface2); }

.btn-danger {
  background: var(--red-bg); color: var(--red); border-color: transparent;
}
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-google {
  background: var(--surface); color: var(--text);
  border: 1.5px solid var(--border); font-weight: 500;
}
.btn-google:hover { background: var(--surface2); }
.btn-full { width: 100%; }

.btn-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-s); border: none;
  background: transparent; color: var(--text2);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn-icon:hover { background: var(--surface2); color: var(--text); }

.btn-text {
  background: none; border: none; color: var(--pink);
  font-size: .8rem; font-weight: 600; cursor: pointer;
  padding: .25rem .5rem; border-radius: var(--r-s);
}
.btn-text:hover { background: var(--pink-bg); }

.btn-theme {
  width: 36px; height: 36px;
  border-radius: var(--r-s);
  border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text2);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1rem; transition: all .15s ease;
}
.btn-theme:hover { border-color: var(--pink); background: var(--pink-bg); }

/* ---------- FORMS ---------- */
.form-group { display:flex; flex-direction:column; gap:.3rem; flex:1; }
.form-group label { font-size:.8rem; font-weight:600; color:var(--text2); }
.form-row { display:flex; gap:.75rem; }

input[type="text"],input[type="email"],input[type="password"],
input[type="number"],input[type="date"],input[type="time"],textarea {
  width:100%; padding:.55rem .75rem;
  border:1.5px solid var(--border); border-radius:var(--r-s);
  background:var(--surface); color:var(--text);
  outline:none; transition:border-color .15s,box-shadow .15s;
  color-scheme: light;
}
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="time"] {
  color-scheme: dark;
}
input:focus,textarea:focus,select:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(233,30,140,.12);
}
::placeholder { color:var(--text3); }
textarea { resize:vertical; }

.select-minimal {
  width:100%; padding:.55rem .75rem;
  border:1.5px solid var(--border); border-radius:var(--r-s);
  background:var(--surface); color:var(--text);
  outline:none; cursor:pointer; appearance:none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239496b0' stroke-width='2.5' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:right .75rem center;
  padding-right:2.25rem;
}

/* ---------- LAYOUT ---------- */
.app-screen { display:flex; min-height:100vh; }

/* Sidebar */
.sidebar {
  width:var(--sidebar-w);
  background:var(--surface);
  border-right:1.5px solid var(--border);
  position:fixed; top:0; left:0; bottom:0; z-index:200;
  display:flex; flex-direction:column;
  transition:transform .25s ease;
}
.sidebar.collapsed { transform:translateX(-100%); }

.sidebar-backdrop {
  display:none; position:fixed; inset:0;
  background:rgba(0,0,0,.45); z-index:199;
  backdrop-filter:blur(2px);
}
.sidebar-backdrop.visible { display:block; }

.sidebar-logo {
  display:flex; align-items:center; gap:.75rem;
  padding:1.25rem 1rem; border-bottom:1.5px solid var(--border);
}
.logo-icon-sm {
  width:32px; height:32px;
  background:linear-gradient(135deg,var(--pink) 0%,var(--pink-soft) 100%);
  border-radius:var(--r-s); display:flex; align-items:center;
  justify-content:center; font-size:1rem; font-weight:800; color:#fff;
}
.sidebar-brand {
  font-size:1.1rem; font-weight:800;
  background:linear-gradient(135deg,var(--pink),var(--pink-soft));
  -webkit-background-clip:text; -webkit-text-fill-color:transparent;
  background-clip:text;
}
.sidebar-nav {
  flex:1; padding:.75rem; display:flex;
  flex-direction:column; gap:.25rem; overflow-y:auto;
}
.nav-item {
  display:flex; align-items:center; gap:.75rem;
  padding:.6rem .75rem; border-radius:var(--r-s);
  color:var(--text2); font-size:.875rem; font-weight:500;
  transition:all .15s ease;
}
.nav-item:hover { background:var(--surface2); color:var(--text); }
.nav-item.active { background:var(--pink-bg); color:var(--pink); font-weight:600; }
.sidebar-bottom {
  padding:.75rem; border-top:1.5px solid var(--border);
  display:flex; flex-direction:column; gap:.25rem;
}
.avatar-sm { width:24px; height:24px; border-radius:50%; object-fit:cover; background:var(--surface2); }
.avatar-lg { width:80px; height:80px; border-radius:50%; object-fit:cover; background:var(--surface2); }

/* Main */
.main-content {
  flex:1; margin-left:var(--sidebar-w);
  display:flex; flex-direction:column; min-height:100vh;
  transition:margin-left .25s ease;
  min-width:0; overflow-x:hidden;
}
.sidebar.collapsed ~ .main-content { margin-left:0; }

/* Top bar */
.top-bar {
  height:var(--topbar-h);
  background:rgba(255,255,255,.92);
  border-bottom:1.5px solid var(--border);
  backdrop-filter:blur(12px);
  display:flex; align-items:center; justify-content:space-between;
  padding:0 1.25rem; position:sticky; top:0; z-index:50;
  gap:.5rem;
}
.top-bar-left {
  display:flex; align-items:center; gap:.5rem; flex-shrink:0;
}
.top-bar-left h2 { font-size:1rem; font-weight:700; white-space:nowrap; }
.top-bar-center {
  display:flex; align-items:center; gap:.25rem;
  flex:1; justify-content:center; min-width:0;
}
.month-label { font-size:.8rem; font-weight:700; min-width:110px; text-align:center; white-space:nowrap; }
.top-bar-right { display:flex; align-items:center; gap:.5rem; flex-shrink:0; }
.hide-xs { display:inline; }

/* Views */
.view-container {
  flex:1; padding:1.25rem; overflow-y:auto;
  padding-bottom:calc(1.25rem + var(--nav-h));
}
.view { display:none; }
.view.active { display:block; }

/* ---------- CALENDAR ---------- */
.calendar-weekdays {
  display:grid; grid-template-columns:repeat(7,1fr);
  text-align:center; font-size:.7rem; font-weight:700;
  color:var(--text3); margin-bottom:.4rem; gap:3px;
}
.calendar-grid {
  display:grid; grid-template-columns:repeat(7,1fr); gap:3px;
}
.cal-day {
  background:var(--surface); border:1.5px solid var(--border);
  border-radius:var(--r-s); min-height:90px; padding:4px;
  cursor:pointer; transition:all .15s ease;
  display:flex; flex-direction:column;
}
.cal-day:hover { border-color:var(--pink); box-shadow:0 4px 12px rgba(233,30,140,.1); }
.cal-day.today { border-color:var(--pink); background:var(--pink-bg); }
.cal-day.today .cal-date { color:var(--pink); font-weight:800; }
.cal-day.inactive { background:var(--surface2); opacity:.3; pointer-events:none; }
.cal-day.drag-over { background:var(--pink-bg); border:2px dashed var(--pink); }
.cal-date { font-size:.7rem; font-weight:600; color:var(--text2); text-align:right; margin-bottom:2px; }
.cal-task {
  font-size:.62rem; padding:1px 4px; border-radius:4px;
  margin-bottom:2px; white-space:nowrap; overflow:hidden;
  text-overflow:ellipsis; cursor:grab; font-weight:600;
}
.cal-task:active { cursor:grabbing; }
.cal-task.type-photo { background:var(--t-photo-bg); color:var(--t-photo); }
.cal-task.type-live  { background:var(--t-live-bg);  color:var(--t-live);  }
.cal-task.type-ad    { background:var(--t-ad-bg);    color:var(--t-ad);    }
.cal-task.type-event { background:var(--t-event-bg); color:var(--t-event); }
.cal-more { font-size:.6rem; color:var(--text3); text-align:center; margin-top:auto; }

/* ---------- KANBAN ---------- */
.kanban-board {
  display:flex; gap:.75rem; overflow-x:auto; padding-bottom:1rem;
  min-height:calc(100vh - var(--topbar-h) - 6rem);
  -webkit-overflow-scrolling:touch;
  scrollbar-width:thin; scrollbar-color:var(--border) transparent;
}
.kanban-col {
  min-width:256px; max-width:290px; flex-shrink:0;
  background:var(--surface2); border:1.5px solid var(--border);
  border-radius:var(--r-m); display:flex; flex-direction:column;
}
.kanban-col-header {
  padding:.6rem .875rem; display:flex; align-items:center;
  justify-content:space-between; font-weight:700; font-size:.8rem;
  border-bottom:1.5px solid var(--border);
}
.kanban-count {
  background:var(--surface); color:var(--text2);
  font-size:.7rem; padding:1px 8px; border-radius:999px; font-weight:700;
}
.kanban-list {
  flex:1; padding:.5rem .625rem; display:flex;
  flex-direction:column; gap:.5rem; min-height:80px; overflow-y:auto;
}
.kanban-card {
  background:var(--surface); border-radius:var(--r-s);
  padding:.75rem; box-shadow:var(--shadow-s); cursor:grab;
  transition:all .15s ease; border-left:3px solid transparent;
  border:1.5px solid var(--border); border-left-width:3px;
}
.kanban-card:hover { box-shadow:var(--shadow-m); transform:translateY(-1px); }
.kanban-card:active { cursor:grabbing; }
.kanban-card.type-photo { border-left-color:var(--t-photo); }
.kanban-card.type-live  { border-left-color:var(--t-live);  }
.kanban-card.type-ad    { border-left-color:var(--t-ad);    }
.kanban-card.type-event { border-left-color:var(--t-event); }
.kanban-card.file-drag-over { border:2px dashed var(--green); background:var(--green-bg); }
.kanban-card-title { font-weight:700; font-size:.8rem; margin-bottom:.25rem; }
.kanban-card-meta { font-size:.72rem; color:var(--text2); display:flex; gap:.5rem; flex-wrap:wrap; }
.kanban-card-revenue { font-size:.72rem; color:var(--green); font-weight:700; margin-top:.25rem; }
.sortable-ghost  { opacity:.35; background:var(--pink-bg) !important; }
.sortable-chosen { box-shadow:var(--shadow-l) !important; }

/* ---------- TASK LIST ---------- */
.task-list-header {
  display:flex; gap:.75rem; margin-bottom:1rem; flex-wrap:wrap;
  align-items:center;
}
.filter-group { display:flex; align-items:center; gap:.5rem; }
.filter-group label { font-size:.8rem; font-weight:600; color:var(--text2); white-space:nowrap; }
.task-list { display:flex; flex-direction:column; gap:.5rem; }
.task-row {
  display:flex; align-items:center; gap:.75rem;
  padding:.75rem 1rem; background:var(--surface);
  border-radius:var(--r-s); border:1.5px solid var(--border);
  transition:all .15s ease; cursor:pointer;
}
.task-row:hover { border-color:var(--pink); box-shadow:var(--shadow-s); }
.task-row.file-drag-over { border:2px dashed var(--green); background:var(--green-bg); }
.task-type-dot { width:8px; height:8px; border-radius:50%; flex-shrink:0; }
.task-type-dot.type-photo { background:var(--t-photo); }
.task-type-dot.type-live  { background:var(--t-live);  }
.task-type-dot.type-ad    { background:var(--t-ad);    }
.task-type-dot.type-event { background:var(--t-event); }
.task-info { flex:1; min-width:0; }
.task-title { font-weight:700; font-size:.875rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.task-meta { font-size:.775rem; color:var(--text2); display:flex; gap:.5rem; flex-wrap:wrap; margin-top:2px; }

.status-badge {
  padding:2px 8px; border-radius:999px;
  font-size:.7rem; font-weight:700; flex-shrink:0; white-space:nowrap;
}
.status-pending { background:var(--s-pending); color:var(--s-pending-t); }
.status-doing   { background:var(--s-doing);   color:var(--s-doing-t);   }
.status-script  { background:var(--s-script);  color:var(--s-script-t);  }
.status-shoot   { background:var(--s-shoot);   color:var(--s-shoot-t);   }
.status-review  { background:var(--s-review);  color:var(--s-review-t);  }
.status-publish { background:var(--s-publish); color:var(--s-publish-t); }
.status-done    { background:var(--s-done);    color:var(--s-done-t);    }

/* ---------- REPORTS ---------- */
.reports-header { margin-bottom:1rem; }
.reports-header h3 { font-size:1.1rem; font-weight:800; }
.reports-header p  { font-size:.8rem; color:var(--text2); margin-top:.25rem; }

.reports-grid {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(150px,1fr));
  gap:.75rem; margin-bottom:1.25rem;
}
.reports-grid-redesign .report-card { border:1.5px solid var(--border); }
.report-card {
  background:var(--surface); border-radius:var(--r-m);
  padding:1rem; border:1.5px solid var(--border);
}
.report-card-primary { background:var(--pink-bg); border-color:var(--pink-border); }
.report-label { font-size:.775rem; color:var(--text2); font-weight:600; margin-bottom:.4rem; }
.report-value { font-size:1.6rem; font-weight:800; }
.accent-green { color:var(--green); }
.accent-amber { color:var(--amber); }

.reports-row {
  display:grid; grid-template-columns:1fr 1fr;
  gap:.75rem; margin-bottom:.75rem;
}
.reports-row-redesign .card { border:1.5px solid var(--border); }
.chart-card { min-height:300px; }
.chart-shell { position:relative; height:220px; width:100%; }
.card {
  background:var(--surface); border-radius:var(--r-m);
  padding:1rem; border:1.5px solid var(--border);
}
.card h3 { font-size:.9rem; font-weight:700; margin-bottom:.875rem; }

.type-breakdown { display:flex; flex-direction:column; gap:.75rem; }
.type-bar-row   { display:flex; align-items:center; gap:.75rem; }
.type-bar-label { font-size:.775rem; color:var(--text2); min-width:100px; }
.type-bar-track { flex:1; height:6px; background:var(--surface2); border-radius:999px; overflow:hidden; }
.type-bar-fill  { height:100%; border-radius:999px; transition:width .4s ease; }

.payment-list { display:flex; flex-direction:column; gap:.5rem; }
.payment-item {
  display:flex; align-items:center; justify-content:space-between;
  padding:.625rem; border-radius:var(--r-s); background:var(--surface2);
}
.payment-info { flex:1; }
.payment-title  { font-weight:700; font-size:.8rem; }
.payment-amount { font-size:.775rem; color:var(--text2); }
.btn-paid {
  padding:3px 10px; border-radius:999px;
  font-size:.7rem; font-weight:700; border:none; cursor:pointer; transition:all .15s;
}
.btn-paid.is-paid  { background:var(--green); color:#fff; }
.btn-paid.not-paid { background:var(--surface2); color:var(--text2); border:1.5px solid var(--border); }
.btn-paid:hover    { transform:scale(1.05); }

/* ---------- PROFILE ---------- */
.profile-container { max-width:580px; }
.profile-header {
  display:flex; align-items:center; gap:1.25rem;
  margin-bottom:1.5rem; flex-wrap:wrap;
}
.profile-header h2 { font-size:1.25rem; font-weight:800; }
.role-badge {
  display:inline-block; padding:3px 10px; border-radius:999px;
  font-size:.7rem; font-weight:700; background:var(--pink-bg); color:var(--pink);
  border:1.5px solid var(--pink-border);
}
.profile-form { display:flex; flex-direction:column; gap:1rem; margin-bottom:1.5rem; }
.admin-panel { margin-top:2rem; }
.admin-panel h3 { font-size:1rem; font-weight:700; margin-bottom:1rem; }
.users-list { display:flex; flex-direction:column; gap:.5rem; }
.user-row {
  display:flex; align-items:center; gap:.75rem; padding:.625rem;
  background:var(--surface2); border-radius:var(--r-s);
}
.user-row img { width:32px; height:32px; border-radius:50%; }
.user-info { flex:1; min-width:0; }
.user-info-name  { font-weight:700; font-size:.8rem; }
.user-info-email { font-size:.72rem; color:var(--text2); }

/* ---------- MODAL ---------- */
.modal-overlay {
  position:fixed; inset:0;
  background:rgba(0,0,0,.5); backdrop-filter:blur(4px);
  display:none; align-items:center; justify-content:center;
  z-index:1000; padding:1rem;
}
.modal-overlay.visible { display:flex; }
.modal-content {
  background:var(--surface); border-radius:var(--r-xl);
  box-shadow:var(--shadow-l); width:100%; max-width:560px;
  max-height:90vh; display:flex; flex-direction:column;
  overflow:hidden; animation:modalIn .2s ease;
}
.modal-lg { max-width:800px; }
@keyframes modalIn {
  from { opacity:0; transform:translateY(16px) scale(.98); }
  to   { opacity:1; transform:translateY(0) scale(1); }
}
.modal-content::before { display:none; }
.modal-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:1.25rem 1.25rem 0; flex-shrink:0;
}
.modal-header h3 { font-size:1rem; font-weight:800; }
.modal-body {
  padding:1.25rem; overflow-y:auto; overflow-x:hidden;
  display:flex; flex-direction:column; gap:1rem;
  -webkit-overflow-scrolling:touch;
}
.modal-footer {
  display:flex; justify-content:space-between; align-items:center;
  padding-top:1rem; border-top:1.5px solid var(--border); margin-top:.5rem;
}
.modal-footer-right { display:flex; gap:.5rem; }

.preview-body {
  display:flex; align-items:center; justify-content:center; min-height:200px;
}
.preview-body img    { max-height:65vh; border-radius:var(--r-s); }
.preview-body iframe { width:100%; height:55vh; border:none; border-radius:var(--r-s); }

.detail-grid { display:grid; grid-template-columns:1fr 1fr; gap:.625rem; }
.detail-item {
  background:var(--surface2); border-radius:var(--r-s);
  padding:.625rem; border:1.5px solid var(--border);
}
.detail-item-full { grid-column:1 / -1; }
.detail-label { font-size:.75rem; font-weight:600; color:var(--text2); margin-bottom:.25rem; }
.detail-value { font-size:.875rem; color:var(--text); word-break:break-word; }

/* ---------- FILES ---------- */
.file-drop-zone {
  border:2px dashed var(--border); border-radius:var(--r-m);
  padding:1.5rem; text-align:center; color:var(--text3);
  transition:all .2s ease; cursor:pointer;
}
.file-drop-zone:hover,.file-drop-zone.drag-active {
  border-color:var(--pink); background:var(--pink-bg); color:var(--pink);
}
.file-drop-zone p { margin-top:.5rem; font-size:.8rem; }
.attachments-list { display:flex; flex-wrap:wrap; gap:.5rem; margin-top:.5rem; }
.attachment-item {
  display:flex; align-items:center; gap:.5rem; padding:.4rem .625rem;
  background:var(--surface2); border-radius:var(--r-s);
  font-size:.8rem; cursor:pointer; transition:all .12s;
  border:1.5px solid var(--border);
}
.attachment-item:hover { background:var(--bg); }
.attachment-thumb { width:28px; height:28px; border-radius:4px; object-fit:cover; background:var(--surface2); }
.attachment-remove { color:var(--text3); cursor:pointer; margin-left:.25rem; }
.attachment-remove:hover { color:var(--red); }
.link-input-group { display:flex; gap:.5rem; flex-wrap:wrap; }
.link-input-group input { flex:1; min-width:120px; }
.external-links { display:flex; flex-direction:column; gap:.5rem; margin-top:.5rem; }
.ext-link-item {
  display:flex; align-items:center; gap:.5rem; padding:.4rem;
  background:var(--surface2); border-radius:var(--r-s); font-size:.8rem;
}
.ext-link-item a { flex:1; }
.share-list { display:flex; flex-direction:column; gap:.5rem; margin-top:.5rem; }

/* ---------- TOAST ---------- */
.toast {
  position:fixed; bottom:calc(var(--nav-h) + 12px);
  left:50%; transform:translateX(-50%) translateY(80px);
  background:#12131a; color:#fff;
  padding:.625rem 1.25rem; border-radius:var(--r-s);
  font-size:.8rem; font-weight:600; box-shadow:var(--shadow-l);
  opacity:0; transition:all .25s ease; z-index:2000;
  white-space:nowrap; max-width:calc(100vw - 2rem); text-align:center;
}
.toast.visible { transform:translateX(-50%) translateY(0); opacity:1; }
.toast.error   { background:var(--red); }
.toast.success { background:var(--green); }
[data-theme="dark"] .toast { background:var(--surface2); border:1.5px solid var(--border); }

/* ---------- MOBILE NAV ---------- */
.mobile-nav {
  display:none; position:fixed; bottom:0; left:0; right:0;
  height:var(--nav-h); background:var(--surface);
  border-top:1.5px solid var(--border); z-index:100;
  padding:0 .5rem; align-items:center; justify-content:space-around;
  box-shadow:0 -4px 20px rgba(0,0,0,.07);
}
.mobile-nav-item {
  display:flex; flex-direction:column; align-items:center; gap:3px;
  padding:.4rem .75rem; border-radius:var(--r-s);
  color:var(--text3); font-size:.65rem; font-weight:600;
  transition:all .15s ease; flex:1; text-align:center;
  -webkit-tap-highlight-color:transparent;
}
.mobile-nav-item.active { color:var(--pink); }
.mobile-nav-item.active svg { stroke:var(--pink); }

/* ---------- MISC ---------- */
.loading-spinner {
  display:inline-block; width:20px; height:20px;
  border:2px solid var(--border); border-top-color:var(--pink);
  border-radius:50%; animation:spin .6s linear infinite;
}
@keyframes spin { to { transform:rotate(360deg); } }
.text-muted { color:var(--text2); font-size:.8rem; }

/* ---------- RESPONSIVE ---------- */
@media (max-width:768px) {
  body.logged-in .mobile-nav { display:flex; }

  .sidebar { transform:translateX(-100%); }
  .sidebar.open { transform:translateX(0); }
  .main-content { margin-left:0; }

  .top-bar { padding:0 .625rem; }
  .top-bar-left h2 { display:none; }
  .month-label { min-width:90px; font-size:.75rem; }
  .hide-xs { display:none; }
  #todayBtn { display:none; }

  .view-container { padding:.625rem; padding-bottom:calc(var(--nav-h) + .625rem); }

  /* Calendar compact */
  .calendar-grid,.calendar-weekdays { gap:2px; }
  .cal-day { min-height:56px; padding:2px 3px; }
  .cal-date { font-size:.6rem; }
  .cal-task { font-size:.55rem; padding:1px 3px; }
  .calendar-weekdays { font-size:.6rem; }

  /* Kanban accordion on mobile */
  .kanban-board { flex-direction:column; gap:.4rem; min-height:unset; }
  .kanban-col   { min-width:100%; max-width:100%; }
  .kanban-col-header { cursor:pointer; user-select:none; -webkit-user-select:none; }
  .kanban-list  { display:none; }
  .kanban-col.open .kanban-list { display:flex; }
  .kanban-chevron { transition:transform .2s ease; color:var(--text3); }
  .kanban-col.open .kanban-chevron { transform:rotate(180deg); }
  /* auto-open column that has tasks */
  .kanban-col:has(.kanban-list > *) { }


  /* Forms stack */
  .form-row         { flex-direction:column; }
  .link-input-group { flex-direction:column; }

  /* Reports */
  .reports-row  { grid-template-columns:1fr; }
  .reports-grid { grid-template-columns:repeat(2,1fr); gap:.5rem; }
  .report-value { font-size:1.25rem; }

  /* Modal — bottom sheet */
  .modal-overlay { padding:0; align-items:flex-end; }
  .modal-content {
    border-radius:var(--r-xl) var(--r-xl) 0 0;
    max-height:95vh; max-width:100%;
    animation:sheetUp .25s ease;
  }
  .modal-content::before {
    display:block; content:'';
    width:36px; height:4px; background:var(--border);
    border-radius:999px; margin:.75rem auto .25rem;
    flex-shrink:0;
  }
  @keyframes sheetUp {
    from { transform:translateY(40px); opacity:0; }
    to   { transform:translateY(0);    opacity:1; }
  }

  .detail-grid { grid-template-columns:1fr; }
  .toast { bottom:calc(var(--nav-h) + 10px); }
}

@media (min-width:769px) {
  .mobile-nav { display:none !important; }
  .view-container { padding-bottom:1.25rem; }
  .toast { bottom:1.5rem; left:auto; right:1.5rem; transform:translateY(60px); max-width:320px; }
  .toast.visible { transform:translateY(0); }
  [data-theme="dark"] .top-bar { background:rgba(13,14,23,.92); }
}
