/* ==========================================================================
   L | F.I.S. Agency — Design System (Light Default + Dark Theme + Mobile Optimized)
   ========================================================================== */

/* --------------------------------------------------------------------------
   LIGHT THEME (DEFAULT)
   -------------------------------------------------------------------------- */
:root, [data-theme="light"] {
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Surfaces & Backgrounds */
  --bg-canvas: #f8fafc;
  --bg-surface: #ffffff;
  --bg-panel: rgba(255, 255, 255, 0.92);
  --bg-panel-elevated: #ffffff;
  --bg-glass-input: #ffffff;
  --bg-header: rgba(255, 255, 255, 0.9);
  --bg-card-subtle: #f1f5f9;

  /* Borders */
  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-glow-primary: rgba(15, 23, 42, 0.15);

  /* Typography */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  /* Brand Accents */
  --brand-ink: #0f172a;
  --brand-accent: #4f46e5;
  --brand-accent-hover: #4338ca;
  --grad-primary: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  --grad-hover: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  --btn-primary-text: #ffffff;

  /* Status Colors */
  --status-cyan: #0284c7;
  --status-cyan-bg: #e0f2fe;
  --status-cyan-border: #bae6fd;

  --status-amber: #d97706;
  --status-amber-bg: #fef3c7;
  --status-amber-border: #fde68a;

  --status-emerald: #059669;
  --status-emerald-bg: #d1fae5;
  --status-emerald-border: #a7f3d0;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 16px -2px rgba(15, 23, 42, 0.07), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 30px -4px rgba(15, 23, 42, 0.1), 0 4px 10px -2px rgba(15, 23, 42, 0.05);

  /* Ambient Glows */
  --glow-1: rgba(99, 102, 241, 0.08);
  --glow-2: rgba(56, 189, 248, 0.08);

  /* Logo filter */
  --logo-filter: none;
  --logo-frame-bg: #ffffff;
  --logo-frame-border: #e2e8f0;
}

/* --------------------------------------------------------------------------
   DARK THEME OVERRIDES
   -------------------------------------------------------------------------- */
[data-theme="dark"], body.dark-theme {
  --bg-canvas: #090b10;
  --bg-surface: #0f131e;
  --bg-panel: rgba(18, 23, 36, 0.78);
  --bg-panel-elevated: rgba(26, 33, 52, 0.85);
  --bg-glass-input: rgba(13, 17, 28, 0.75);
  --bg-header: rgba(12, 15, 24, 0.85);
  --bg-card-subtle: rgba(255, 255, 255, 0.03);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.15);
  --border-glow-primary: rgba(99, 102, 241, 0.35);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-dim: #475569;

  --brand-ink: #f8fafc;
  --brand-accent: #6366f1;
  --brand-accent-hover: #4f46e5;
  --grad-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  --grad-hover: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #9333ea 100%);
  --btn-primary-text: #ffffff;

  --status-cyan: #38bdf8;
  --status-cyan-bg: rgba(56, 189, 248, 0.14);
  --status-cyan-border: rgba(56, 189, 248, 0.3);

  --status-amber: #fbbf24;
  --status-amber-bg: rgba(251, 191, 36, 0.14);
  --status-amber-border: rgba(251, 191, 36, 0.3);

  --status-emerald: #34d399;
  --status-emerald-bg: rgba(52, 211, 153, 0.14);
  --status-emerald-border: rgba(52, 211, 153, 0.3);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);

  --glow-1: rgba(99, 102, 241, 0.25);
  --glow-2: rgba(56, 189, 248, 0.15);

  --logo-filter: invert(0.94) contrast(1.1);
  --logo-frame-bg: rgba(255, 255, 255, 0.05);
  --logo-frame-border: rgba(255, 255, 255, 0.15);
}

/* ================= CSS RESET & BASE ================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Ambient Radial Glows */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(130px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
  transition: background 0.3s ease;
}

.ambient-glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--glow-1) 0%, transparent 70%);
  top: -100px;
  left: 10%;
}

.ambient-glow-2 {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, var(--glow-2) 0%, transparent 70%);
  bottom: 5%;
  right: -60px;
}

/* Glass panel */
.glass-panel {
  background: var(--bg-panel);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.hidden {
  display: none !important;
}

/* ================= TYPOGRAPHY & BUTTONS ================= */
h1, h2, h3, h4, .logo-text, .metric-value, .col-title, .detail-title {
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  touch-action: manipulation;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--grad-primary);
  color: var(--btn-primary-text);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.15);
}

