/* Flow design system — shared-hosting friendly (no Node build required) */

:root {
  --flow-green: #74a84a;
  --flow-green-dark: #2c541d;
  --flow-green-light: #e8f0e1;
  --flow-amber: #d4a017;
  --flow-amber-dark: #7a5a12;
  --flow-amber-light: #faf3e3;
  --flow-blue: #4a7eb5;
  --flow-blue-dark: #1e4a7a;
  --flow-blue-light: #e8f1fa;
  --flow-cream: #f7f6f3;
  --flow-cream-elevated: #ffffff;
  --flow-charcoal: #2d2d2d;
  --flow-charcoal-muted: #5c5c5c;
  --flow-border: #e8e6e1;

  --flow-shadow-sm: 0 1px 2px rgba(45, 45, 45, 0.04);
  --flow-shadow-md: 0 1px 2px rgba(45, 45, 45, 0.04), 0 4px 16px rgba(45, 45, 45, 0.06);
  --flow-shadow-lg: 0 2px 4px rgba(45, 45, 45, 0.04), 0 8px 24px rgba(45, 45, 45, 0.08);

  --background: var(--flow-cream);
  --foreground: var(--flow-charcoal);
  --card: var(--flow-cream-elevated);
  --card-foreground: var(--flow-charcoal);
  --primary: var(--flow-green-dark);
  --primary-foreground: #ffffff;
  --secondary: #eeede8;
  --secondary-foreground: var(--flow-charcoal);
  --muted: #eeede8;
  --muted-foreground: var(--flow-charcoal-muted);
  --accent: var(--flow-green-light);
  --accent-foreground: var(--flow-green-dark);
  --destructive: #c45c4a;
  --border: var(--flow-border);
  --input: var(--flow-border);
  --ring: var(--flow-green);
  --radius: 0.75rem;

  --sidebar: var(--flow-cream-elevated);
  --sidebar-foreground: var(--flow-charcoal);
  --sidebar-border: var(--flow-border);
  --sidebar-width: 280px;

  --font-sans: "DM Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

img,
svg {
  display: block;
  max-width: 100%;
}

h1, h2, h3, p {
  margin: 0;
}

/* Layout shell */
.flow-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background: var(--background);
}

.flow-sidebar-desktop {
  display: none;
}

@media (min-width: 1024px) {
  .flow-sidebar-desktop {
    display: flex;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: var(--sidebar-width);
  }

  .flow-shell-main {
    padding-left: var(--sidebar-width);
  }
}

.flow-shell-main {
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  flex-direction: column;
}

.flow-sidebar {
  display: flex;
  width: 100%;
  height: 100%;
  flex-direction: column;
  border-right: 1px solid var(--sidebar-border);
  background: var(--sidebar);
  color: var(--sidebar-foreground);
}

.flow-sidebar-brand {
  display: flex;
  height: 3.5rem;
  flex-shrink: 0;
  align-items: center;
  gap: 0.625rem;
  border-bottom: 1px solid var(--sidebar-border);
  padding: 0 1rem;
}

@media (min-width: 1024px) {
  .flow-sidebar-brand {
    height: 4rem;
    padding: 0 1.25rem;
  }
}

.flow-sidebar-brand-text {
  min-width: 0;
}

.flow-sidebar-brand-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.flow-sidebar-brand-subtitle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.flow-sidebar-nav-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem;
}

.flow-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.flow-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 0.5rem;
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.flow-nav-link:hover {
  background: color-mix(in srgb, var(--muted) 80%, transparent);
  color: var(--foreground);
}

.flow-nav-link:active {
  transform: scale(0.98);
}

.flow-nav-link.is-active {
  background: var(--secondary);
  color: var(--primary);
}

.flow-nav-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.flow-nav-divider {
  height: 1px;
  margin: 1rem 0;
  background: color-mix(in srgb, var(--border) 80%, transparent);
}

.flow-sidebar-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--sidebar-border);
  padding: 0.75rem;
}

