/* =========================================================
   GLOBAL FORMZ — App shell styles (dashboards, auth pages)
   Extends css/style.css design tokens.
   ========================================================= */

body.app{ background:var(--beige); }

/* ---- Auth pages (login/signup) ---- */
.auth-shell{ min-height:100vh; display:grid; grid-template-columns:1fr 1fr; }
.auth-panel{ display:flex; align-items:center; justify-content:center; padding:40px; }
.auth-side{ background:linear-gradient(160deg,var(--forest) 0%, var(--navy-2) 100%); color:var(--beige); display:flex; flex-direction:column; justify-content:center; padding:60px; position:relative; overflow:hidden; }
.auth-side h2{ color:var(--white); font-size:1.7rem; max-width:16ch; }
.auth-side p{ color:#C7CEDD; max-width:38ch; }
.auth-card{ width:100%; max-width:400px; }
.auth-card .brand{ margin-bottom:28px; }
.auth-card h1{ font-size:1.5rem; margin-bottom:6px; }
.auth-card .sub{ font-size:.9rem; color:var(--ink-soft); margin-bottom:26px; }
.auth-switch{ text-align:center; margin-top:20px; font-size:.88rem; color:var(--ink-soft); }
.auth-switch a{ color:var(--teal); font-weight:600; }
.auth-error{ background:#FBE4E0; color:#9A3412; border-radius:var(--radius-sm); padding:12px 14px; font-size:.85rem; margin-bottom:16px; display:none; align-items:center; gap:8px; }
.auth-error.show{ display:flex; }
.auth-tabs{ display:flex; gap:4px; background:var(--beige-2); border-radius:999px; padding:4px; margin-bottom:26px; }
.auth-tabs a{ flex:1; text-align:center; padding:9px; border-radius:999px; font-size:.85rem; font-weight:600; color:var(--ink-soft); }
.auth-tabs a.active{ background:var(--navy); color:var(--white); }
@media (max-width:880px){ .auth-shell{ grid-template-columns:1fr; } .auth-side{ display:none; } }

/* ---- App shell (dashboards) ---- */
.app-shell{ display:grid; grid-template-columns:260px 1fr; min-height:100vh; }
.app-sidebar{ background:var(--forest); color:#C7CEDD; padding:26px 18px; display:flex; flex-direction:column; position:sticky; top:0; height:100vh; overflow:hidden; }
.app-sidebar > .brand{ flex-shrink:0; }
.app-sidebar-foot{ flex-shrink:0; }
.app-sidebar .brand{ color:var(--white); font-size:1.1rem; margin-bottom:30px; padding:0 8px; }
.app-nav{ display:flex; flex-direction:column; gap:2px; flex-grow:1; overflow-y:auto; min-height:0; scrollbar-width:thin; scrollbar-color:rgba(255,255,255,.25) transparent; }
.app-nav::-webkit-scrollbar{ width:5px; }
.app-nav::-webkit-scrollbar-thumb{ background:rgba(255,255,255,.2); border-radius:3px; }
.app-nav button{
  display:flex; align-items:center; gap:12px; padding:11px 12px; border-radius:10px; border:0; background:none;
  color:#C7CEDD; font-family:var(--font-body); font-size:.9rem; font-weight:600; text-align:left; cursor:pointer; width:100%;
}
.app-nav button svg{ width:18px; height:18px; flex-shrink:0; }
.app-nav button:hover{ background:rgba(255,255,255,.06); color:var(--white); }
.app-nav button.active{ background:var(--gold); color:var(--navy); }
.app-sidebar-foot{ border-top:1px solid rgba(255,255,255,.12); padding-top:16px; margin-top:16px; }
.app-user{ display:flex; align-items:center; gap:10px; padding:0 8px 12px; }
.app-user .avatar-initial{ background:var(--gold); color:var(--navy); }
.app-user .who{ min-width:0; }
.app-user .name{ font-size:.86rem; font-weight:700; color:var(--white); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.app-user .role{ font-size:.72rem; color:#8E9AB5; text-transform:uppercase; letter-spacing:.04em; }
.app-logout{ width:100%; }

.app-main{ padding:34px 40px; max-width:1180px; }
.app-topbar{ display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:28px; flex-wrap:wrap; gap:14px; }
.app-topbar h1{ font-size:1.6rem; margin-bottom:4px; }
.app-topbar p{ margin:0; font-size:.92rem; }

.app-panel{ display:none; }
.app-panel.active{ display:block; }
.cd-panel{ display:none; }
.cd-panel.active{ display:block; }

/* Mobile app shell */
.app-topnav{ display:none; }
@media (max-width:940px){
  .app-shell{ grid-template-columns:1fr; }
  .app-sidebar{ position:fixed; left:-280px; top:0; width:260px; z-index:200; transition:left .2s ease; box-shadow:var(--shadow-lift); }
  .app-sidebar.open{ left:0; }
  .app-main{ padding:20px; padding-top:76px; }
  .app-topnav{ display:flex; align-items:center; justify-content:space-between; position:fixed; top:0; left:0; right:0; height:60px; background:var(--navy); color:var(--white); padding:0 16px; z-index:150; }
  .app-topnav .brand{ color:var(--white); font-size:1rem; }
  .app-topnav button{ background:none; border:0; color:var(--white); padding:6px; }
  .app-sidebar-backdrop{ display:none; position:fixed; inset:0; background:rgba(22,35,63,.4); z-index:190; }
  .app-sidebar-backdrop.show{ display:block; }
}

/* ---- Stat cards ---- */
.stat-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:18px; margin-bottom:32px; }
.stat-card{ background:var(--white); border-radius:var(--radius-md); padding:20px 22px; box-shadow:var(--shadow-soft); }
.stat-card .num{ font-family:var(--font-display); font-size:1.9rem; color:var(--navy); font-weight:600; }
.stat-card .label{ font-size:.8rem; color:var(--ink-soft); font-weight:600; }
@media (max-width:940px){ .stat-grid{ grid-template-columns:1fr 1fr; } }

/* ---- Tabs (within a panel) ---- */
.subtabs{ display:flex; gap:8px; margin-bottom:22px; flex-wrap:wrap; border-bottom:1px solid var(--line); }
.subtabs button{ background:none; border:0; border-bottom:2px solid transparent; padding:10px 4px; margin-right:18px; font-weight:700; font-size:.9rem; color:var(--ink-soft); cursor:pointer; }
.subtabs button.active{ color:var(--navy); border-bottom-color:var(--gold); }

/* ---- Data table ---- */
.data-table{ width:100%; border-collapse:collapse; background:var(--white); border-radius:var(--radius-md); overflow:hidden; box-shadow:var(--shadow-soft); }
.data-table th{ text-align:left; font-size:.72rem; text-transform:uppercase; letter-spacing:.04em; color:var(--ink-soft); background:var(--beige-2); padding:12px 16px; }
.data-table td{ padding:14px 16px; font-size:.88rem; border-top:1px solid var(--beige-2); vertical-align:middle; }
.data-table tr:hover td{ background:var(--teal-pale); cursor:pointer; }
.data-table .mono{ font-size:.8rem; }
.table-scroll{ overflow-x:auto; }
.status-select{ font-size:.76rem; font-weight:700; padding:5px 10px; border-radius:999px; border:1.5px solid var(--line); background:var(--white); cursor:pointer; }

/* ---- Task/customer detail card ---- */
.detail-card{ background:var(--white); border-radius:var(--radius-md); box-shadow:var(--shadow-soft); padding:26px; margin-bottom:20px; }
.detail-head{ display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:16px; flex-wrap:wrap; gap:12px; }
.checklist-row{ display:flex; align-items:center; gap:12px; padding:11px 0; border-bottom:1px solid var(--beige-2); font-size:.9rem; }
.checklist-row:last-child{ border-bottom:0; }
.checklist-row input[type="checkbox"]{ width:18px; height:18px; accent-color:var(--teal); }
.checklist-row.done span{ text-decoration:line-through; color:var(--ink-soft); }

/* ---- Upload dropzone ---- */
.dropzone{
  border:2px dashed var(--line); border-radius:var(--radius-md); padding:30px; text-align:center;
  background:var(--beige); cursor:pointer; transition:border-color .2s ease, background .2s ease;
}
.dropzone:hover, .dropzone.drag{ border-color:var(--teal); background:var(--teal-pale); }
.dropzone svg{ width:34px; height:34px; color:var(--teal); margin:0 auto 10px; }
.dropzone .hint{ font-size:.78rem; color:var(--ink-soft); }
.doc-list{ margin-top:16px; display:flex; flex-direction:column; gap:10px; }
.doc-row{ display:flex; align-items:center; gap:12px; background:var(--beige); border-radius:var(--radius-sm); padding:12px 14px; }
.doc-row svg{ width:20px; height:20px; color:var(--teal); flex-shrink:0; }
.doc-row .meta{ flex-grow:1; min-width:0; }
.doc-row .fname{ font-size:.88rem; font-weight:600; color:var(--navy); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.doc-row .fdetail{ font-size:.76rem; color:var(--ink-soft); }
.doc-row .remove{ background:none; border:0; color:var(--ink-soft); cursor:pointer; font-size:1.1rem; line-height:1; padding:4px; }

/* ---- Messages ---- */
.msg-thread{ display:flex; flex-direction:column; gap:12px; max-height:420px; overflow-y:auto; padding:4px 4px 10px; }
.msg-bubble{ max-width:78%; padding:12px 16px; border-radius:14px; font-size:.9rem; }
.msg-bubble.me{ align-self:flex-end; background:var(--navy); color:var(--white); border-bottom-right-radius:4px; }
.msg-bubble.them{ align-self:flex-start; background:var(--beige); color:var(--ink); border-bottom-left-radius:4px; }
.msg-meta{ font-size:.72rem; opacity:.7; margin-bottom:4px; }
.msg-input-row{ display:flex; gap:10px; margin-top:14px; }
.msg-input-row input{ flex-grow:1; }

/* ---- Modal ---- */
.modal-backdrop{ position:fixed; inset:0; background:rgba(22,35,63,.45); display:none; align-items:center; justify-content:center; z-index:300; padding:20px; }
.modal-backdrop.show{ display:flex; }
.modal{ background:var(--white); border-radius:var(--radius-md); max-width:480px; width:100%; padding:28px; box-shadow:var(--shadow-lift); max-height:88vh; overflow-y:auto; }
.modal-head{ display:flex; justify-content:space-between; align-items:center; margin-bottom:18px; }
.modal-close{ background:none; border:0; font-size:1.3rem; cursor:pointer; color:var(--ink-soft); line-height:1; }

/* ---- Alerts / toasts ---- */
.alert{ display:flex; gap:10px; align-items:flex-start; padding:14px 16px; border-radius:var(--radius-sm); font-size:.86rem; margin-bottom:18px; }
.alert svg{ width:18px; height:18px; flex-shrink:0; margin-top:1px; }
.alert-success{ background:var(--teal-pale); color:var(--teal); }
.alert-info{ background:#E6ECFB; color:#33499E; }
.alert-warn{ background:#FBF0DC; color:#95701C; }

.empty-state{ text-align:center; padding:50px 20px; color:var(--ink-soft); }
.empty-state svg{ width:44px; height:44px; color:var(--line); margin:0 auto 14px; }

/* ---- Staff/Admin portal distinct theme ---- */
.staff-auth .auth-panel{ background:var(--navy); }
.staff-auth .auth-card .brand{ color:var(--white); }
.staff-auth .auth-card h1{ color:var(--white); }
.staff-auth .auth-card .sub{ color:#9AA6C2; }
.staff-auth .field label{ color:#C7CEDD; }
.staff-auth .field input, .staff-auth .field select{ background:rgba(255,255,255,.06); border-color:rgba(255,255,255,.18); color:var(--white); }
.staff-auth .field input::placeholder{ color:#6B7695; }
.staff-auth .field input:focus{ border-color:var(--gold); box-shadow:0 0 0 3px rgba(200,155,60,.18); }
.staff-auth .auth-switch{ color:#9AA6C2; }
.staff-auth .auth-switch a{ color:var(--gold); }
.staff-auth .mono{ color:var(--gold); }
.staff-auth .auth-side{ background:linear-gradient(160deg,var(--beige) 0%, var(--beige-2) 100%); color:var(--ink); }
.staff-auth .auth-side .eyebrow{ color:var(--teal); }
.staff-auth .auth-side h2{ color:var(--navy); }
.staff-auth .auth-side p{ color:var(--ink-soft); }
.staff-badge{ display:inline-flex; align-items:center; gap:6px; background:rgba(200,155,60,.14); color:var(--gold); border:1px solid rgba(200,155,60,.35); padding:5px 12px; border-radius:999px; font-family:var(--font-mono); font-size:.7rem; letter-spacing:.06em; text-transform:uppercase; margin-bottom:18px; }
.demo-banner{ background:#FBF0DC; color:#7A5A0F; font-size:.78rem; text-align:center; padding:8px 16px; font-weight:600; }
.demo-banner a{ text-decoration:underline; }

/* ---- Settings / admin area ---- */
.st-panel{ display:none; }
.st-panel.active{ display:block; }
.mkt-panel{ display:none; }
.mkt-panel.active{ display:block; }
.perm-badge{ display:inline-flex; align-items:center; gap:5px; padding:3px 10px; border-radius:999px; font-size:.72rem; font-weight:700; }
.perm-badge.admin{ background:rgba(200,155,60,.16); color:#8A6512; }
.perm-badge.staff{ background:var(--teal-pale); color:var(--teal); }
.perm-badge.inactive{ background:#FBE4E0; color:#9A3412; }

.plugin-card{ background:var(--white); border-radius:var(--radius-md); padding:20px; box-shadow:var(--shadow-soft); }
.plugin-card-head{ display:flex; justify-content:space-between; align-items:flex-start; gap:10px; margin-bottom:8px; }
.plugin-card h4{ font-size:1rem; color:var(--navy); margin:0 0 4px; }
.plugin-card .cat{ font-size:.7rem; text-transform:uppercase; letter-spacing:.04em; color:var(--teal); font-weight:700; }
.plugin-card p{ font-size:.85rem; margin-bottom:14px; }
.plugin-card-actions{ display:flex; gap:8px; align-items:center; justify-content:space-between; }

/* Toggle switch */
.toggle-switch{ position:relative; display:inline-block; width:42px; height:24px; flex-shrink:0; }
.toggle-switch input{ opacity:0; width:0; height:0; }
.toggle-slider{ position:absolute; cursor:pointer; inset:0; background:var(--line); border-radius:999px; transition:background .2s ease; }
.toggle-slider::before{ content:""; position:absolute; height:18px; width:18px; left:3px; top:3px; background:white; border-radius:50%; transition:transform .2s ease; box-shadow:0 1px 3px rgba(0,0,0,.25); }
.toggle-switch input:checked + .toggle-slider{ background:var(--teal); }
.toggle-switch input:checked + .toggle-slider::before{ transform:translateX(18px); }

.media-card{ background:var(--white); border-radius:var(--radius-sm); overflow:hidden; box-shadow:var(--shadow-soft); position:relative; }
.media-card img{ width:100%; height:100px; object-fit:cover; display:block; background:var(--beige-2); }
.media-card .media-file-icon{ width:100%; height:100px; display:flex; align-items:center; justify-content:center; background:var(--beige-2); color:var(--teal); }
.media-card .media-meta{ padding:8px 10px; }
.media-card .media-name{ font-size:.76rem; font-weight:600; color:var(--navy); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.media-card .media-size{ font-size:.7rem; color:var(--ink-soft); }
.media-card .media-remove{ position:absolute; top:6px; right:6px; width:22px; height:22px; border-radius:50%; background:rgba(22,35,63,.75); color:white; border:0; cursor:pointer; font-size:.9rem; line-height:1; }

/* ---- Moderation notification badges ---- */
.nav-badge{
  display:inline-flex; align-items:center; justify-content:center; min-width:18px; height:18px; padding:0 5px;
  background:#B5401E; color:white; border-radius:999px; font-size:.68rem; font-weight:800; margin-left:auto;
}
.app-nav button{ justify-content:flex-start; }
.settings-tab .nav-badge{ margin-left:6px; }

/* ---- WordPress-style list-table search box ---- */
.wp-search-box{
  width:100%; max-width:340px; padding:9px 14px; margin-bottom:16px;
  border:1.5px solid var(--line); border-radius:8px; font-size:.88rem; background:var(--white);
}
.wp-search-box:focus{ border-color:var(--teal); outline:none; box-shadow:0 0 0 3px var(--teal-pale); }
