/* GB7 SYNQ — shared design system (plain CSS, no build step).
   Brand tokens: background #FFFFFF, primary #978688, foreground #333333.
   primary-strong (#7E6E70) is used for text/icons that need AA contrast —
   see docs/ARCHITECTURE.md in the original TS prototype for the rationale. */

:root {
  --background: #FFFFFF;
  --foreground: #333333;
  --card: #FFFFFF;
  --primary: #978688;
  --primary-strong: #7E6E70;
  --primary-foreground: #FFFFFF;
  --muted: #F8F4F4;
  --muted-foreground: #737373;
  --accent: #F0E8E9;
  --accent-foreground: #655759;
  --border: #E1D2D3;
  --destructive: #B3413F;
  --destructive-bg: #FBEAEA;
  --success: #3F7A52;
  --success-bg: #EAF3EC;
  --warning: #A9762A;
  --warning-bg: #FBF1E3;
  --radius: 0.5rem;
  --shadow-sm: 0 1px 3px 0 rgb(51 44 45 / 0.06), 0 1px 2px -1px rgb(51 44 45 / 0.06);
  --shadow-md: 0 4px 8px -2px rgb(51 44 45 / 0.06), 0 2px 4px -2px rgb(51 44 45 / 0.04);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5em; font-weight: 600; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2px solid var(--primary-strong); outline-offset: 2px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--primary-strong);
  color: #fff; padding: 0.75rem 1rem; z-index: 1000; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* Layout */
.container { max-width: 1120px; margin: 0 auto; padding: 0 1.5rem; }
.container-narrow { max-width: 720px; margin: 0 auto; padding: 0 1.5rem; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; align-items: center; gap: 0.75rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-5 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* App shell (product apps) */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
  width: 250px; flex-shrink: 0; background: var(--card); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 0.75rem;
}
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
  height: 3.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center;
  justify-content: space-between; padding: 0 1rem; gap: 1rem; background: var(--background);
}
.app-content { flex: 1; overflow-y: auto; padding: 1.5rem; }
.brand-mark { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem; font-weight: 700; color: var(--foreground); }
.brand-mark .dot { width: 1.75rem; height: 1.75rem; border-radius: 0.5rem; background: var(--primary-strong); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 700; }
.nav-section { margin-top: 1rem; }
.nav-section-title { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted-foreground); padding: 0 0.5rem; margin-bottom: 0.35rem; }
.nav-link {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.6rem; border-radius: var(--radius);
  color: var(--foreground); font-size: 0.9rem;
}
.nav-link:hover { background: var(--accent); text-decoration: none; }
.nav-link.active { background: var(--accent); color: var(--accent-foreground); font-weight: 600; }

/* Product switcher: Microsoft-365-style clickable icon tiles */
.product-switcher { display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0 0.15rem; }
.product-tile {
  display: flex; flex-direction: column; align-items: center; gap: 0.25rem;
  width: 56px; padding: 0.4rem 0.1rem 0.35rem; border-radius: 0.6rem;
  color: var(--foreground); text-align: center;
}
.product-tile:hover { background: var(--accent); text-decoration: none; }
.product-tile.active { background: var(--accent); }
.product-tile.active .product-tile-label { color: var(--accent-foreground); font-weight: 600; }
.product-tile-icon {
  width: 38px; height: 38px; border-radius: 0.65rem; color: #fff;
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm);
}
.product-tile-icon svg { width: 20px; height: 20px; }
.product-tile-label { font-size: 0.68rem; line-height: 1.1; }