.flow-logout-btn {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.75rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  padding: 0.625rem 0.75rem;
  color: var(--muted-foreground);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.flow-logout-btn:hover {
  background: color-mix(in srgb, var(--muted) 80%, transparent);
  color: var(--foreground);
}

.flow-logout-btn:active {
  transform: scale(0.98);
}

.flow-logout-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Top nav */
.flow-topnav {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: var(--background);
}

.flow-topnav-inner {
  display: flex;
  height: 3.5rem;
  width: 100%;
  max-width: 80rem;
  align-items: center;
  gap: 0.75rem;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .flow-topnav-inner {
    padding: 0 1.5rem;
  }
}

@media (min-width: 1024px) {
  .flow-topnav-inner {
    height: 4rem;
    padding: 0 2rem;
  }
}

.flow-topnav-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

@media (min-width: 1024px) {
  .flow-topnav-title {
    display: none;
  }

  .flow-topnav-spacer {
    display: block;
    flex: 1;
  }
}

.flow-topnav-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.25rem;
}

@media (min-width: 640px) {
  .flow-topnav-actions {
    gap: 0.5rem;
  }
}

.flow-header-search {
  position: relative;
  width: min(16rem, 42vw);
}

@media (min-width: 768px) {
  .flow-header-search {
    width: 18rem;
  }
}

.flow-header-search-field {
  position: relative;
}

.flow-header-search-icon {
  position: absolute;
  top: 50%;
  left: 0.7rem;
  transform: translateY(-50%);
  color: var(--muted-foreground);
  pointer-events: none;
  display: inline-flex;
}

.flow-header-search-icon svg {
  width: 1rem;
  height: 1rem;
}

.flow-input.flow-header-search-input {
  height: 2.25rem;
  padding: 0 0.75rem 0 2.35rem;
  background: var(--card);
  box-shadow: none;
}

.flow-header-search-panel {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 50;
  width: min(22rem, 85vw);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  border-radius: 0.75rem;
  background: var(--card);
  box-shadow: var(--flow-shadow-md);
}

.flow-header-search-empty {
  padding: 0.9rem 1rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.flow-header-search-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
  max-height: 20rem;
  overflow-y: auto;
}

.flow-header-search-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.55rem 0.85rem;
  text-decoration: none;
  color: inherit;
}

.flow-header-search-item:hover {
  background: color-mix(in srgb, var(--accent) 70%, transparent);
}

.flow-header-search-item-icon {
  margin-top: 0.1rem;
  color: var(--muted-foreground);
  display: inline-flex;
  flex-shrink: 0;
}

.flow-header-search-item-icon svg {
  width: 1rem;
  height: 1rem;
}