.btn-primary:hover {
  background: var(--grad-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.25);
}

.btn-secondary {
  background: var(--bg-card-subtle);
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--border-subtle);
  border-color: var(--text-muted);
}

.btn-back {
  font-size: 0.85rem;
  padding: 8px 14px;
}

.btn-danger-action {
  color: #e11d48;
  border-color: rgba(225, 29, 72, 0.2);
}

.btn-danger-action:hover {
  background: rgba(225, 29, 72, 0.1);
  border-color: #e11d48;
}

.btn-block {
  width: 100%;
}

.btn-glow {
  position: relative;
}

.btn-link {
  background: none;
  border: none;
  color: var(--status-cyan);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease;
}

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

/* ================= THEME TOGGLE BUTTON ================= */
.btn-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.775rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  touch-action: manipulation;
}

.btn-theme-toggle:hover {
  border-color: var(--border-medium);
  background: var(--border-subtle);
}

.btn-theme-toggle svg {
  width: 15px;
  height: 15px;
}

/* Show sun in dark mode, moon in light mode */
[data-theme="light"] .btn-theme-toggle .icon-sun { display: none; }
[data-theme="light"] .btn-theme-toggle .icon-moon { display: block; }

[data-theme="dark"] .btn-theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .btn-theme-toggle .icon-moon { display: none; }

/* ================= BRAND LOGO DISPLAY ================= */
.header-logo-frame {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--logo-frame-bg);
  border: 1px solid var(--logo-frame-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: var(--logo-filter);
  transition: filter 0.25s ease;
}

.logo-frame-large {
  width: 120px;
  height: 120px;
  margin: 0 auto 14px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--logo-frame-bg);
  border: 1px solid var(--logo-frame-border);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.agency-logo-large {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: var(--logo-filter);
  transition: filter 0.25s ease;
}

.brand-tagline {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ================= AUTH OVERLAY (LOGIN) ================= */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-canvas);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.login-header-bar {
  position: absolute;
  top: 20px;
  right: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 36px 32px;
  text-align: center;
  animation: modalScaleIn 0.25s ease-out;
}

.login-brand {
  margin-bottom: 20px;
}

