/* Tiny Greens hub design foundation v1.0
   Scope: .tg-hub only. Load after the existing hub stylesheet.
   Set data-device-mode="kiosk" explicitly; never infer kiosk from width.
   Set data-text-size="large" for the signed-in user's device preference.
   Pair with DESIGN-RULES.md. This file provides appearance, not app logic. */
.tg-hub {
  --tg-bg: #f7f6f0;
  --tg-surface: #ffffff;
  --tg-cream: #f1ebd8;
  --tg-sage: #e7ede1;
  --tg-green: #254d39;
  --tg-green-hover: #193b2a;
  --tg-ink: #20372b;
  --tg-muted: #586259;
  --tg-border: #d9ddd4;
  --tg-control-border: #7c897b;
  --tg-danger: #9a3025;
  --tg-danger-bg: #fbece7;
  --tg-warning: #805000;
  --tg-warning-bg: #fff0cf;
  --tg-success-bg: #e7f1e5;
  --tg-focus: #225f9b;
  --tg-radius-sm: 8px;
  --tg-radius: 12px;
  --tg-radius-lg: 16px;
  --tg-space-1: 4px;
  --tg-space-2: 8px;
  --tg-space-3: 12px;
  --tg-space-4: 16px;
  --tg-space-5: 24px;
  --tg-space-6: 32px;
  --tg-space-7: 48px;
  --tg-body: 16px;
  --tg-small: 14px;
  --tg-section: 22px;
  --tg-title: 32px;
  --tg-control: 48px;
  --tg-icon: 24px;
  --tg-page-pad: 32px;
  --tg-sidebar: 224px;
  --tg-dialog-shadow: 0 12px 40px rgb(24 46 32 / 16%);
  color: var(--tg-ink);
  background: var(--tg-bg);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: var(--tg-body);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  isolation: isolate;
  -webkit-text-size-adjust: 100%;
}
.tg-hub[data-text-size="large"] {
  --tg-body: 18px;
  --tg-small: 16px;
  --tg-section: 24px;
  --tg-title: 36px;
  --tg-control: 56px;
}
.tg-hub *, .tg-hub *::before, .tg-hub *::after { box-sizing: border-box; }
.tg-hub [hidden] { display: none !important; }
.tg-hub :where(h1, h2, h3, p) { margin: 0; }
.tg-hub :where(button, input, select, textarea) { font: inherit; }
.tg-hub :where(button, a, input, select, textarea) { -webkit-tap-highlight-color: transparent; }
.tg-hub :where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--tg-focus);
  outline-offset: 3px;
}
.tg-hub :where(a) { color: var(--tg-green); text-underline-offset: 3px; }
.tg-hub :where(button) { cursor: pointer; }
.tg-hub :where(button:disabled, input:disabled, select:disabled, textarea:disabled) { cursor: not-allowed; opacity: .55; }
.tg-hub :where(svg) { width: var(--tg-icon); height: var(--tg-icon); flex: 0 0 auto; }
.tg-hub .tg-muted { color: var(--tg-muted); }
.tg-hub .tg-small { font-size: var(--tg-small); }
.tg-hub .tg-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.tg-hub .tg-skip-link { position: fixed; top: 8px; left: 8px; z-index: 100; padding: 12px 16px; background: white; transform: translateY(-180%); }
.tg-hub .tg-skip-link:focus { transform: translateY(0); }
.tg-hub .tg-shell { display: grid; grid-template-columns: var(--tg-sidebar) minmax(0, 1fr); min-height: inherit; }
.tg-hub .tg-sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  overflow-y: auto; padding: 24px 16px; border-right: 1px solid var(--tg-border);
  background: var(--tg-surface); display: flex; flex-direction: column; gap: 24px;
}
.tg-hub .tg-brand { display: inline-flex; gap: 10px; align-items: center; color: var(--tg-green); text-decoration: none; font-size: 22px; font-weight: 700; }
.tg-hub .tg-brand svg { width: 32px; height: 32px; }
.tg-hub .tg-nav { display: grid; gap: 4px; }
.tg-hub .tg-nav-link { display: flex; align-items: center; gap: 12px; min-height: var(--tg-control); padding: 12px; border-radius: var(--tg-radius-sm); text-decoration: none; color: var(--tg-ink); overflow-wrap: anywhere; }
.tg-hub .tg-nav-link[aria-current="page"] { background: var(--tg-sage); color: var(--tg-green); font-weight: 650; }
.tg-hub .tg-sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--tg-border); }
.tg-hub .tg-content { min-width: 0; }
.tg-hub .tg-header {
  display: flex; align-items: center; flex-wrap: wrap; gap: 16px;
  padding: 16px var(--tg-page-pad); min-height: 80px;
  border-bottom: 1px solid var(--tg-border); background: var(--tg-bg);
}
.tg-hub .tg-header-brand { display: none; }
.tg-hub .tg-header-search { flex: 1 1 220px; max-width: 560px; }
.tg-hub .tg-account { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tg-hub .tg-user-name { font-weight: 650; overflow-wrap: anywhere; }
.tg-hub .tg-main { max-width: 1440px; margin-inline: auto; padding: var(--tg-page-pad); }
.tg-hub .tg-intro { margin-bottom: 24px; }
.tg-hub .tg-title { font-size: var(--tg-title); font-weight: 700; line-height: 1.2; letter-spacing: -.025em; overflow-wrap: anywhere; }
.tg-hub .tg-intro p { margin-top: 8px; color: var(--tg-muted); }
.tg-hub .tg-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 400px); gap: 24px; align-items: start; }
.tg-hub .tg-tools-area, .tg-hub .tg-task-panel { min-width: 0; }
.tg-hub .tg-section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.tg-hub .tg-section-title { font-size: var(--tg-section); line-height: 1.3; font-weight: 650; }
.tg-hub .tg-shortcuts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tg-hub .tg-shortcut {
  display: flex; align-items: flex-start; gap: 12px; min-width: 0; min-height: 112px;
  padding: 20px; border: 1px solid transparent; border-radius: var(--tg-radius);
  background: var(--tg-cream); color: var(--tg-green); text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.tg-hub .tg-shortcut svg { width: 28px; height: 28px; }
.tg-hub .tg-shortcut-label { display: block; font-size: var(--tg-body); font-weight: 650; line-height: 1.4; overflow-wrap: anywhere; }
.tg-hub .tg-shortcut-description { display: block; color: var(--tg-muted); font-size: var(--tg-small); margin-top: 4px; }
.tg-hub .tg-tools-link { margin-top: 16px; }
.tg-hub .tg-panel { background: var(--tg-surface); border: 1px solid var(--tg-border); border-radius: var(--tg-radius-lg); padding: 20px; }
.tg-hub .tg-tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--tg-border); }
.tg-hub .tg-tab { min-height: var(--tg-control); background: transparent; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1px; padding: 12px 16px; color: var(--tg-muted); font-weight: 600; }
.tg-hub .tg-tab[aria-selected="true"] { color: var(--tg-green); border-bottom-color: var(--tg-green); }
.tg-hub .tg-task-summary { padding: 16px 0; color: var(--tg-muted); font-size: var(--tg-small); }
.tg-hub .tg-task-list { list-style: none; padding: 0; margin: 0; }
.tg-hub .tg-task-row { display: grid; grid-template-columns: var(--tg-control) minmax(0, 1fr) var(--tg-control); gap: 8px; padding: 16px 0; border-top: 1px solid var(--tg-border); align-items: start; }
.tg-hub .tg-task-body { min-width: 0; padding-top: 10px; }
.tg-hub .tg-task-title { display: block; color: var(--tg-ink); font-weight: 600; overflow-wrap: anywhere; text-decoration: none; }
.tg-hub .tg-task-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 8px; font-size: var(--tg-small); color: var(--tg-muted); }
.tg-hub .tg-check { display: inline-flex; align-items: center; justify-content: center; min-width: var(--tg-control); min-height: var(--tg-control); cursor: pointer; }
.tg-hub .tg-check input { width: 24px; height: 24px; margin: 0; accent-color: var(--tg-green); }
.tg-hub .tg-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 6px; font-size: var(--tg-small); font-weight: 600; color: var(--tg-green); background: var(--tg-sage); }
.tg-hub .tg-badge--overdue { color: var(--tg-danger); background: var(--tg-danger-bg); }
.tg-hub .tg-badge--warning { color: var(--tg-warning); background: var(--tg-warning-bg); }
.tg-hub .tg-badge--done { color: var(--tg-green); background: var(--tg-success-bg); }
.tg-hub .tg-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tg-control); padding: 10px 16px; border: 1px solid var(--tg-control-border); border-radius: var(--tg-radius-sm); background: var(--tg-surface); color: var(--tg-green); font-weight: 600; line-height: 1.4; text-align: center; text-decoration: none; }
.tg-hub .tg-button--primary { color: white; border-color: var(--tg-green); background: var(--tg-green); }
.tg-hub .tg-button--quiet { background: transparent; border-color: transparent; }
.tg-hub .tg-button--danger { color: var(--tg-danger); border-color: var(--tg-danger); }
.tg-hub .tg-icon-button { width: var(--tg-control); min-width: var(--tg-control); min-height: var(--tg-control); padding: 10px; }
.tg-hub .tg-field { display: grid; gap: 8px; }
.tg-hub .tg-field label { font-weight: 600; }
.tg-hub .tg-input { width: 100%; min-height: var(--tg-control); padding: 12px; border: 1px solid var(--tg-control-border); border-radius: var(--tg-radius-sm); background: var(--tg-surface); color: var(--tg-ink); font-size: var(--tg-body); }
.tg-hub textarea.tg-input { min-height: 112px; resize: vertical; }
.tg-hub .tg-input[aria-invalid="true"] { border: 2px solid var(--tg-danger); }
.tg-hub .tg-error { color: var(--tg-danger); font-size: var(--tg-small); }
.tg-hub .tg-form { display: grid; gap: 20px; }
.tg-hub .tg-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
.tg-hub .tg-team-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.tg-hub .tg-team-table th, .tg-hub .tg-team-table td { border-bottom: 1px solid var(--tg-border); padding: 12px 4px; text-align: center; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tg-hub .tg-team-table th { color: var(--tg-muted); font-size: var(--tg-small); font-weight: 500; }
.tg-hub .tg-team-table th:first-child, .tg-hub .tg-team-table td:first-child { width: 43%; text-align: left; }
.tg-hub .tg-person-link { display: flex; flex-direction: column; justify-content: center; min-height: var(--tg-control); color: var(--tg-ink); text-decoration: none; font-weight: 600; }
.tg-hub .tg-person-role { color: var(--tg-muted); font-weight: 400; font-size: var(--tg-small); }
.tg-hub .tg-overdue-number { color: var(--tg-danger); font-weight: 700; }
.tg-hub .tg-empty { padding: 32px 16px; color: var(--tg-muted); text-align: center; }
.tg-hub .tg-notice { padding: 12px 16px; border: 1px solid var(--tg-border); border-radius: var(--tg-radius-sm); background: var(--tg-sage); }
.tg-hub .tg-customize-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tg-hub .tg-customize-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px; border: 1px solid var(--tg-border); border-radius: var(--tg-radius-sm); }
.tg-hub .tg-customize-label { flex: 1 1 140px; font-weight: 600; overflow-wrap: anywhere; }
.tg-hub .tg-history { list-style: none; padding: 0; margin: 0; }
.tg-hub .tg-history li { padding: 12px 0; border-bottom: 1px solid var(--tg-border); overflow-wrap: anywhere; color: var(--tg-muted); font-size: var(--tg-small); }
.tg-hub .tg-history time { display: block; margin-top: 4px; color: var(--tg-muted); font-size: var(--tg-small); }
.tg-hub .tg-history-reason { margin-top: 8px; padding-left: 12px; border-left: 2px solid var(--tg-border); }
/* What a person wrote: a card, in full-size ink, so it cannot be missed. */
.tg-hub .tg-history li.tg-history-said { margin: 12px 0; padding: 12px 16px; border: 0; border-left: 4px solid var(--tg-green); border-radius: var(--tg-radius-sm); background: var(--tg-sage); }
.tg-hub .tg-history-said .tg-history-reason { margin-top: 4px; padding-left: 0; border-left: 0; color: var(--tg-ink); font-size: var(--tg-body); font-weight: 600; line-height: 1.4; white-space: pre-line; }
.tg-hub .tg-dialog { width: min(640px, calc(100% - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: 24px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--tg-border); border-radius: var(--tg-radius-lg); color: var(--tg-ink); background: var(--tg-surface); box-shadow: var(--tg-dialog-shadow); }
.tg-hub .tg-dialog::backdrop { background: rgb(18 35 25 / 40%); }
.tg-hub .tg-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.tg-hub .tg-toast-stack { position: fixed; z-index: 60; bottom: max(24px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: min(560px, calc(100% - 32px)); display: grid; gap: 8px; }
.tg-hub .tg-toast { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; border: 1px solid var(--tg-border); border-radius: var(--tg-radius); background: white; box-shadow: var(--tg-dialog-shadow); }
.tg-hub .tg-toast-message { flex: 1 1 200px; }
.tg-hub .tg-bottom-nav { display: none; }
.tg-hub .tg-test-label { color: var(--tg-danger); background: var(--tg-danger-bg); padding: 4px 8px; border-radius: 4px; font-size: var(--tg-small); font-weight: 600; }
@media (hover: hover) {
  .tg-hub .tg-nav-link:hover, .tg-hub .tg-button--quiet:hover { background: var(--tg-sage); }
  .tg-hub .tg-shortcut:hover { background: #e9e2cb; border-color: var(--tg-control-border); }
  .tg-hub .tg-button--primary:hover { background: var(--tg-green-hover); }
  .tg-hub .tg-task-title:hover, .tg-hub .tg-person-link:hover { text-decoration: underline; }
}
@media (max-width: 1199px) {
  .tg-hub { --tg-sidebar: 176px; --tg-page-pad: 24px; }
  .tg-hub .tg-workspace { grid-template-columns: minmax(0, 1fr); }
  .tg-hub .tg-shortcuts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tg-hub .tg-shortcut { flex-direction: column; min-height: 136px; }
}
@media (min-width: 768px) and (max-width: 1199px) and (orientation: portrait) {
  .tg-hub .tg-shell { grid-template-columns: minmax(0, 1fr); }
  .tg-hub .tg-sidebar { display: none; }
  .tg-hub .tg-header-brand { display: inline-flex; }
  .tg-hub .tg-shortcuts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tg-hub .tg-shortcut { flex-direction: row; min-height: 112px; }
  .tg-hub .tg-main { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
  .tg-hub .tg-bottom-nav { display: flex; }
  .tg-hub .tg-toast-stack { bottom: calc(96px + env(safe-area-inset-bottom)); }
}
@media (max-width: 767px) {
  .tg-hub { --tg-page-pad: 16px; --tg-title: 26px; --tg-section: 20px; }
  .tg-hub[data-text-size="large"] { --tg-title: 30px; --tg-section: 22px; }
  .tg-hub .tg-shell { grid-template-columns: minmax(0, 1fr); }
  .tg-hub .tg-sidebar { display: none; }
  .tg-hub .tg-header { gap: 12px; padding-top: max(12px, env(safe-area-inset-top)); }
  .tg-hub .tg-header-brand { display: inline-flex; font-size: 20px; }
  .tg-hub .tg-header-search { flex-basis: 100%; max-width: none; order: 3; }
  .tg-hub .tg-account { gap: 4px; }
  .tg-hub .tg-main { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
  .tg-hub .tg-shortcuts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tg-hub .tg-shortcut { padding: 16px; gap: 8px; min-height: 116px; }
  .tg-hub .tg-shortcut-description { display: none; }
  .tg-hub .tg-workspace { gap: 24px; }
  .tg-hub .tg-panel { padding: 16px; }
  .tg-hub .tg-task-row { column-gap: 4px; }
  .tg-hub .tg-dialog { width: 100%; max-width: none; height: 100dvh; max-height: none; margin: 0; border: 0; border-radius: 0; padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); }
  .tg-hub .tg-bottom-nav { display: flex; }
  .tg-hub .tg-toast-stack { bottom: calc(96px + env(safe-area-inset-bottom)); }
}
.tg-hub .tg-bottom-nav {
  position: fixed; z-index: 30; inset-inline: 0; bottom: 0;
  justify-content: space-around; gap: 4px; padding: 8px 12px max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--tg-border); background: var(--tg-surface);
}
.tg-hub .tg-bottom-nav a { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 56px; padding: 4px; border-radius: var(--tg-radius-sm); color: var(--tg-muted); text-decoration: none; font-size: var(--tg-small); }
.tg-hub .tg-bottom-nav a[aria-current="page"] { color: var(--tg-green); background: var(--tg-sage); font-weight: 650; }
.tg-hub[data-device-mode="kiosk"] { --tg-body: 20px; --tg-small: 18px; --tg-title: 36px; --tg-section: 28px; --tg-control: 64px; --tg-icon: 28px; --tg-page-pad: 32px; }
.tg-hub[data-device-mode="kiosk"][data-text-size="large"] { --tg-body: 24px; --tg-small: 20px; --tg-title: 40px; --tg-section: 32px; --tg-control: 72px; }
.tg-hub[data-device-mode="kiosk"] .tg-shell { grid-template-columns: minmax(0, 1fr); }
.tg-hub[data-device-mode="kiosk"] .tg-sidebar, .tg-hub[data-device-mode="kiosk"] .tg-bottom-nav { display: none; }
.tg-hub[data-device-mode="kiosk"] .tg-header-brand { display: inline-flex; }
.tg-hub[data-device-mode="kiosk"] .tg-workspace { grid-template-columns: minmax(0, 1fr); }
.tg-hub[data-device-mode="kiosk"] .tg-shortcuts { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.tg-hub[data-device-mode="kiosk"] .tg-shortcut { flex-direction: row; min-height: 144px; padding: 24px; }
.tg-hub[data-device-mode="kiosk"] .tg-main { padding-bottom: 40px; }
.tg-hub[data-device-mode="kiosk"] .tg-toast-stack { bottom: max(24px, env(safe-area-inset-bottom)); }
@media (max-width: 1100px) {
  .tg-hub[data-device-mode="kiosk"] .tg-shortcuts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 479px) {
  .tg-hub[data-text-size="large"] .tg-shortcuts { grid-template-columns: minmax(0, 1fr); }
  .tg-hub[data-device-mode="kiosk"] { --tg-page-pad: 16px; }
  .tg-hub[data-device-mode="kiosk"] .tg-shortcuts { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .tg-hub *, .tg-hub *::before, .tg-hub *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .tg-hub .tg-shortcut, .tg-hub .tg-badge, .tg-hub .tg-panel { border: 1px solid CanvasText; }
  .tg-hub .tg-tab[aria-selected="true"] { border-bottom-color: Highlight; }
}