.flow-header-search-item-text {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.flow-header-search-item-title {
  font-size: 0.875rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-header-search-item-meta {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mobile drawer */
.flow-drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
}

.flow-drawer.is-open {
  display: block;
}

.flow-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(45, 45, 45, 0.35);
}

.flow-drawer-panel {
  position: absolute;
  inset: 0 auto 0 0;
  width: min(calc(100vw - 3rem), 280px);
  background: var(--sidebar);
  box-shadow: var(--flow-shadow-lg);
}

/* Page */
.flow-page {
  width: 100%;
  max-width: 80rem;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

@media (min-width: 640px) {
  .flow-page {
    padding: 2rem 1.5rem;
  }
}

@media (min-width: 1024px) {
  .flow-page {
    padding: 2rem;
  }
}

.flow-page-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
  .flow-page-header {
    gap: 0.5rem;
    margin-bottom: 2rem;
  }
}

.flow-page-title {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

@media (min-width: 640px) {
  .flow-page-title {
    font-size: 1.5rem;
  }
}

.flow-page-description {
  max-width: 42rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

@media (min-width: 640px) {
  .flow-page-description {
    font-size: 1rem;
  }
}

/* Cards / forms */
.flow-card {
  position: relative;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: calc(var(--radius) * 1.4);
  background: var(--card);
  color: var(--card-foreground);
  box-shadow: var(--flow-shadow-sm);
}

.flow-card-stat {
  padding: 1.25rem;
}

@media (min-width: 640px) {
  .flow-card-stat {
    padding: 1.5rem;
  }
}

.flow-card-stat-label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.flow-card-stat-value {
  margin-top: 0.5rem;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

@media (min-width: 640px) {
  .flow-card-stat-value {
    font-size: 1.875rem;
  }
}

.flow-stats-grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
  .flow-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .flow-stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
  }
}

.flow-icon-box {
  display: flex;
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background: var(--flow-green-light);
  color: var(--flow-green-dark);
  transition: transform 0.3s ease;
}

.flow-icon-box svg {
  width: 1rem;
  height: 1rem;
}

.flow-icon-box-lg {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.75rem;
}

.flow-icon-box-lg svg {
  width: 1.25rem;
  height: 1.25rem;
}

.flow-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.flow-form-section {
  overflow: hidden;
}

.flow-form-section-header {
  border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  padding: 1rem 1.25rem;
}

@media (min-width: 640px) {
  .flow-form-section-header {
    padding: 1rem 1.5rem;
  }
}

.flow-form-section-title {
  font-size: 0.875rem;
  font-weight: 600;
}

.flow-form-section-description {
  margin-top: 0.125rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.flow-form-section-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem;
}

@media (min-width: 640px) {
  .flow-form-section-body {
    padding: 1.5rem;
  }
}

.flow-form-row {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .flow-form-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.flow-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.flow-label {
  font-size: 0.875rem;
  font-weight: 500;
}

.flow-input {
  height: 2.5rem;
  width: 100%;
  border: 1px solid var(--input);
  border-radius: 0.5rem;
  background: var(--background);
  padding: 0 0.75rem;
  color: var(--foreground);
  box-shadow: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.flow-input::placeholder {
  color: var(--muted-foreground);
}

.flow-input:hover:not(:focus):not(:disabled) {
  border-color: var(--border);
  background: color-mix(in srgb, var(--muted) 30%, var(--background));
}

.flow-input:focus {
  outline: none;
  border-color: var(--flow-green);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--flow-green) 20%, transparent);
}

.flow-input:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.flow-hint {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.flow-form-actions {
  display: flex;
  flex-direction: column-reverse;
  gap: 0.75rem;
  border-top: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--muted) 30%, transparent);
  padding: 1rem 1.25rem;
}

@media (min-width: 640px) {
  .flow-form-actions {
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
  }
}

.flow-form-actions-status {
  margin-right: auto;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--flow-green-dark);
}

.flow-error {
  font-size: 0.875rem;
  color: var(--destructive);
}

/* Buttons */
.flow-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  padding: 0 1rem;
  height: 2.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.flow-btn:active {
  transform: scale(0.98);
}

.flow-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.flow-btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
}

.flow-btn-primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--primary) 90%, black);
}

.flow-btn-outline {
  border-color: var(--border);
  background: var(--card);
  color: var(--foreground);
}

.flow-btn-outline:hover:not(:disabled) {
  background: var(--muted);
}

.flow-btn-ghost {
  background: transparent;
  color: var(--foreground);
}

.flow-btn-ghost:hover:not(:disabled) {
  background: var(--muted);
}

.flow-btn-icon {
  width: 2.5rem;
  padding: 0;
}

.flow-btn-lg {
  height: 2.75rem;
  width: 100%;
}

.flow-btn-sm {
  height: 2.25rem;
  padding: 0 0.75rem;
}

/* Auth / install */
.flow-auth {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  background: color-mix(in srgb, var(--muted) 30%, var(--background));
}

.flow-auth-inner {
  width: 100%;
  max-width: 24rem;
}

.flow-auth-inner.is-wide {
  max-width: 32rem;
}

.flow-auth-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1.5rem;
  text-align: center;
}

.flow-auth-header .flow-icon-box {
  margin-bottom: 1rem;
}

.flow-auth-title {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.flow-auth-subtitle {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.flow-auth-card {
  padding: 1.5rem;
}

@media (min-width: 640px) {
  .flow-auth-card {
    padding: 1.75rem;
  }
}

.flow-install-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.flow-install-section + .flow-install-section {
  border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  padding-top: 1.5rem;
}

.flow-install-section h2 {
  font-size: 0.875rem;
  font-weight: 600;
}

.flow-install-section p {
  margin-top: 0.125rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.flow-install-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  margin-bottom: 1.25rem;
}

.flow-install-step {
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--muted) 55%, transparent);
  color: var(--muted-foreground);
  border-radius: 0.55rem;
  padding: 0.45rem 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
}