@media (max-width: 800px) {
  .app-sidebar { position: fixed; inset: 0 auto 0 0; transform: translateX(-100%); z-index: 40; transition: transform .15s ease; }
  .app-sidebar.open { transform: translateX(0); }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.55rem 1rem; border-radius: var(--radius); font-size: 0.9rem; font-weight: 500;
  border: 1px solid transparent; cursor: pointer; background: var(--primary-strong); color: #fff;
  line-height: 1.2; white-space: nowrap;
}
.btn:hover { background: #6b5d5f; text-decoration: none; }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.82rem; }
.btn-secondary { background: var(--muted); color: var(--foreground); border-color: var(--border); }
.btn-secondary:hover { background: var(--accent); }
.btn-outline { background: transparent; color: var(--foreground); border-color: var(--border); }
.btn-outline:hover { background: var(--accent); }
.btn-destructive { background: var(--destructive); color: #fff; }
.btn-destructive:hover { background: #8f3230; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* Forms */
label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 0.3rem; }
.form-group { margin-bottom: 1.1rem; }
.form-hint { font-size: 0.8rem; color: var(--muted-foreground); margin-top: 0.3rem; }
.form-error { font-size: 0.8rem; color: var(--destructive); margin-top: 0.3rem; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number],
input[type=search], input[type=url], select, textarea {
  width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 0.92rem; font-family: inherit; color: var(--foreground); background: var(--background);
}
textarea { min-height: 6rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary-strong); box-shadow: 0 0 0 3px rgb(126 110 112 / 0.15); }
.checkbox-row { display: flex; align-items: flex-start; gap: 0.5rem; }
.checkbox-row input { width: auto; margin-top: 0.2rem; }
.checkbox-row label { margin: 0; font-weight: 400; }
fieldset { border: none; padding: 0; margin: 0; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 0.75rem; padding: 1.25rem; box-shadow: var(--shadow-sm); }
.card-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; }
.card-desc { color: var(--muted-foreground); font-size: 0.88rem; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.72rem; font-weight: 600; background: var(--accent); color: var(--accent-foreground); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-destructive { background: var(--destructive-bg); color: var(--destructive); }
.badge-outline { background: transparent; border: 1px solid var(--border); color: var(--foreground); }

/* Alerts / flash messages */
.alert { padding: 0.85rem 1rem; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 1rem; font-size: 0.9rem; }
.alert-success { background: var(--success-bg); color: var(--success); border-color: transparent; }
.alert-error { background: var(--destructive-bg); color: var(--destructive); border-color: transparent; }
.alert-info { background: var(--muted); color: var(--foreground); }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted-foreground); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
.table-scroll { overflow-x: auto; }
.table-actions { white-space: nowrap; }
tr:hover td { background: var(--muted); }

/* Empty state */
.empty-state { text-align: center; padding: 3.5rem 1.5rem; border: 1px dashed var(--border); border-radius: 0.75rem; color: var(--muted-foreground); }
.empty-state h3 { color: var(--foreground); margin-bottom: 0.4rem; }

/* Marketing site */
.site-header { border-bottom: 1px solid var(--border); position: sticky; top: 0; background: rgba(255,255,255,0.9); backdrop-filter: blur(6px); z-index: 30; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 4rem; }
.site-nav { display: flex; gap: 1.5rem; align-items: center; }
.site-nav a { color: var(--foreground); font-size: 0.92rem; }
.hero { padding: 5rem 0 4rem; text-align: center; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
.hero p { max-width: 640px; margin: 0 auto 1.75rem; color: var(--muted-foreground); font-size: 1.1rem; }
.hero-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.browser-frame { border: 1px solid var(--border); border-radius: 0.9rem; overflow: hidden; box-shadow: var(--shadow-md); margin-top: 3rem; }
.browser-frame .bar { background: var(--muted); padding: 0.6rem 0.85rem; display: flex; gap: 0.4rem; }
.browser-frame .bar span { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--border); }
.browser-frame .body { padding: 1.5rem; background: var(--background); }
section.page-section { padding: 4rem 0; }
section.page-section.alt { background: var(--muted); }
.section-heading { text-align: center; max-width: 640px; margin: 0 auto 2.5rem; }
.section-heading p { color: var(--muted-foreground); }
.site-footer { border-top: 1px solid var(--border); padding: 3rem 0; margin-top: 3rem; color: var(--muted-foreground); font-size: 0.88rem; }
.site-footer .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 2rem; margin-bottom: 2rem; }
.site-footer h4 { color: var(--foreground); font-size: 0.85rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }

/* Auth pages */
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem; background: var(--muted); }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--border); border-radius: 0.9rem; padding: 2rem; box-shadow: var(--shadow-md); }
.auth-card h1 { font-size: 1.4rem; margin-bottom: 0.25rem; }
.auth-card .subtitle { color: var(--muted-foreground); font-size: 0.88rem; margin-bottom: 1.5rem; }
.auth-links { text-align: center; margin-top: 1.25rem; font-size: 0.85rem; }
.divider { display: flex; align-items: center; gap: 0.75rem; margin: 1.25rem 0; color: var(--muted-foreground); font-size: 0.8rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* Board (Flow) */
.board { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 1rem; }
.board-col { flex: 0 0 260px; background: var(--muted); border-radius: 0.75rem; padding: 0.75rem; }
.board-col h3 { font-size: 0.82rem; text-transform: uppercase; color: var(--muted-foreground); margin-bottom: 0.75rem; }
.task-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.65rem 0.75rem; margin-bottom: 0.6rem; font-size: 0.87rem; }
.task-card:hover { border-color: var(--primary); }

/* Flow — filters, pagination, calendar, timeline */
.filter-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 0.75rem; margin-bottom: 1.25rem; padding: 1rem; background: var(--muted); border-radius: 0.75rem; }
.filter-bar .form-group { margin-bottom: 0; min-width: 140px; }
.filter-bar label { margin-bottom: 0.2rem; }
.pagination { display: flex; gap: 0.5rem; justify-content: center; margin-top: 1.5rem; }
.pagination a, .pagination span { padding: 0.4rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.85rem; }
.pagination .current { background: var(--primary-strong); color: #fff; border-color: var(--primary-strong); }
.chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.65rem; border-radius: 999px; font-size: 0.78rem; background: var(--accent); color: var(--accent-foreground); }
.section-heading-sm { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted-foreground); margin: 1.5rem 0 0.6rem; }
.task-row-list { display: flex; flex-direction: column; gap: 0.5rem; }
.task-row { display: flex; align-items: center; gap: 0.75rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.6rem 0.85rem; }
.task-row .title { flex: 1; min-width: 0; }
.task-card .task-card-title { font-weight: 500; margin-bottom: 0.35rem; }
.task-card .task-card-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.tab-links { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; }
.tab-links a { padding: 0.55rem 0.9rem; font-size: 0.88rem; color: var(--muted-foreground); border-bottom: 2px solid transparent; }
.tab-links a.active { color: var(--foreground); border-bottom-color: var(--primary-strong); font-weight: 600; }
.tab-links a:hover { text-decoration: none; color: var(--foreground); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 0.5rem; overflow: hidden; }
.cal-grid .cal-head { background: var(--muted); padding: 0.4rem; text-align: center; font-size: 0.72rem; text-transform: uppercase; color: var(--muted-foreground); font-weight: 600; }
.cal-cell { background: var(--card); min-height: 92px; padding: 0.35rem; font-size: 0.78rem; }
.cal-cell.other-month { background: var(--muted); color: var(--muted-foreground); }
.cal-cell .cal-day-num { font-weight: 600; margin-bottom: 0.25rem; }
.cal-task { display: block; background: var(--accent); color: var(--accent-foreground); border-radius: 0.3rem; padding: 0.1rem 0.35rem; margin-bottom: 0.15rem; font-size: 0.72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Gantt chart (Flow: per-project and portfolio views) */
.gantt-toolbar { margin-bottom: 0.5rem; }
.gantt-toolbar .btn.active { background: var(--accent); color: var(--accent-foreground); font-weight: 600; }
.gantt-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 0.5rem; }
.gantt-chart { position: relative; }
.gantt-header { display: flex; position: sticky; top: 0; background: var(--card); z-index: 2; border-bottom: 1px solid var(--border); }
.gantt-header-spacer { flex-shrink: 0; position: sticky; left: 0; background: var(--card); z-index: 3; }
.gantt-header-ticks { position: relative; height: 1.6rem; }
.gantt-tick { position: absolute; top: 0; font-size: 0.7rem; color: var(--muted-foreground); padding: 0.3rem 0 0 0.3rem; white-space: nowrap; border-left: 1px solid var(--border); height: 100%; }
.gantt-body { position: relative; }
.gantt-arrows { position: absolute; top: 0; left: 0; pointer-events: none; }
.gantt-row { position: absolute; left: 0; right: 0; display: flex; align-items: center; border-bottom: 1px solid var(--border); }
.gantt-label { flex-shrink: 0; position: sticky; left: 0; background: var(--card); font-size: 0.83rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; z-index: 1; padding-right: 0.5rem; }
.gantt-bar { position: absolute; top: 6px; height: 22px; border-radius: 0.3rem; background: var(--primary-strong); display: flex; align-items: stretch; }
.gantt-bar.badge-success { background: var(--success); }
.gantt-bar.badge-warning { background: var(--warning); }
.gantt-bar.badge-destructive { background: var(--destructive); }
.gantt-bar.badge-outline { background: var(--muted-foreground); }
.gantt-bar-fill { flex: 1; cursor: grab; }
.gantt-bar.gantt-draggable .gantt-bar-fill:active { cursor: grabbing; }
.gantt-handle { width: 6px; cursor: ew-resize; flex-shrink: 0; }
.gantt-handle:hover { background: rgba(255,255,255,0.35); }
.gantt-diamond { position: absolute; top: 9px; width: 14px; height: 14px; background: var(--primary-strong); transform: rotate(45deg); border-radius: 2px; }
.gantt-diamond.badge-success { background: var(--success); }
.gantt-diamond.badge-warning { background: var(--warning); }
.gantt-diamond.badge-destructive { background: var(--destructive); }
.gantt-diamond.badge-outline { background: var(--muted-foreground); }

