/* ============================================================
   LogiTracker — Professional Logistics App Stylesheet
   PHP 7.1+ | Full Mobile Support
   ============================================================ */

:root {
  --primary:       #1B4F9C;
  --primary-dark:  #0f3570;
  --primary-light: #e8f0fc;
  --sidebar-bg:    #0d2b4e;
  --sidebar-w:     240px;
  --header-h:      56px;
  --content-bg:    #f0f2f7;
  --card-bg:       #ffffff;
  --border:        #e2e6ed;
  --text:          #1a2332;
  --text-muted:    #64748b;
  --text-light:    #94a3b8;
  --success:       #16a34a;
  --success-bg:    #f0fdf4;
  --warning:       #d97706;
  --warning-bg:    #fffbeb;
  --danger:        #dc2626;
  --danger-bg:     #fef2f2;
  --info:          #0891b2;
  --info-bg:       #ecfeff;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.08);
  --shadow:        0 4px 6px rgba(0,0,0,.07);
  --shadow-lg:     0 10px 25px rgba(0,0,0,.1);
  --radius:        8px;
  --radius-sm:     5px;
  --radius-lg:     12px;
  --font:          'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --transition:    .15s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--content-bg); color: var(--text); line-height: 1.5; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

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

/* ── Mobile sidebar overlay ── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.open { display: block; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.brand-icon {
  width: 34px; height: 34px;
  background: var(--primary); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
}
.brand-text { color: #fff; font-weight: 700; font-size: 1rem; line-height: 1.2; }
.brand-sub  { color: rgba(255,255,255,.45); font-size: .68rem; }
.sidebar-close-btn {
  display: none;
  margin-left: auto;
  background: none; border: none;
  color: rgba(255,255,255,.5);
  font-size: 1.1rem; cursor: pointer; padding: 4px 6px;
  border-radius: 4px;
}
.sidebar-close-btn:hover { color: #fff; background: rgba(255,255,255,.1); }

.sidebar-nav { padding: 10px 0; flex: 1; }
.nav-group-label {
  color: rgba(255,255,255,.28);
  font-size: .63rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  padding: 14px 18px 5px;
}
.nav-item a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px;
  color: rgba(255,255,255,.7); font-size: .86rem;
  transition: all var(--transition);
  position: relative;
}
.nav-item a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item a.active { background: rgba(255,255,255,.12); color: #fff; font-weight: 600; }
.nav-item a.active::before {
  content: ''; position: absolute; left: 0; top: 4px; bottom: 4px;
  width: 3px; background: #60a5fa; border-radius: 0 3px 3px 0;
}
.nav-icon { font-size: .95rem; width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto;
  background: var(--danger); color: #fff;
  font-size: .63rem; padding: 1px 6px; border-radius: 99px; font-weight: 700;
}
.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.08);
  color: rgba(255,255,255,.35); font-size: .68rem; text-align: center;
}

/* ── Main wrap ── */
.main-wrap { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* ── Topbar ── */
.topbar {
  background: var(--card-bg); border-bottom: 1px solid var(--border);
  height: var(--header-h);
  display: flex; align-items: center; padding: 0 22px; gap: 12px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.hamburger-btn { flex-shrink: 0; }
.hamburger-btn { width: 36px; height: 36px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; }
.ham-line {
  display: block; width: 22px; height: 2px;
  background: var(--text); border-radius: 2px;
  transition: all .2s;
}
.hamburger-btn:hover .ham-line { background: var(--primary); }

.topbar-title { font-size: .95rem; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-title small { font-weight: 400; color: var(--text-muted); margin-left: 6px; font-size: .78rem; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.btn-icon-only-mobile { display: none; }
.btn-text-desktop { display: inline; }

/* ── Content ── */
.page-content { padding: 22px; flex: 1; padding-bottom: 24px; overflow-x: hidden; }

/* ======================== CARDS ======================== */
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-header {
  padding: 13px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: .88rem;
}
.card-title { flex: 1; }
.card-body    { padding: 18px; }
.card-body-sm { padding: 13px 16px; }
.mb-16 { margin-bottom: 16px; }

/* ======================== STAT CARDS ======================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px; margin-bottom: 22px;
}
.stat-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--sc-color, var(--primary));
}
.stat-icon  { font-size: 1.4rem; display: block; margin-bottom: 6px; }
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--sc-color, var(--primary)); line-height: 1; }
.stat-label { font-size: .75rem; color: var(--text-muted); margin-top: 3px; }

/* ======================== BUTTONS ======================== */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 15px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: .85rem; font-weight: 500; cursor: pointer;
  transition: all var(--transition); line-height: 1.4; font-family: var(--font);
  white-space: nowrap; text-decoration: none; min-height: 34px;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary   { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: var(--card-bg); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: #f8fafc; border-color: var(--primary); color: var(--primary); }
.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; color: #fff; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--primary-light); color: var(--primary); }
.btn-sm   { padding: 4px 10px; font-size: .78rem; min-height: 28px; }
.btn-icon { padding: 5px 7px; }

/* ======================== BADGES ======================== */
.badge-status {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 99px;
  font-size: .73rem; font-weight: 600;
  background: var(--bs-bg); color: var(--bs-color); white-space: nowrap;
}
.badge-status .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.badge-priority {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  background: var(--bp-bg); color: var(--bp-color);
}
.badge-mini { display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: .7rem; font-weight: 600; }
.badge-tag  { display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: .7rem; background: var(--primary-light); color: var(--primary); font-weight: 500; }

/* ======================== TABLES ======================== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.data-table thead th {
  background: #f8fafc; color: var(--text-muted);
  font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  padding: 9px 13px; border-bottom: 2px solid var(--border); white-space: nowrap;
}
.data-table tbody td { padding: 10px 13px; border-bottom: 1px solid #f1f4f8; vertical-align: middle; }
.data-table tbody tr:hover { background: #fafcff; }
.data-table tbody tr:last-child td { border-bottom: none; }
.td-id   { font-family: monospace; font-size: .78rem; color: var(--text-muted); }
.td-name { font-weight: 600; }
.td-date { font-size: .8rem; white-space: nowrap; }
.td-num  { text-align: right; font-weight: 600; }

.progress-cell { min-width: 90px; }
.progress-bar-wrap { height: 5px; background: var(--border); border-radius: 99px; overflow: hidden; margin-top: 3px; }
.progress-bar-fill { height: 100%; border-radius: 99px; background: var(--primary); transition: width .4s; }
.progress-bar-fill.done { background: var(--success); }
.progress-label { font-size: .7rem; color: var(--text-muted); }

/* ======================== FORMS ======================== */
.form-section-title {
  font-size: .75rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 12px; margin-top: 4px;
}
.form-grid   { display: grid; gap: 14px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }
.form-group  { display: flex; flex-direction: column; gap: 5px; }

label.form-label { font-size: .8rem; font-weight: 600; color: var(--text); }
label.form-label .req { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%; padding: 8px 11px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: .875rem; font-family: var(--font); color: var(--text);
  background: var(--card-bg); transition: border-color var(--transition), box-shadow var(--transition);
  line-height: 1.5; -webkit-appearance: none; appearance: none;
}
.form-control:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27,79,156,.1);
}
.form-control::placeholder { color: var(--text-light); }
textarea.form-control { resize: vertical; min-height: 72px; }
select.form-control {
  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='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; padding-right: 28px;
}
.form-hint  { font-size: .73rem; color: var(--text-muted); margin-top: 2px; }
.form-actions { display: flex; gap: 10px; padding-top: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* ======================== TABS ======================== */
.tabs-nav { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 18px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tab-link {
  padding: 9px 16px; font-size: .83rem; font-weight: 500; color: var(--text-muted);
  cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all var(--transition); flex-shrink: 0;
}
.tab-link:hover { color: var(--primary); }
.tab-link.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ======================== CHECKLIST ======================== */
.checklist-list { display: flex; flex-direction: column; gap: 2px; }
.checklist-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: #fafbfd; border: 1px solid var(--border);
  transition: background var(--transition);
}
.checklist-item:hover { background: var(--primary-light); }
.checklist-item.done  { background: var(--success-bg); border-color: #bbf7d0; }
.checklist-item.done .chk-label { color: var(--text-muted); text-decoration: line-through; }
.chk-checkbox { width: 18px; height: 18px; cursor: pointer; accent-color: var(--success); flex-shrink: 0; }
.chk-num   { font-size: .7rem; color: var(--text-light); min-width: 18px; }
.chk-label { flex: 1; font-size: .875rem; }
.chk-meta  { font-size: .7rem; color: var(--text-muted); display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }

/* ======================== TIMELINE ======================== */
.timeline { position: relative; padding-left: 4px; }
.timeline::before { content: ''; position: absolute; left: 15px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { display: flex; gap: 12px; padding: 0 0 14px 0; position: relative; }
.tl-dot {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--card-bg); border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; flex-shrink: 0; z-index: 1;
}
.tl-dot.created   { border-color: var(--primary); background: var(--primary-light); }
.tl-dot.updated   { border-color: #a855f7; background: #faf5ff; }
.tl-dot.checklist { border-color: var(--success); background: var(--success-bg); }
.tl-dot.proposal  { border-color: var(--info); background: var(--info-bg); }
.tl-dot.incident  { border-color: var(--danger); background: var(--danger-bg); }
.tl-dot.note      { border-color: var(--warning); background: var(--warning-bg); }
.tl-content { flex: 1; padding-top: 4px; }
.tl-msg     { font-size: .86rem; }
.tl-meta    { font-size: .72rem; color: var(--text-muted); margin-top: 2px; }

/* ======================== PROPOSALS ======================== */
.proposal-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px 15px; background: #fafbfd; margin-bottom: 10px; }
.prop-header   { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; flex-wrap: wrap; }
.prop-type     { font-weight: 600; font-size: .875rem; }
.prop-body     { font-size: .84rem; color: var(--text-muted); }
.prop-footer   { margin-top: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ======================== INCIDENTS ======================== */
.incident-card { border-left: 3px solid var(--danger); background: var(--danger-bg); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 11px 14px; margin-bottom: 10px; }
.incident-card.resolved { border-left-color: var(--success); background: var(--success-bg); }
.inc-title  { font-weight: 600; font-size: .875rem; }
.inc-body   { font-size: .84rem; color: var(--text-muted); margin-top: 4px; }
.inc-footer { margin-top: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ======================== SEARCH & FILTERS ======================== */
.filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.search-box {
  display: flex; align-items: center;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0 10px; gap: 6px;
  flex: 1; min-width: 200px;
}
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(27,79,156,.1); }
.search-box input {
  border: none; outline: none; padding: 7px 4px;
  font-size: .875rem; width: 100%; font-family: var(--font);
  color: var(--text); background: transparent;
}
.filter-select {
  padding: 7px 26px 7px 9px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: .84rem; font-family: var(--font); color: var(--text);
  background: var(--card-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center;
  -webkit-appearance: none; appearance: none; cursor: pointer;
}
.filter-select:focus { outline: none; border-color: var(--primary); }
.status-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.status-tab {
  padding: 5px 12px; border-radius: 99px; border: 1px solid var(--border);
  font-size: .78rem; font-weight: 500; cursor: pointer; background: var(--card-bg);
  color: var(--text-muted); transition: all var(--transition); white-space: nowrap;
}
.status-tab:hover { border-color: var(--primary); color: var(--primary); }
.status-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ======================== DASHBOARD ======================== */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.dashboard-grid .col-full { grid-column: 1 / -1; }
.dashboard-grid .col-2    { grid-column: span 2; }

.upcoming-list { display: flex; flex-direction: column; gap: 8px; }
.upcoming-item { display: flex; align-items: center; gap: 10px; padding: 10px 13px; border-radius: var(--radius-sm); background: #fafbfd; border: 1px solid var(--border); font-size: .84rem; }
.ui-days { font-size: .78rem; font-weight: 700; padding: 3px 7px; border-radius: 4px; min-width: 46px; text-align: center; flex-shrink: 0; }
.ui-days.urgent { background: var(--danger-bg); color: var(--danger); }
.ui-days.soon   { background: var(--warning-bg); color: var(--warning); }
.ui-days.ok     { background: var(--success-bg); color: var(--success); }
.ui-name   { font-weight: 500; }
.ui-client { color: var(--text-muted); font-size: .76rem; }

/* ======================== ALERTS ======================== */
.alert { padding: 11px 15px; border-radius: var(--radius-sm); font-size: .875rem; display: flex; align-items: flex-start; gap: 8px; margin-bottom: 14px; }
.alert-warning { background: var(--warning-bg); color: #78350f; border-left: 3px solid var(--warning); }
.alert-danger  { background: var(--danger-bg);  color: #7f1d1d; border-left: 3px solid var(--danger); }
.alert-success { background: var(--success-bg); color: #14532d; border-left: 3px solid var(--success); }
.alert-info    { background: var(--info-bg);    color: #164e63; border-left: 3px solid var(--info); }

/* ======================== PROJECT HERO ======================== */
.project-hero { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 22px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.ph-top     { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.ph-info    { flex: 1; min-width: 200px; }
.ph-client  { font-size: .82rem; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.ph-name    { font-size: 1.25rem; font-weight: 700; margin-bottom: 8px; }
.ph-badges  { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.ph-actions { display: flex; gap: 7px; align-items: flex-start; flex-wrap: wrap; }
.ph-meta    { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.ph-meta-item  { display: flex; flex-direction: column; gap: 2px; }
.ph-meta-label { font-size: .7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.ph-meta-val   { font-size: .875rem; font-weight: 600; }
.ph-meta-val.late { color: var(--danger); }

/* ======================== EMPTY STATES ======================== */
.empty-state { text-align: center; padding: 44px 20px; color: var(--text-muted); }
.es-icon  { font-size: 2.8rem; display: block; margin-bottom: 10px; }
.es-title { font-size: .95rem; font-weight: 600; margin-bottom: 5px; color: var(--text); }
.es-text  { font-size: .875rem; margin-bottom: 14px; }

/* ======================== MODALS ======================== */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10,20,40,.45); z-index: 900; display: none; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(2px); }
.modal-backdrop.open { display: flex; }
.modal { background: var(--card-bg); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 540px; max-height: 90vh; display: flex; flex-direction: column; animation: modalIn .18s ease; }
.modal.modal-lg { max-width: 720px; }
@keyframes modalIn { from { opacity:0; transform: scale(.95) translateY(-10px); } to { opacity:1; transform: scale(1) translateY(0); } }
.modal-header { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.modal-title  { font-weight: 700; font-size: .95rem; flex: 1; }
.modal-body   { padding: 18px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 13px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ======================== PROJECT PANEL (detalle sin pestañas) ======================== */
.project-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.pp-header {
  display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap;
  padding: 20px 22px; border-bottom: 1px solid var(--border);
}
.pp-header-info  { flex: 1; min-width: 200px; }
.pp-header-actions { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; flex-shrink: 0; }

.pp-id-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.pp-id     { font-family: monospace; font-size: .78rem; color: var(--text-muted); }
.pp-name   { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; }
.pp-badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.pp-meta-bar {
  display: flex; gap: 0; flex-wrap: wrap;
  padding: 0; border-bottom: 1px solid var(--border);
}
.pp-meta-item {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 20px; border-right: 1px solid var(--border);
  min-width: 100px;
}
.pp-meta-item:last-child { border-right: none; }
.ppm-label { font-size: .68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.ppm-val   { font-size: .875rem; font-weight: 600; }
.ppm-val.late { color: var(--danger); }
.ppm-days  { font-size: .72rem; font-weight: 700; margin-left: 4px; }

.pp-path-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 22px; background: #fafbfd; border-bottom: 1px solid var(--border);
  font-size: .82rem;
}
.pp-path-code { font-family: monospace; font-size: .8rem; color: var(--text); background: var(--primary-light); padding: 2px 7px; border-radius: 3px; word-break: break-all; flex: 1; }
.pp-copy-btn  { flex-shrink: 0; }

.pp-section { padding: 20px 22px; border-bottom: 1px solid var(--border); }
.pp-section:last-child { border-bottom: none; }
.pp-section-compact { padding: 12px 22px; }
.pp-section-tracking { cursor: default; }
.pp-section-notes { display: flex; gap: 20px; flex-wrap: wrap; }
.pp-note-block { flex: 1; min-width: 200px; }

.pp-section-title {
  display: flex; align-items: center; gap: 10px;
  font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); margin-bottom: 14px;
}
.pp-toggle-title { cursor: pointer; user-select: none; margin-bottom: 0; }
.pp-toggle-title:hover { color: var(--primary); }
.pp-section-count { font-weight: 600; color: var(--text); text-transform: none; letter-spacing: 0; }

.pp-chk-hint { font-size: .72rem; color: var(--text-light); margin-top: 10px; }

/* ======================== PROPOSALS TABLE ======================== */
.prop-table {
  width: 100%; border-collapse: collapse;
  font-size: .84rem;
}
.prop-table thead th {
  background: #f8fafc; color: var(--text-muted);
  font-weight: 600; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em;
  padding: 8px 10px; border-bottom: 2px solid var(--border); white-space: nowrap;
}
.prop-table tbody td { padding: 8px 10px; border-bottom: 1px solid #f1f4f8; vertical-align: middle; }
.prop-table tbody tr:hover td { background: #fafcff; }
.prop-table tbody tr:last-child td { border-bottom: none; }
.prop-form-table .form-control { min-width: 80px; }

.prop-status-select {
  font-size: .75rem; padding: 3px 22px 3px 6px;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--card-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 5px center;
  -webkit-appearance: none; appearance: none; cursor: pointer;
}

/* ======================== FORM PANEL ======================== */
.form-panel { max-width: 820px; margin: 0 auto; }

/* ======================== CHECKLIST LABEL EDITING ======================== */
.chk-label[contenteditable="true"],
.chk-label.chk-label-editing {
  background: var(--primary-light);
  padding: 1px 6px;
  border-radius: 3px;
  outline: 2px solid var(--primary);
  cursor: text;
  color: var(--primary);
}

/* ======================== MISC ======================== */
.fc-sm { padding: 5px 8px; font-size: .82rem; }
.modal.modal-xl { max-width: 860px; }

/* ======================== MISC ======================== */
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.text-muted   { color: var(--text-muted); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.fw-600  { font-weight: 600; }
.fw-700  { font-weight: 700; }
.fs-sm   { font-size: .78rem; }
.ml-auto { margin-left: auto; }

/* Toast */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 7px; z-index: 9999; }
.toast {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 15px; box-shadow: var(--shadow-lg); font-size: .875rem;
  display: flex; align-items: center; gap: 9px; min-width: 250px; max-width: 340px;
  animation: toastIn .25s ease; border-left: 3px solid var(--primary);
}
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error   { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }
@keyframes toastIn { from { opacity:0; transform: translateX(40px); } to { opacity:1; transform: translateX(0); } }


/* ======================== SIDEBAR USER ======================== */
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.su-info  { flex: 1; min-width: 0; }
.su-name  { color: #fff; font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.su-role  { color: rgba(255,255,255,.45); font-size: .65rem; margin-top: 1px; }
.su-logout {
  color: rgba(255,255,255,.4); font-size: 1rem; text-decoration: none;
  padding: 4px 6px; border-radius: 4px; transition: all .15s; flex-shrink: 0;
}
.su-logout:hover { color: #f87171; background: rgba(239,68,68,.15); }

/* ======================== EMOJI BAR ======================== */
.emoji-bar {
  display: flex; flex-wrap: wrap; gap: 3px; align-items: center; margin-bottom: 8px;
}
.emoji-bar-label { font-size: .7rem; color: var(--text-muted); margin-right: 4px; white-space: nowrap; }
.emoji-btn {
  background: transparent; border: 1px solid var(--border); border-radius: 4px;
  padding: 2px 5px; font-size: .95rem; cursor: pointer; line-height: 1.3;
  transition: background .12s, border-color .12s; min-width: 28px; text-align: center;
}
.emoji-btn:hover { background: var(--primary-light); border-color: var(--primary); }
.canvas-emoji-bar { margin-bottom: 12px; padding: 8px 10px; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }

/* ======================== QUICK NOTE DELETE BTN ======================== */
.qn-del {
  position: absolute; top: 5px; right: 6px;
  background: none; border: none; color: rgba(0,0,0,.3);
  font-size: .68rem; cursor: pointer; padding: 2px 4px; border-radius: 3px;
  line-height: 1; transition: color .15s, background .15s; z-index: 2;
}
.qn-del:hover { color: #dc2626; background: rgba(220,38,38,.1); }
.qn-card { position: relative; } /* ensure positioning context */

/* ======================== MOBILE PROJECT CARDS ======================== */
.mobile-cards-list { display: none; flex-direction: column; gap: 0; }
.mobile-project-card {
  display: block; padding: 13px 16px; text-decoration: none; color: var(--text);
  border-bottom: 1px solid var(--border); transition: filter .15s;
}
.mobile-project-card:last-child { border-bottom: none; }
.mobile-project-card:active { filter: brightness(.96); }
.mpc-header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.mpc-name   { font-size: .9rem; font-weight: 700; margin-bottom: 2px; line-height: 1.3; }
.mpc-client { font-size: .75rem; color: var(--text-muted); }
.mpc-meta   { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; font-size: .78rem; }
.mpc-progress { display: flex; align-items: center; gap: 4px; }
.desktop-table { display: block; }

/* ======================== PIE CHARTS ======================== */
.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.chart-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.chart-title { font-size: .82rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 14px; }
.chart-inner { display: flex; align-items: center; gap: 20px; }
.chart-canvas-wrap { flex-shrink: 0; width: 140px; height: 140px; }
.chart-canvas-wrap canvas { width: 140px !important; height: 140px !important; }
.chart-legend { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.cl-item { display: flex; align-items: center; gap: 7px; font-size: .78rem; }
.cl-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.cl-label { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-val { margin-left: auto; font-weight: 600; color: var(--text); font-size: .8rem; }

/* ======================== PRINT ======================== */
@media print {
  .sidebar, .topbar, .topbar-actions, .btn, .modal-backdrop, .toast-wrap, .hamburger-btn { display: none !important; }
  .main-wrap { margin-left: 0 !important; }
  .page-content { padding: 0; }
  .card { box-shadow: none; }
}

/* ======================== DESKTOP (sidebar always visible) ======================== */
@media (min-width: 769px) {
  .sidebar { transform: none !important; }
  .sidebar-close-btn { display: none !important; }
  .hamburger-btn { display: none; }
}

@media (max-width: 1100px) {
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-grid .col-2 { grid-column: 1 / -1; }
}

/* ======================== MOBILE ======================== */
@media (max-width: 768px) {

  /* Sidebar becomes slide-in drawer */
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(-280px);
    width: 280px;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close-btn { display: block !important; }
  .main-wrap { margin-left: 0; }

  /* Topbar */
  .topbar { padding: 0 14px; gap: 10px; }
  .btn-icon-only-mobile { display: inline; }
  .btn-text-desktop     { display: none; }
  .topbar .btn-primary  { padding: 6px 10px; }

  /* Page padding */
  .page-content { padding: 14px; }

  /* Charts: 1 column */
  .charts-row { grid-template-columns: 1fr; }
  .chart-inner { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 14px; }
  .chart-canvas-wrap { width: 120px; height: 120px; }
  .chart-canvas-wrap canvas { width: 120px !important; height: 120px !important; }

  /* Stats: 2 columns */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
  .stat-card  { padding: 13px 14px; }
  .stat-icon  { font-size: 1.2rem; margin-bottom: 4px; }
  .stat-value { font-size: 1.6rem; }

  /* Dashboard: 1 column */
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-grid .col-2    { grid-column: 1; }
  .dashboard-grid .col-full { grid-column: 1; }

  /* Disable horizontal scroll hint on tables */
  .table-wrap { overflow-x: auto; }
  .data-table { min-width: 560px; }

  /* Forms: always 1 column */
  .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }

  /* Large touch targets — 44px iOS standard */
  .btn    { min-height: 42px; padding: 9px 14px; }
  .btn-sm { min-height: 34px; padding: 5px 10px; }
  .btn-icon { min-height: 36px; }
  .form-control { font-size: 16px !important; padding: 10px 12px; } /* 16px prevents iOS zoom */
  select.form-control { font-size: 16px !important; }
  .search-box input { font-size: 16px !important; }
  .filter-select { font-size: 16px !important; height: 42px; width: 100%; }
  .chk-checkbox { width: 22px; height: 22px; }

  /* Filter bar stacks vertically */
  .filter-bar { flex-direction: column; }
  .filter-bar .search-box { min-width: unset; }
  .filter-bar .btn-primary { align-self: stretch; text-align: center; justify-content: center; }

  /* Status tabs: horizontal scroll */
  .status-tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .status-tab  { flex-shrink: 0; }

  /* Card header wraps */
  .card-header { flex-wrap: wrap; gap: 8px; }

  /* Project hero */
  .project-hero { padding: 14px 16px; }
  .ph-top   { flex-direction: column; }
  .ph-name  { font-size: 1.1rem; }
  .ph-actions { flex-direction: row; flex-wrap: wrap; width: 100%; }
  .ph-actions .btn { flex: 1; justify-content: center; min-width: 80px; }
  .ph-meta  { gap: 12px; }
  .ph-meta-item { min-width: 42%; }

  /* Overview grid: 1 column on mobile */
  #tab-overview > div { grid-template-columns: 1fr !important; }

  /* Full-screen bottom-sheet modals */
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100%; width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 92vh;
  }
  .modal.modal-lg { max-width: 100%; }
  .modal-body { -webkit-overflow-scrolling: touch; }

  /* Timeline compact */
  .timeline::before { left: 13px; }
  .tl-dot   { width: 28px; height: 28px; font-size: .8rem; }
  .chk-meta { display: none; }

  /* Mobile project cards */
  .desktop-table { display: none !important; }
  .mobile-cards-list { display: flex; }
  .mpc-name { font-size: .88rem; }

  /* Emoji bar wraps */
  .emoji-bar { gap: 4px; }
  .emoji-btn { min-height: 34px; min-width: 34px; font-size: 1rem; }

  /* Upcoming */
  .upcoming-item { flex-wrap: wrap; }

  /* Toast full-width */
  .toast-wrap { bottom: 12px; left: 12px; right: 12px; }
  .toast { min-width: unset; max-width: unset; width: 100%; }
}

/* ======================== PROJECT PANEL — MOBILE ======================== */
@media (max-width: 768px) {
  .pp-header { padding: 14px 16px; }
  .pp-header-actions { width: 100%; }
  .pp-header-actions .btn { flex: 1; justify-content: center; }
  .pp-name { font-size: 1.05rem; }

  .pp-meta-bar { flex-direction: row; }
  .pp-meta-item { padding: 10px 14px; min-width: 45%; border-right: none; border-bottom: 1px solid var(--border); }
  .pp-meta-item:last-child { border-bottom: none; }

  .pp-path-bar { padding: 10px 16px; }
  .pp-path-code { font-size: .72rem; }

  .pp-section { padding: 16px; }
  .pp-section-compact { padding: 10px 16px; }
  .pp-section-notes { flex-direction: column; gap: 12px; }

  .form-panel { max-width: 100%; }

  /* Proposal table — only this scrolls */
  .prop-table { min-width: 480px; }
}

/* Extra small phones */
@media (max-width: 380px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-value { font-size: 1.4rem; }
  .page-content { padding: 10px; padding-bottom: 76px; }
  .pp-meta-item { min-width: 100%; }
}

/* ======================== MOBILE — CANVAS & QUICK NOTES ======================== */
@media (max-width: 768px) {
  /* Canvas board: 1 column, full width stickies, no rotation */
  .canvas-board {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .sticky {
    transform: none !important;
    min-height: 100px;
    border-radius: var(--radius);
  }
  .sticky:hover { transform: none !important; box-shadow: var(--shadow); }
  .sticky-toolbar { flex-wrap: wrap; gap: 4px; }
  .sticky-client-sel, .sticky-proj-sel {
    font-size: 14px !important;
    flex: 1;
    min-width: 0;
  }

  /* Canvas emoji bar: wrap on mobile */
  .canvas-emoji-bar { flex-wrap: wrap; }

  /* Quick notes wall: grid 2 columns on mobile */
  .qn-wall { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .qn-card { width: auto; transform: none !important; }
  .qn-card:hover { transform: none !important; }

  /* Filter bar selects: full width on mobile */
  .filter-bar { gap: 8px; }
  .filter-select { width: 100% !important; }

  /* Canvas header wraps */
  .canvas-board ~ script + div, .canvas-board { width: 100%; }

  /* Proposals table: horizontal scroll */
  .prop-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .prop-table { min-width: 420px; }

  /* Checklist meta hidden on very narrow screens */
  .chk-meta { font-size: .65rem; }
}

/* Hamburger always visible on mobile */

/* ======================== STICKY NOTES WALL ======================== */
.sticky-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
  align-items: start;
}

.sticky {
  position: relative;
  border-radius: 4px 4px 4px 0;
  padding: 14px 14px 10px;
  box-shadow: 3px 4px 10px rgba(0,0,0,.15), 1px 1px 3px rgba(0,0,0,.08);
  transform: rotate(var(--rot, 0deg));
  transition: transform .2s ease, box-shadow .2s ease;
  cursor: default;
  min-height: 140px;
  display: flex;
  flex-direction: column;
}
.sticky:hover {
  transform: rotate(0deg) scale(1.03);
  box-shadow: 5px 8px 18px rgba(0,0,0,.2);
  z-index: 2;
}

/* fold corner */
.sticky::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 18px; height: 18px;
  background: rgba(0,0,0,.12);
  clip-path: polygon(0 100%, 100% 100%, 0 0);
  border-radius: 0 0 0 4px;
}

.sticky-del {
  position: absolute;
  top: 6px; right: 7px;
  background: none; border: none;
  color: rgba(0,0,0,.3);
  font-size: .75rem; cursor: pointer;
  padding: 2px 5px; border-radius: 3px;
  line-height: 1; transition: color .15s, background .15s;
}
.sticky-del:hover { color: #dc2626; background: rgba(220,38,38,.1); }

.sticky-proj-ref {
  font-size: .65rem;
  margin-bottom: 6px;
  opacity: .75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sticky-proj-link {
  color: rgba(0,0,0,.55);
  text-decoration: underline dotted;
}
.sticky-proj-link:hover { color: rgba(0,0,0,.85); }

.sticky-body {
  flex: 1;
  font-size: .875rem;
  line-height: 1.5;
  color: rgba(0,0,0,.78);
  word-break: break-word;
  white-space: pre-wrap;
  outline: none;
  min-height: 60px;
  border-radius: 3px;
  padding: 2px 3px;
  margin: 0 -3px;
  transition: background .15s;
}
.sticky-body:focus {
  background: rgba(255,255,255,.45);
  box-shadow: 0 0 0 2px rgba(0,0,0,.12);
  cursor: text;
}

.sticky-foot {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: .62rem;
  opacity: .65;
  flex-wrap: wrap;
}
.sticky-client  { font-weight: 600; }
.sticky-creator { opacity: .75; }
.sticky-date    { margin-left: auto; white-space: nowrap; }

/* Add-new placeholder card */
.sticky-add {
  border: 2px dashed rgba(0,0,0,.2);
  background: transparent !important;
  box-shadow: none !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  min-height: 140px;
  border-radius: 6px;
  transition: border-color .15s, background .15s;
  transform: none !important;
}
.sticky-add::after { display: none; }
.sticky-add:hover { border-color: var(--primary); background: var(--primary-light) !important; }
.sticky-add-icon { font-size: 2rem; color: rgba(0,0,0,.25); line-height: 1; }
.sticky-add-label { font-size: .78rem; color: rgba(0,0,0,.35); font-weight: 600; }
.sticky-add:hover .sticky-add-icon,
.sticky-add:hover .sticky-add-label { color: var(--primary); }

/* Color swatches in note modal */
.note-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.note-swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .15s, border-color .15s;
  padding: 0;
}
.note-swatch:hover { transform: scale(1.15); }
.note-swatch.active { border-color: rgba(0,0,0,.5); transform: scale(1.1); }

/* Sticky notes responsive */
@media (max-width: 600px) {
  .sticky-wall { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 12px; }
  .sticky { min-height: 110px; }
}

/* ======================== QUICK NOTES WALL ======================== */
.qn-wall {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-start;
  padding-top: 4px;
}

.qn-card {
  width: 148px;
  min-height: 100px;
  padding: 12px 12px 8px;
  border-radius: 4px 4px 4px 0;
  box-shadow: 3px 4px 10px rgba(0,0,0,.14), 1px 1px 3px rgba(0,0,0,.07);
  transform: rotate(var(--rot, 0deg));
  transition: transform .2s ease, box-shadow .2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: default;
}

/* fold corner */
.qn-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 16px; height: 16px;
  background: rgba(0,0,0,.11);
  clip-path: polygon(0 100%, 100% 100%, 0 0);
  border-radius: 0 0 0 4px;
}

.qn-card:hover {
  transform: rotate(0deg) scale(1.05);
  box-shadow: 5px 8px 18px rgba(0,0,0,.2);
  z-index: 2;
}

.qn-text {
  font-size: .82rem;
  line-height: 1.5;
  color: rgba(0,0,0,.75);
  flex: 1;
  word-break: break-word;
  white-space: pre-wrap;
}

.qn-meta {
  font-size: .6rem;
  color: rgba(0,0,0,.45);
  border-top: 1px solid rgba(0,0,0,.09);
  padding-top: 5px;
  margin-top: auto;
}

/* ======================== CANVAS BOARD ======================== */
.canvas-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 20px;
  align-items: start;
}

/* Per-card toolbar */
.sticky-toolbar {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-bottom: 7px;
}

.sticky-proj-sel {
  flex: 1;
  min-width: 0;
  font-size: .63rem;
  border: none;
  background: rgba(0,0,0,.1);
  border-radius: 4px;
  padding: 2px 4px;
  color: rgba(0,0,0,.6);
  cursor: pointer;
  outline: none;
  font-family: var(--font);
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sticky-proj-sel:focus { background: rgba(0,0,0,.15); }

.sticky-color-btn {
  background: none; border: none;
  cursor: pointer; padding: 2px 4px;
  border-radius: 3px; font-size: .85rem; line-height: 1;
  opacity: .55; transition: opacity .15s, background .15s;
  flex-shrink: 0;
}
.sticky-color-btn:hover { opacity: 1; background: rgba(0,0,0,.1); }

.sticky-vis-btn {
  background: none; border: none;
  cursor: pointer; padding: 2px 4px;
  border-radius: 3px; font-size: .82rem; line-height: 1;
  opacity: .55; transition: opacity .15s, background .15s;
  flex-shrink: 0;
}
.sticky-vis-btn:hover { opacity: 1; background: rgba(0,0,0,.1); }
.sticky-priv { font-size: .7rem; opacity: .8; }

/* Palette */
.sticky-palette {
  display: none;
  flex-wrap: wrap;
  gap: 5px;
  padding: 8px;
  background: rgba(255,255,255,.9);
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,.1);
  margin-bottom: 8px;
  box-shadow: 0 3px 10px rgba(0,0,0,.15);
}
.pal-swatch {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer; padding: 0;
  flex-shrink: 0;
  transition: transform .12s, border-color .12s;
}
.pal-swatch:hover { transform: scale(1.25); border-color: rgba(0,0,0,.35); }

/* Empty body placeholder via CSS */
.sticky-body[data-placeholder]:empty:not(:focus)::before {
  content: attr(data-placeholder);
  color: rgba(0,0,0,.28);
  pointer-events: none;
  font-style: italic;
}

/* Mini canvas notes in project view */
.canvas-mini-wall {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.sticky-mini {
  width: 145px !important;
  min-height: 80px !important;
  max-width: 145px;
  padding: 10px 10px 8px !important;
  transform: rotate(var(--rot, 0deg));
  flex-shrink: 0;
}
.sticky-mini:hover { transform: rotate(0deg) scale(1.04); }

@media (max-width: 600px) {
  .canvas-board { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 12px; }
}