.flow-install-step.is-active {
  background: color-mix(in srgb, var(--flow-green) 16%, transparent);
  border-color: color-mix(in srgb, var(--flow-green) 45%, var(--border));
  color: var(--foreground);
}

.flow-install-step.is-done {
  color: var(--foreground);
}

.flow-install-step:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.flow-install-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.flow-install-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.25rem;
}

.flow-install-need {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.8rem;
  color: var(--muted-foreground);
  display: grid;
  gap: 0.25rem;
}

.flow-req-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.flow-req-list li {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.55rem 0.65rem;
  border-radius: 0.55rem;
  border: 1px solid var(--border);
  font-size: 0.8rem;
}

.flow-req-list li strong {
  display: block;
  font-weight: 600;
}

.flow-req-list li.is-ok {
  background: color-mix(in srgb, var(--flow-green) 10%, transparent);
}

.flow-req-list li.is-bad {
  background: color-mix(in srgb, var(--destructive) 8%, transparent);
  border-color: color-mix(in srgb, var(--destructive) 35%, var(--border));
}

.flow-req-mark {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  margin-top: 0.1rem;
}

.flow-req-list li.is-ok .flow-req-mark {
  background: var(--flow-green);
  color: #fff;
}

.flow-req-list li.is-bad .flow-req-mark {
  background: var(--destructive);
  color: #fff;
}


.flow-avatar {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--flow-green-light);
  color: var(--flow-green-dark);
  font-size: 0.75rem;
  font-weight: 500;
}

.flow-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 2rem;
}

.flow-empty h2 {
  font-size: 1.125rem;
  font-weight: 600;
}

.flow-empty p {
  max-width: 28rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.flow-greeting {
  margin-bottom: 1.5rem;
}

.flow-greeting h2 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.flow-greeting p {
  margin-top: 0.25rem;
  color: var(--muted-foreground);
}

.flow-update-message {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.flow-update-message.is-success {
  color: var(--flow-green-dark);
}

.flow-update-message.is-warning {
  color: var(--flow-amber-dark);
}

.flow-update-message.is-error {
  color: var(--destructive);
}

.flow-hidden-lg {
  display: inline-flex;
}

@media (min-width: 1024px) {
  .flow-hidden-lg {
    display: none;
  }
}

.flow-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;
}

.is-hidden {
  display: none !important;
}

.flow-logo-upload {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 640px) {
  .flow-logo-upload {
    flex-direction: row;
    align-items: flex-start;
  }
}

.flow-logo-preview {
  width: 9rem;
  height: 6rem;
  flex-shrink: 0;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 0.75rem;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--muted) 55%, transparent);
  color: color-mix(in srgb, var(--muted-foreground) 80%, transparent);
}

@media (min-width: 640px) {
  .flow-logo-preview {
    margin: 0;
  }
}

.flow-logo-preview.has-image {
  background: var(--card);
  padding: 0.5rem;
}

.flow-logo-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.flow-logo-initials {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--flow-green-dark);
}

.flow-logo-upload-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.flow-logo-upload-title {
  font-size: 0.875rem;
  font-weight: 500;
}

.flow-logo-upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.flow-color-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.flow-color-field .flow-input {
  flex: 1;
  min-width: 0;
}

.flow-color-swatch {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}

.flow-color-swatch::-webkit-color-swatch-wrapper {
  padding: 3px;
}

.flow-color-swatch::-webkit-color-swatch {
  border: none;
  border-radius: 0.35rem;
}

.flow-sidebar-brand-logo {
  width: 2rem;
  height: 2rem;
  border-radius: 0.55rem;
  object-fit: contain;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 0.15rem;
}