/* Grid (spreadsheet) */
.sheet-table { border-collapse: collapse; font-size: 0.85rem; }
.sheet-table td, .sheet-table th { border: 1px solid var(--border); padding: 0; min-width: 90px; }
.sheet-table th { background: var(--muted); padding: 0.35rem 0.5rem; }
.sheet-cell { display: block; width: 100%; padding: 0.35rem 0.5rem; border: none; outline: none; font-size: 0.85rem; font-family: inherit; }
.sheet-cell:focus { background: var(--accent); }
.sheet-cell.cell-error { color: var(--destructive); }

/* Slides — base canvas/thumbnail primitives shared across the app shell.
   App-specific Slides styles (themes, editor layout, present mode, print,
   comments, etc.) live in webroot/slides/assets/slides.css, following the
   same per-app-stylesheet convention as Grid/Write, and are loaded only on
   Slides pages so this shared stylesheet stays framework-agnostic. */
.slide-canvas { aspect-ratio: 16/9; border: 1px solid var(--border); border-radius: 0.75rem; background: var(--card); display: flex; flex-direction: column; justify-content: center; padding: 3rem; box-shadow: var(--shadow-sm); }
.slide-thumb { aspect-ratio: 16/9; border: 1px solid var(--border); border-radius: 0.4rem; background: var(--card); overflow: hidden; cursor: pointer; }
.slide-thumb.active { border-color: var(--primary-strong); box-shadow: 0 0 0 2px var(--primary-strong); }

@media (max-width: 700px) {
  .container, .container-narrow { padding: 0 1rem; }
  .hero { padding: 3rem 0 2.5rem; }
}