.login-title {
  font-size: 1.45rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.login-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.label-hint {
  font-size: 0.75rem;
  color: var(--brand-accent);
  font-weight: 600;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.input-wrapper input {
  padding-left: 42px !important;
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select.custom-select {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-glass-input);
  border: 1px solid var(--border-medium);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px; /* iOS zoom prevention */
  outline: none;
  transition: all 0.15s ease;
}

@media (min-width: 768px) {
  input[type="text"],
  input[type="password"],
  input[type="number"],
  textarea,
  select.custom-select {
    font-size: 0.9rem;
  }
}

input:focus, textarea:focus, select:focus {
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.login-footer-info {
  margin-top: 12px;
  text-align: center;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 9999px;
}

.badge-neutral {
  background: var(--bg-card-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

/* ================= HEADER ================= */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--bg-header);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.logo-text-block {
  display: flex;
  flex-direction: column;
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.logo-divider {
  color: var(--brand-accent);
  font-weight: 400;
}

.logo-sub {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

/* Desktop Nav Tabs */
.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card-subtle);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-tab svg {
  width: 16px;
  height: 16px;
}

.nav-tab:hover {
  color: var(--text-primary);
}

.nav-tab.active {
  color: var(--text-primary);
  background: var(--bg-panel-elevated);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-subtle);
}

.nav-badge {
  font-size: 0.65rem;
  padding: 2px 5px;
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border-radius: 4px;
}

/* User pill */
.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 4px 10px;
  background: var(--bg-panel-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  box-shadow: var(--shadow-sm);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--grad-primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.user-role-badge {
  font-size: 0.65rem;
  color: var(--status-cyan);
  font-weight: 600;
}

.btn-logout-icon {
  background: var(--bg-card-subtle);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-logout-icon:hover {
  background: rgba(244, 63, 94, 0.15);
  color: #e11d48;
}

.btn-logout-icon svg {
  width: 14px;
  height: 14px;
}

/* Mobile Bottom Navigation Bar */
.mobile-nav-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-header);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  z-index: 100;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  justify-content: space-around;
  align-items: center;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
}

.mobile-nav-item svg {
  width: 20px;
  height: 20px;
}

.mobile-nav-item.active {
  color: var(--brand-accent);
}

/* ================= MAIN CONTENT & VIEWS ================= */
.app-main-content {
  flex: 1;
  padding: 24px 24px 80px;
  max-width: 1500px;
  width: 100%;
  margin: 0 auto;
}

.app-view {
  display: none;
  animation: fadeIn 0.2s ease-out;
}

.app-view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================= METRICS GRID ================= */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
}

.metric-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.metric-icon svg {
  width: 20px;
  height: 20px;
}

.metric-icon-purple { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }
.metric-icon-cyan { background: var(--status-cyan-bg); color: var(--status-cyan); }
.metric-icon-amber { background: var(--status-amber-bg); color: var(--status-amber); }
.metric-icon-emerald { background: var(--status-emerald-bg); color: var(--status-emerald); }
.metric-icon-indigo { background: rgba(79, 70, 229, 0.15); color: var(--brand-accent); }

.metric-details { display: flex; flex-direction: column; }
.metric-label { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.metric-row { display: flex; align-items: baseline; gap: 8px; }
.metric-value { font-size: 1.55rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.metric-sub-val { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); }
.text-brand-accent { color: var(--brand-accent); }

/* ================= TOOLBAR ================= */
.projects-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 18px;
  margin-bottom: 20px;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 280px;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.search-box input {
  padding-left: 36px;
  padding-right: 32px;
  border-radius: 10px;
  font-size: 0.875rem;
}

.btn-clear {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
}

.view-switcher {
  display: flex;
  align-items: center;
  background: var(--bg-card-subtle);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
}

.switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.switch-btn svg {
  width: 14px;
  height: 14px;
}

.switch-btn.active {
  background: var(--bg-panel-elevated);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* ================= TABLE VIEW (DEFAULT) ================= */
.table-container {
  overflow-x: auto;
  border-radius: 16px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.data-table th {
  padding: 14px 18px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-medium);
  background: var(--bg-card-subtle);
}

.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tr.clickable-row {
  cursor: pointer;
  transition: background 0.15s ease;
}

.data-table tr.clickable-row:hover td {
  background: var(--bg-card-subtle);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 9999px;
  font-size: 0.775rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-badge.in_progress { background: var(--status-cyan-bg); color: var(--status-cyan); border: 1px solid var(--status-cyan-border); }
.status-badge.payment { background: var(--status-amber-bg); color: var(--status-amber); border: 1px solid var(--status-amber-border); }
.status-badge.completed { background: var(--status-emerald-bg); color: var(--status-emerald); border: 1px solid var(--status-emerald-border); }

.table-status-select {
  padding: 5px 10px;
  font-size: 0.775rem;
  font-weight: 600;
  border-radius: 9999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  cursor: pointer;
}

.table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-icon:hover {
  background: var(--border-subtle);
  color: var(--text-primary);
}

.btn-icon.btn-danger:hover {
  background: rgba(244, 63, 94, 0.15);
  color: #e11d48;
}

.btn-icon svg {
  width: 15px;
  height: 15px;
}

.text-right {
  text-align: right;
}

/* ================= KANBAN BOARD ================= */
.kanban-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  align-items: start;
}

.kanban-col {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  min-height: 520px;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.col-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-indicator {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.status-indicator.cyan { background: var(--status-cyan); }
.status-indicator.amber { background: var(--status-amber); }
.status-indicator.emerald { background: var(--status-emerald); }

.col-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.col-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 9999px;
  background: var(--bg-panel);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.col-sum {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.kanban-cards-list {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.kanban-card {
  background: var(--bg-panel-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-medium);
}

.card-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.card-project-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.card-budget-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  font-size: 0.775rem;
  font-weight: 700;
  border-radius: 6px;
  background: var(--bg-card-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.card-client-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.card-client-row svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.client-contact-link {
  color: var(--status-cyan);
  text-decoration: none;
  font-weight: 600;
}

.client-contact-link:hover {
  text-decoration: underline;
}

.card-desc-preview {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.card-manager {
  display: flex;
  align-items: center;
  gap: 6px;
}

.manager-avatar-mini {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-card-subtle);
  color: var(--text-primary);
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border: 1px solid var(--border-subtle);
}

.empty-col-message {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px;
  color: var(--text-muted);
  font-size: 0.825rem;
  text-align: center;
  border: 1px dashed var(--border-medium);
  border-radius: 12px;
  margin-top: 12px;
}

/* ================= DEDICATED FULL-PAGE DETAIL & CREATE VIEWS ================= */
.page-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

.detail-page-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  align-items: start;
}

.page-card {
  padding: 28px;
}

.detail-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.detail-eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 4px;
}

.detail-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

/* Status transition choice pills */
.status-transition-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 24px;
}

.status-box-label {
  font-size: 0.775rem;
  font-weight: 700;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 10px;
}

.status-buttons-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-status-choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: 9999px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-status-choice:hover {
  border-color: var(--brand-accent);
}

.btn-status-choice.active {
  background: var(--text-primary);
  color: var(--bg-canvas);
  border-color: var(--text-primary);
}

.btn-status-choice .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.btn-status-choice .dot.cyan { background: var(--status-cyan); }
.btn-status-choice .dot.amber { background: var(--status-amber); }
.btn-status-choice .dot.emerald { background: var(--status-emerald); }

.clean-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-row {
  display: flex;
  gap: 14px;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

.contact-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-tg-link {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #229ed9;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s ease;
}

.btn-tg-link:hover { opacity: 0.9; }
.btn-tg-link svg { width: 20px; height: 20px; }

.form-actions-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 10px;
}

.sidebar-block-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-block-title svg {
  width: 16px;
  height: 16px;
  color: var(--brand-accent);
}

/* History timeline */
.history-timeline-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 520px;
  overflow-y: auto;
}

.timeline-item {
  display: flex;
  gap: 12px;
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 13px;
  top: 28px;
  bottom: -14px;
  width: 2px;
  background: var(--border-subtle);
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-card-subtle);
  border: 2px solid var(--brand-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-accent);
  flex-shrink: 0;
  font-size: 0.75rem;
}

.timeline-content {
  flex: 1;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px 14px;
}

.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.timeline-author { font-size: 0.8125rem; font-weight: 700; color: var(--text-primary); }
.timeline-time { font-size: 0.72rem; color: var(--text-muted); }
.timeline-transition { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 2px; }
.timeline-comment {
  font-size: 0.775rem;
  color: var(--text-secondary);
  font-style: italic;
  background: var(--bg-surface);
  padding: 5px 8px;
  border-radius: 6px;
  margin-top: 4px;
  border: 1px solid var(--border-subtle);
}

/* Single page centered wrap */
.single-page-card-wrap {
  max-width: 780px;
  margin: 0 auto;
}

.page-card-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

/* ================= USERS & SETTINGS ================= */
.view-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  margin-bottom: 20px;
}

.view-section-title { font-size: 1.3rem; font-weight: 700; color: var(--text-primary); margin-bottom: 2px; }
.view-section-subtitle { font-size: 0.825rem; color: var(--text-muted); }
.settings-header-actions { display: flex; align-items: center; gap: 12px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }
.settings-card { padding: 24px; }
.card-header { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }

.card-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-icon svg { width: 22px; height: 22px; }
.card-icon.tg-blue { background: rgba(0, 136, 204, 0.15); color: #0088cc; }
.card-icon.tg-amber { background: rgba(245, 158, 11, 0.15); color: var(--status-amber); }
.card-icon.tg-emerald { background: rgba(16, 185, 129, 0.15); color: var(--status-emerald); }
.card-title { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.card-desc { font-size: 0.775rem; color: var(--text-muted); }
.settings-form-body { display: flex; flex-direction: column; gap: 18px; }
.input-tip { font-size: 0.75rem; color: var(--text-muted); line-height: 1.4; margin-top: 4px; }
.input-tip code { background: var(--bg-card-subtle); padding: 2px 4px; border-radius: 4px; font-weight: 600; }

.discovered-chats-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px;
}

.chats-box-title { font-size: 0.75rem; font-weight: 700; color: var(--text-secondary); display: block; margin-bottom: 6px; }
.chats-list { display: flex; flex-direction: column; gap: 6px; }

.chat-item-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.8rem;
  cursor: pointer;
}

.chat-item-btn:hover { border-color: var(--brand-accent); }
.chat-badge { font-family: monospace; font-size: 0.7rem; color: var(--status-cyan); }

.toggle-group {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.switch-wrap {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch-wrap input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--border-medium);
  border-radius: 24px;
  transition: 0.25s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.25s;
}

input:checked + .slider { background: var(--brand-accent); }
input:checked + .slider:before { transform: translateX(20px); }
.toggle-title { font-size: 0.85rem; font-weight: 700; color: var(--text-primary); display: block; }
.toggle-desc { font-size: 0.775rem; color: var(--text-muted); }

.checkbox-list { display: flex; flex-direction: column; gap: 10px; }
.custom-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  cursor: pointer;
}

.custom-checkbox input { position: absolute; opacity: 0; }
.checkmark {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  flex-shrink: 0;
}

.custom-checkbox input:checked ~ .checkmark {
  background: var(--brand-accent);
  border-color: var(--brand-accent);
}

.custom-checkbox input:checked ~ .checkmark::after {
  content: "✓";
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
}

.cb-content { display: flex; flex-direction: column; }
.cb-title { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.cb-desc { font-size: 0.75rem; color: var(--text-muted); }

.message-preview-box { margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--border-subtle); }
.preview-title { font-size: 0.75rem; font-weight: 700; color: var(--text-secondary); display: block; margin-bottom: 6px; }
.telegram-mock-message {
  background: #17212b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px;
  font-size: 0.825rem;
  line-height: 1.5;
  color: #f5f5f5;
}

/* ================= TOASTS ================= */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--bg-panel-elevated);
  border: 1px solid var(--border-medium);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  color: var(--text-primary);
  min-width: 260px;
  max-width: 420px;
  animation: toastSlideIn 0.25s ease-out;
}

.toast-success { border-left: 4px solid var(--status-emerald); }
.toast-error { border-left: 4px solid #e11d48; }
.toast-info { border-left: 4px solid var(--status-cyan); }

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   MOBILE RESPONSIVE PERFECTION (SMARTPHONE ADAPTATION)
   ========================================================================== */
@media (max-width: 768px) {
  .app-header {
    padding: 10px 14px;
  }

  .desktop-nav {
    display: none !important;
  }

  .mobile-nav-bar {
    display: flex;
  }

  .app-main-content {
    padding: 14px 14px 90px; /* room for mobile bottom bar */
  }

  .logo-text {
    font-size: 1.1rem;
  }

  .header-logo-frame {
    width: 32px;
    height: 32px;
  }

  .header-right {
    gap: 8px;
  }

  .user-pill {
    padding: 3px;
  }

  .user-info {
    display: none; /* keep clean avatar + logout */
  }

  .metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .metric-card {
    padding: 12px;
    gap: 10px;
  }

  .metric-icon {
    width: 36px;
    height: 36px;
  }

  .metric-value {
    font-size: 1.25rem;
  }

  .projects-toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
  }

  .toolbar-left, .toolbar-right {
    width: 100%;
    justify-content: space-between;
  }

  .search-box {
    min-width: 100%;
  }

  .filter-dropdown {
    width: 100%;
  }

  .filter-dropdown select {
    width: 100%;
  }

  /* Table on Mobile: converts to touch card layout (never scrolls horizontally or breaks!) */
  .table-container {
    background: transparent;
    border: none;
    box-shadow: none;
  }

  .data-table thead {
    display: none; /* Hide table headers on phone */
  }

  .data-table, .data-table tbody, .data-table tr, .data-table td {
    display: block;
    width: 100%;
  }

  .data-table tr {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
  }

  .data-table td {
    padding: 6px 0;
    border-bottom: none;
  }

  .data-table td:first-child {
    padding-top: 0;
  }

  .data-table td:last-child {
    padding-bottom: 0;
    border-top: 1px solid var(--border-subtle);
    margin-top: 8px;
    padding-top: 10px;
  }

  .table-actions {
    justify-content: space-between;
  }

  /* Dedicated page layout */
  .detail-page-layout {
    grid-template-columns: 1fr;
  }

  .page-card {
    padding: 18px 16px;
  }

  .detail-title {
    font-size: 1.35rem;
  }

  .detail-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .form-row {
    flex-direction: column;
    gap: 12px;
  }

  .status-buttons-row {
    flex-direction: column;
  }

  .btn-status-choice {
    width: 100%;
    justify-content: center;
  }

  .form-actions-bar {
    flex-direction: column;
  }

  .form-actions-bar .btn {
    width: 100%;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .view-header-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .settings-header-actions {
    width: 100%;
    flex-direction: column;
  }

  .settings-header-actions .btn {
    width: 100%;
  }
}