@keyframes flow-fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.flow-enter {
  animation: flow-fade-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.flow-enter-delay-1 {
  animation-delay: 60ms;
}

.flow-enter-delay-2 {
  animation-delay: 120ms;
}

@media (prefers-reduced-motion: reduce) {
  .flow-enter,
  .flow-nav-link,
  .flow-btn,
  .flow-logout-btn {
    animation: none !important;
    transition: none !important;
  }
}

/* Phase 2 — clients, projects, tabs, badges, tables */

.flow-page-header-row {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 640px) {
  .flow-page-header-row {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
  }
}

.flow-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.flow-tab {
  flex-shrink: 0;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  padding: 0.5rem 1rem;
  color: var(--muted-foreground);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.flow-tab:hover {
  background: color-mix(in srgb, var(--muted) 80%, transparent);
  color: var(--foreground);
}

.flow-tab.is-active {
  background: var(--flow-green-light);
  color: var(--flow-green-dark);
}

.flow-tab-count {
  margin-left: 0.375rem;
  font-size: 0.75rem;
  opacity: 0.7;
}

.flow-card-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .flow-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .flow-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.flow-entity-card {
  display: block;
  padding: 1.25rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.flow-entity-card:hover {
  border-color: color-mix(in srgb, var(--flow-green) 40%, var(--border));
  box-shadow: var(--flow-shadow-md);
  transform: translateY(-1px);
}

.flow-entity-card-top {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.flow-entity-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.flow-entity-card-meta {
  margin-top: 0.125rem;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.flow-entity-card-rows {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.flow-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.flow-badge-soft {
  background: var(--flow-green-light);
  color: var(--flow-green-dark);
}

.flow-badge-progress {
  background: var(--flow-amber-light);
  color: var(--flow-amber-dark);
}

.flow-badge-review {
  background: var(--flow-blue-light);
  color: var(--flow-blue-dark);
}

.flow-badge-muted {
  background: var(--muted);
  color: var(--muted-foreground);
}

.flow-empty-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.5rem;
  text-align: center;
}

.flow-empty-center h2 {
  font-size: 1rem;
  font-weight: 600;
}

.flow-empty-center p {
  margin-top: 0.25rem;
  max-width: 20rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.flow-empty-center .flow-btn {
  margin-top: 1.5rem;
}

.flow-detail-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
  .flow-detail-header {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
  }
}

.flow-detail-header-main {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  min-width: 0;
}

.flow-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.flow-btn-danger {
  border-color: color-mix(in srgb, var(--destructive) 35%, var(--border));
  background: var(--card);
  color: var(--destructive);
}

.flow-btn-danger:hover:not(:disabled) {
  background: color-mix(in srgb, var(--destructive) 8%, var(--card));
}

.flow-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235c5c5c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
}

.flow-textarea {
  min-height: 100px;
  width: 100%;
  resize: vertical;
  border: 1px solid var(--input);
  border-radius: 0.5rem;
  background: var(--background);
  padding: 0.625rem 0.75rem;
  color: var(--foreground);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.flow-textarea:focus {
  outline: none;
  border-color: var(--flow-green);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--flow-green) 20%, transparent);
}

.flow-multi-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.flow-multi-row {
  display: flex;
  gap: 0.5rem;
}

.flow-multi-row .flow-input {
  flex: 1;
}

.flow-link-btn {
  border: 0;
  background: transparent;
  color: var(--flow-green-dark);
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0;
}

.flow-link-btn:hover {
  text-decoration: underline;
}

.flow-table-wrap {
  overflow: hidden;
}

.flow-table-scroll {
  overflow-x: auto;
}

.flow-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.flow-table thead {
  background: color-mix(in srgb, var(--muted) 40%, transparent);
}

.flow-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.flow-table td {
  border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  padding: 0.875rem 1rem;
  color: var(--foreground);
}

.flow-table tbody tr {
  transition: background-color 0.2s ease;
}

.flow-table tbody tr:hover {
  background: color-mix(in srgb, var(--muted) 30%, transparent);
}

.flow-table a {
  font-weight: 500;
}

.flow-table a:hover {
  color: var(--flow-green-dark);
}

.flow-stack {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.flow-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.flow-inline-form .flow-input,
.flow-inline-form .flow-select {
  min-width: 12rem;
  flex: 1;
}

.flow-nav-badge {
  display: inline-flex;
  min-width: 1.25rem;
  height: 1.25rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--primary);
  padding: 0 0.375rem;
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--secondary);
}

.flow-nav-link.is-active .flow-nav-badge {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--secondary) 35%, transparent);
}

.flow-readonly {
  display: flex;
  height: 2.5rem;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--muted) 30%, transparent);
  padding: 0 0.75rem;
  font-size: 0.875rem;
}

/* Phase 3 — tasks, calendar, progress */

.flow-progress-track {
  height: 0.375rem;
  width: 100%;
  overflow: hidden;
  border-radius: 999px;
  background: var(--muted);
}

.flow-progress-bar {
  height: 100%;
  border-radius: inherit;
  background: var(--flow-green);
  transition: width 0.3s ease;
}

.flow-task-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: 0.65rem;
  padding: 0.65rem 0.75rem;
  background: color-mix(in srgb, var(--muted) 20%, var(--card));
}

.flow-task-status {
  border: 0;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.flow-task-status-todo {
  background: var(--muted);
  color: var(--muted-foreground);
}

.flow-task-status-in_progress {
  background: var(--flow-amber-light);
  color: var(--flow-amber-dark);
}

.flow-task-status-done {
  background: var(--flow-green-light);
  color: var(--flow-green-dark);
}

.flow-task-details {
  width: 100%;
}

.flow-task-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  list-style: none;
  font-size: 0.875rem;
  font-weight: 500;
}

.flow-task-summary::-webkit-details-marker {
  display: none;
}

.flow-task-summary .is-done {
  text-decoration: line-through;
  color: var(--muted-foreground);
}

.flow-calendar-layout {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 1024px) {
  .flow-calendar-layout {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    align-items: start;
  }
}

.flow-calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.25rem;
  margin-bottom: 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  text-align: center;
}

.flow-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.25rem;
}

.flow-calendar-day {
  display: flex;
  min-height: 4.25rem;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: 0.55rem;
  padding: 0.4rem;
  background: var(--card);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.flow-calendar-day:hover {
  border-color: color-mix(in srgb, var(--flow-green) 40%, var(--border));
}

.flow-calendar-day.is-muted {
  opacity: 0.45;
}

.flow-calendar-day.is-today {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--flow-green) 50%, transparent);
}

.flow-calendar-day.is-selected {
  background: var(--flow-green-light);
  border-color: color-mix(in srgb, var(--flow-green) 45%, var(--border));
}

.flow-calendar-day-num {
  font-size: 0.8rem;
  font-weight: 600;
}

.flow-calendar-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
}

.flow-calendar-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 999px;
  background: var(--flow-green);
}

.flow-calendar-dot-task_due {
  background: var(--flow-amber);
}

.flow-calendar-dot-project_due {
  background: var(--flow-blue);
}

.flow-calendar-dot-project_completed {
  background: var(--flow-green);
}

.flow-calendar-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.5rem;
}

@media (max-width: 900px) {
  .flow-calendar-week {
    grid-template-columns: 1fr;
  }
}

.flow-calendar-week-day {
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  min-height: 9rem;
  background: var(--card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.flow-calendar-week-day.is-today {
  border-color: color-mix(in srgb, var(--flow-green) 55%, var(--border));
}

.flow-calendar-week-day.is-selected {
  box-shadow: inset 0 0 0 1px var(--flow-green);
}

.flow-calendar-week-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.flow-calendar-week-head strong {
  font-size: 0.95rem;
  color: var(--foreground);
}

.flow-calendar-week-events {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.5rem;
  flex: 1;
}

.flow-calendar-chip {
  display: block;
  padding: 0.3rem 0.45rem;
  border-radius: 0.4rem;
  font-size: 0.7rem;
  line-height: 1.25;
  text-decoration: none;
  color: var(--foreground);
  background: color-mix(in srgb, var(--muted) 70%, transparent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-calendar-chip-task_due {
  background: color-mix(in srgb, var(--flow-blue) 18%, transparent);
}

.flow-calendar-chip-project_due {
  background: color-mix(in srgb, #c47a2c 18%, transparent);
}

.flow-calendar-chip-project_completed {
  background: color-mix(in srgb, var(--flow-green) 18%, transparent);
}
