/* ===== CSS Variables ===== */
:root {
  --sidebar-bg: #f0efec;
  --sidebar-width: 240px;
  --sidebar-text: #78716c;
  --sidebar-text-hover: #1c1917;
  --sidebar-active-bg: rgba(0,0,0,0.07);
  --sidebar-icon: #9d9892;
  --sidebar-icon-active: #1c1917;

  --main-bg: #f8f7f4;
  --topbar-bg: rgba(255,255,255,0.82);
  --topbar-height: 60px;
  --topbar-border: rgba(0,0,0,0.07);

  --card-bg: #ffffff;
  --card-border: transparent;
  --card-radius: 14px;
  --card-shadow: none;
  --card-padding: 24px;

  --accent: #f97316;
  --glass-bg: rgba(255,255,255,0.72);
  --glass-border: rgba(255,255,255,0.45);

  --btn-primary-bg: #111111;
  --btn-primary-text: #ffffff;
  --btn-radius: 9999px;

  --input-radius: 8px;
  --input-border: #d4d4d4;
  --input-focus-border: #111111;

  --color-amber: #f59e0b;
  --color-amber-bg: #fef3c7;
  --color-amber-text: #92400e;
  --color-blue: #3b82f6;
  --color-blue-bg: #dbeafe;
  --color-blue-text: #1e40af;
  --color-purple: #8b5cf6;
  --color-purple-bg: #ede9fe;
  --color-purple-text: #5b21b6;
  --color-green: #22c55e;
  --color-green-bg: #dcfce7;
  --color-green-text: #15803d;
  --color-red: #ef4444;
  --color-red-bg: #fee2e2;
  --color-red-text: #991b1b;
  --color-gray: #6b7280;
  --color-gray-bg: #f3f4f6;
  --color-gray-text: #374151;

  --text-primary: #111111;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;

  --font: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;

  --content-padding-v: 40px;
  --content-padding-h: 48px;
  --section-gap: 48px;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--main-bg);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { font-family: var(--font); cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: var(--font); }
ul, ol { list-style: none; }

/* ===== Login Page ===== */
#page-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--main-bg);
}
.login-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  padding: 48px 40px 40px;
  width: 480px;
  max-width: calc(100vw - 32px);
}
.login-brand {
  text-align: center;
  margin-bottom: 32px;
}
.login-brand-icon {
  width: 48px;
  height: 48px;
  background: var(--btn-primary-bg);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.login-brand-icon svg { stroke: #fff; }
.login-brand h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.login-brand p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.login-role-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.login-roles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 28px;
}
.role-card {
  border: 2px solid var(--card-border);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: left;
}
.role-card:hover { border-color: #a1a1aa; background: #fafafa; }
.role-card.active {
  border-color: var(--text-primary);
  background: var(--text-primary);
}
.role-card.active .role-card-icon { background: rgba(255,255,255,0.15); }
.role-card.active .role-card-icon svg { stroke: #fff; }
.role-card.active .role-card-name { color: #fff; }
.role-card.active .role-card-desc { color: rgba(255,255,255,0.6); }
.role-card-icon {
  width: 36px;
  height: 36px;
  background: var(--color-gray-bg);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.role-card-icon svg { stroke: var(--text-secondary); }
.role-card-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.role-card-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.login-divider { border: none; border-top: 1px solid var(--card-border); margin-bottom: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text-primary); margin-bottom: 6px; }
.form-input {
  width: 100%;
  border: 1px solid var(--input-border);
  border-radius: var(--input-radius);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}
.form-input:focus { border-color: var(--input-focus-border); }
.btn-login {
  width: 100%;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border-radius: var(--btn-radius);
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  margin-top: 8px;
  transition: opacity 0.15s;
  border: none;
  cursor: pointer;
}
.btn-login:hover { opacity: 0.85; }

/* ===== App Layout ===== */
#app {
  display: none;
  min-height: 100vh;
}
#app.active { display: flex; }

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  z-index: 100;
}
.sidebar-brand {
  padding: 24px 16px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-brand-icon {
  width: 32px;
  height: 32px;
  background: #1c1917;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-brand-icon svg { stroke: #ffffff; }
.sidebar-brand-info { flex: 1; min-width: 0; }
.sidebar-brand-name {
  font-size: 14px;
  font-weight: 700;
  color: #1c1917;
  letter-spacing: -0.2px;
  line-height: 1.2;
}
.sidebar-brand-sub {
  font-size: 11px;
  color: var(--sidebar-text);
  margin-top: 1px;
}
.sidebar-divider { border: none; border-top: 1px solid rgba(0,0,0,0.08); margin: 0 12px 8px; }
.sidebar-section-label {
  font-size: 11px;
  font-weight: 600;
  color: #3f3f46;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 8px 20px 4px;
}
.sidebar-nav { flex: 1; padding: 8px 12px; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
  margin-bottom: 2px;
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 500;
  user-select: none;
}
.nav-item svg { stroke: var(--sidebar-icon); flex-shrink: 0; transition: stroke 0.12s; }
.nav-item:hover {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-text-hover);
}
.nav-item:hover svg { stroke: var(--sidebar-icon-active); }
.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-text-hover);
  font-weight: 600;
}
.nav-item.active svg { stroke: var(--sidebar-icon-active); }
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(0,0,0,0.08);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  margin-bottom: 4px;
}
.sidebar-avatar {
  width: 32px;
  height: 32px;
  background: #1c1917;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: #1c1917; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: var(--sidebar-text); }
.btn-logout {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
  border: none;
  background: none;
  cursor: pointer;
}
.btn-logout svg { stroke: var(--sidebar-icon); }
.btn-logout:hover { background: rgba(0,0,0,0.05); color: #1c1917; }
.btn-logout:hover svg { stroke: #1c1917; }

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ===== Topbar ===== */
.topbar {
  height: var(--topbar-height);
  background: var(--topbar-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--topbar-border);
  display: flex;
  align-items: center;
  padding: 0 var(--content-padding-h);
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
  letter-spacing: -0.3px;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--btn-radius);
  font-size: 14px;
  font-weight: 500;
  transition: opacity 0.15s, background 0.15s, border-color 0.15s;
  cursor: pointer;
}
.btn svg { flex-shrink: 0; }
.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border: none;
}
.btn-primary:hover { opacity: 0.85; }
.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--card-border);
}
.btn-ghost:hover { background: var(--color-gray-bg); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-danger {
  background: transparent;
  color: var(--color-red-text);
  border: 1px solid #fca5a5;
}
.btn-danger:hover { background: var(--color-red-bg); }

/* ===== Page Content ===== */
.page-inner { padding: var(--content-padding-v) var(--content-padding-h); flex: 1; }
.section { margin-bottom: var(--section-gap); }
.section:last-child { margin-bottom: 0; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

/* ===== Cards ===== */
.card {
  background: var(--card-bg);
  border: 1px solid #ece9e5;
  border-radius: var(--card-radius);
  padding: var(--card-padding);
}
.card-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  padding: var(--card-padding);
}

/* ===== Chips / Status Tags ===== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.chip-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.chip-pending { background: var(--color-amber-bg); color: var(--color-amber-text); }
.chip-pending .chip-dot { background: var(--color-amber); }
.chip-active { background: var(--color-blue-bg); color: var(--color-blue-text); }
.chip-active .chip-dot { background: var(--color-blue); }
.chip-review { background: var(--color-purple-bg); color: var(--color-purple-text); }
.chip-review .chip-dot { background: var(--color-purple); }
.chip-done { background: var(--color-green-bg); color: var(--color-green-text); }
.chip-done .chip-dot { background: var(--color-green); }
.chip-urgent { background: var(--color-red-bg); color: var(--color-red-text); }
.chip-urgent .chip-dot { background: var(--color-red); }
.chip-gray { background: var(--color-gray-bg); color: var(--color-gray-text); }
.chip-gray .chip-dot { background: var(--color-gray); }

/* ===== Progress Bar ===== */
.progress-bar {
  height: 6px;
  background: #e7e5e4;
  border-radius: 9999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 9999px;
  background: var(--text-primary);
  transition: width 0.3s ease;
}
.progress-fill-green { background: var(--color-green); }
.progress-fill-blue { background: var(--color-blue); }

/* ===== Dashboard ===== */
.greeting-block { margin-bottom: 32px; }
.greeting-block h2 { font-size: 26px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.5px; }
.greeting-quote {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
  font-style: italic;
  border-left: 3px solid var(--card-border);
  padding-left: 12px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.stat-card { padding: 20px; }
.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.stat-value { font-size: 32px; font-weight: 700; color: var(--text-primary); letter-spacing: -1px; line-height: 1; }
.stat-unit { font-size: 14px; font-weight: 500; color: var(--text-secondary); margin-left: 2px; }
.stat-sub { font-size: 12px; color: var(--text-tertiary); margin-top: 6px; }
.stat-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.income-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.income-card { padding: 20px; }
.income-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.income-value { font-size: 28px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.5px; }
.income-unit { font-size: 14px; font-weight: 500; color: var(--text-secondary); }
.income-progress { margin-top: 12px; }
.income-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ===== Table ===== */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--card-radius);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
}
.data-table th {
  background: #fafaf9;
  border-bottom: 1px solid var(--card-border);
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f4f4f5;
  font-size: 14px;
  color: var(--text-primary);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 0.1s; }
.data-table tbody tr:hover { background: #fafaf9; }
.task-name-main { font-weight: 600; color: var(--text-primary); }
.task-name-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.table-num { color: var(--text-tertiary); font-size: 13px; }
.empty-state {
  padding: 32px 16px !important;
  text-align: center;
  color: var(--text-tertiary) !important;
  font-size: 13px !important;
}
.see-all-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.12s;
}
.see-all-link:hover { color: var(--text-primary); }

/* ===== Tasks Page ===== */
.tasks-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text-secondary);
  transition: all 0.12s;
  user-select: none;
}
.filter-chip .chip-count {
  background: var(--color-gray-bg);
  color: var(--text-secondary);
  border-radius: 9999px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
}
.filter-chip.active {
  background: var(--text-primary);
  color: #ffffff;
  border-color: var(--text-primary);
}
.filter-chip.active .chip-count { background: rgba(255,255,255,0.2); color: #fff; }
.filter-chip:hover:not(.active) { background: var(--color-gray-bg); }

.search-box {
  position: relative;
  flex-shrink: 0;
}
.search-box svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  stroke: var(--text-tertiary);
  pointer-events: none;
}
.search-input {
  border: 1px solid var(--input-border);
  border-radius: var(--btn-radius);
  padding: 7px 14px 7px 34px;
  font-size: 13px;
  outline: none;
  width: 200px;
  color: var(--text-primary);
  transition: border-color 0.15s;
}
.search-input:focus { border-color: var(--input-focus-border); }

.monthly-stats {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  margin-bottom: 16px;
}
.monthly-stat-item { font-size: 13px; color: var(--text-secondary); }
.monthly-stat-item strong { color: var(--text-primary); font-weight: 600; }
.monthly-stat-divider { width: 1px; height: 16px; background: var(--card-border); flex-shrink: 0; }

/* ===== Task Detail ===== */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  margin-bottom: 24px;
  transition: color 0.12s;
  border: none;
  background: none;
}
.back-btn svg { stroke: var(--text-secondary); transition: stroke 0.12s; }
.back-btn:hover { color: var(--text-primary); }
.back-btn:hover svg { stroke: var(--text-primary); }

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}
.detail-header-left { flex: 1; min-width: 0; }
.detail-chips { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.detail-id { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.detail-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}
.detail-subtitle { font-size: 14px; color: var(--text-secondary); }
.detail-actions { display: flex; gap: 8px; flex-shrink: 0; padding-top: 4px; }

.detail-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}
.detail-left > * + * { margin-top: 16px; }

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 20px;
}
.info-item-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.info-item-value { font-size: 14px; font-weight: 500; color: var(--text-primary); }

.quote-block {
  background: #111111;
  border-radius: 10px;
  padding: 16px 20px;
}
.quote-block-label {
  font-size: 11px;
  font-weight: 600;
  color: #71717a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.quote-block-value { font-size: 20px; font-weight: 700; color: #ffffff; }
.quote-block-sub { font-size: 12px; color: #71717a; margin-top: 4px; }

.req-section { padding: 20px; }
.req-block { margin-bottom: 20px; }
.req-block:last-child { margin-bottom: 0; }
.req-block-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.req-block-text { font-size: 14px; color: var(--text-primary); line-height: 1.7; }

.timeline-section { padding: 20px; }
.timeline-section-title { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 16px; }
.timeline { padding: 0; }
.timeline-item {
  display: flex;
  gap: 12px;
  position: relative;
  padding-bottom: 20px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 18px;
  bottom: 0;
  width: 1px;
  background: var(--card-border);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  flex-shrink: 0;
  margin-top: 2px;
}
.timeline-dot.active {
  border-color: var(--text-primary);
  background: var(--text-primary);
}
.timeline-action { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.timeline-time { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.info-card-rows { }
.info-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--card-border);
}
.info-card-row:last-child { border-bottom: none; }
.info-card-key { font-size: 13px; color: var(--text-secondary); }
.info-card-val { font-size: 13px; font-weight: 500; color: var(--text-primary); }

/* ===== New Task ===== */
.new-task-inner {
  max-width: 720px;
  margin: 0 auto;
}
.form-card { margin-bottom: 16px; }
.form-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.form-card-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--text-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.form-card-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-field { margin-bottom: 16px; }
.form-field:last-child { margin-bottom: 0; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-primary); margin-bottom: 6px; }
.form-label .required { color: var(--color-red); margin-left: 2px; }
.form-input-full {
  width: 100%;
  border: 1px solid var(--input-border);
  border-radius: var(--input-radius);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}
.form-input-full:focus { border-color: var(--input-focus-border); }
.form-textarea {
  width: 100%;
  border: 1px solid var(--input-border);
  border-radius: var(--input-radius);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  resize: vertical;
  transition: border-color 0.15s;
  min-height: 88px;
  line-height: 1.6;
}
.form-textarea:focus { border-color: var(--input-focus-border); }

.type-chips-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.type-chip-btn {
  padding: 7px 16px;
  border-radius: 9999px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s;
}
.type-chip-btn:hover { border-color: #a1a1aa; color: var(--text-primary); }
.type-chip-btn.active {
  background: var(--text-primary);
  color: #fff;
  border-color: var(--text-primary);
}

.urgency-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}
.toggle-track {
  width: 44px;
  height: 24px;
  border-radius: 9999px;
  background: #d4d4d8;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-track.on { background: var(--color-red); }
.toggle-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-track.on .toggle-thumb { transform: translateX(20px); }
.toggle-label { font-size: 13px; color: var(--text-secondary); }

.form-actions { display: flex; gap: 10px; margin-top: 8px; padding-bottom: 40px; }

/* ===== Estimator ===== */
.estimator-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  align-items: start;
}
.estimator-left > * + * { margin-top: 20px; }

.type-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.type-sel-card {
  border: 2px solid var(--card-border);
  border-radius: 10px;
  padding: 16px 12px;
  cursor: pointer;
  transition: all 0.12s;
  text-align: center;
  background: var(--card-bg);
}
.type-sel-card:hover { border-color: #a1a1aa; }
.type-sel-card.active {
  border-color: var(--text-primary);
  background: #f0f0ee;
}
.type-sel-card.active .type-sel-name { color: var(--text-primary); font-weight: 700; }
.type-sel-icon { font-size: 22px; margin-bottom: 6px; }
.type-sel-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }

.checklist-block { padding: 16px 20px; }
.checklist-title { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 12px; }
.checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--card-border);
  font-size: 13px;
  color: var(--text-primary);
}
.checklist-item:last-child { border-bottom: none; }
.check-icon { color: var(--color-green); font-size: 15px; flex-shrink: 0; }

.param-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.param-card { padding: 16px; }
.param-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}
.seg-group {
  display: flex;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  overflow: hidden;
}
.seg-btn {
  flex: 1;
  padding: 7px 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--card-bg);
  border: none;
  border-right: 1px solid var(--card-border);
  cursor: pointer;
  transition: all 0.12s;
  text-align: center;
}
.seg-btn:last-child { border-right: none; }
.seg-btn:hover:not(.active) { background: var(--color-gray-bg); }
.seg-btn.active { background: var(--text-primary); color: #fff; }

.slider-wrap { margin-top: 4px; }
input[type=range] {
  width: 100%;
  -webkit-appearance: none;
  height: 4px;
  border-radius: 9999px;
  background: #e7e5e4;
  outline: none;
  cursor: pointer;
  margin: 6px 0;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-primary);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  cursor: pointer;
}
.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
}
.slider-cur-val { font-size: 13px; font-weight: 600; color: var(--text-primary); text-align: right; margin-top: 2px; }

.addons-list { display: flex; flex-direction: column; gap: 8px; }
.addon-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
}
.addon-item input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--text-primary); cursor: pointer; flex-shrink: 0; }

.result-sticky {
  position: sticky;
  top: calc(var(--topbar-height) + 24px);
}
.result-dark-card {
  background: #ffffff;
  border: 1px solid #ece9e5;
  border-radius: var(--card-radius);
  padding: 24px;
}
.result-sec-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.result-big-num { font-size: 52px; font-weight: 800; color: var(--text-primary); letter-spacing: -2px; line-height: 1; }
.result-num-unit { font-size: 18px; font-weight: 500; color: var(--text-secondary); }
.result-range-text { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }
.result-sep { border: none; border-top: 1px solid #ece9e5; margin: 20px 0; }
.result-price-label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.result-price-val { font-size: 24px; font-weight: 700; color: var(--text-primary); }
.result-sep2 { border: none; border-top: 1px solid #ece9e5; margin: 16px 0; }
.breakdown-title { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.breakdown-list { display: flex; flex-direction: column; gap: 6px; }
.breakdown-item { display: flex; justify-content: space-between; font-size: 13px; }
.breakdown-label { color: var(--text-secondary); }
.breakdown-val { color: var(--text-primary); font-weight: 500; }

/* ===== Page visibility ===== */
.page { display: none; }
.page.active { display: flex; flex-direction: column; flex: 1; }
#page-login { min-height: 100vh; }
#page-login.active { display: flex; align-items: center; justify-content: center; flex: unset; min-height: 100vh; }

.designer-only { display: none !important; }
body.role-designer .designer-only { display: block !important; }
body.role-designer .designer-flex { display: flex !important; }
.designer-flex { display: none !important; }
body.role-designer .nav-designer { display: flex !important; }
.nav-designer { display: none !important; }

/* ===== Responsive ===== */
@media (max-width: 960px) {
  .sidebar { display: none; }
  .topbar { padding: 0 20px; }
  .page-inner { padding: 24px 20px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .income-grid { grid-template-columns: 1fr 1fr; }
  .detail-layout { grid-template-columns: 1fr; }
  .estimator-layout { grid-template-columns: 1fr; }
  .type-cards-grid { grid-template-columns: repeat(2, 1fr); }
  .param-cards-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .stat-grid { grid-template-columns: 1fr; }
  .income-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .detail-header { flex-direction: column; }
  .detail-actions { padding-top: 0; }
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 600;
}
.modal-overlay.active { display: flex; }
.modal-box {
  background: #fff;
  border-radius: 20px;
  padding: 32px;
  width: 420px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
}
.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}
.modal-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}
.modal-hours-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}
.modal-hours-input {
  flex: 1;
  border: 1px solid var(--input-border);
  border-radius: var(--input-radius);
  padding: 12px 48px 12px 16px;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}
.modal-hours-input:focus { border-color: var(--input-focus-border); }
.modal-hours-unit {
  position: absolute;
  right: 16px;
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
  pointer-events: none;
}
.modal-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 24px;
}
.modal-actions { display: flex; gap: 10px; }

/* ===== Dashboard / Analytics ===== */
.analytics-top {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  align-items: start;
}
.analytics-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.analytics-stat {
  padding: 20px;
}
.analytics-stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.analytics-stat-val {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1;
}
.analytics-stat-sub {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 5px;
}
.analytics-income-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.analytics-income-card {
  padding: 16px 18px;
}
.analytics-income-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.analytics-income-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

/* Calendar */
.calendar-wrap { padding: 20px; }
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.cal-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s;
  border: none;
  background: none;
}
.cal-nav-btn:hover { background: var(--color-gray-bg); }
.cal-nav-btn svg { stroke: var(--text-secondary); }
.cal-month-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}
.cal-weekday {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  padding: 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: default;
  position: relative;
  font-size: 13px;
  color: var(--text-secondary);
  transition: background 0.1s;
}
.cal-day.cur-month { color: var(--text-primary); }
.cal-day.today {
  background: var(--text-primary);
  color: #fff;
  font-weight: 700;
}
.cal-day.has-event { cursor: pointer; }
.cal-day.has-event:hover:not(.today) { background: var(--color-gray-bg); }
.cal-dot-row {
  display: flex;
  gap: 2px;
  position: absolute;
  bottom: 4px;
}
.cal-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
}
.cal-dot-submit { background: var(--color-blue); }
.cal-dot-complete { background: var(--color-green); }
.cal-dot-due { background: var(--color-amber); }

.cal-legend {
  display: flex;
  gap: 14px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f0eeeb;
  flex-wrap: wrap;
}
.cal-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-secondary);
}

.month-task-list { }
.month-task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f0eeeb;
  font-size: 13px;
}
.month-task-item:last-child { border-bottom: none; }
.month-task-date {
  font-size: 11px;
  color: var(--text-tertiary);
  width: 40px;
  flex-shrink: 0;
}
.month-task-title { flex: 1; font-weight: 500; color: var(--text-primary); }

/* ===== File Upload ===== */
.upload-zone {
  border: 2px dashed #d4d4d4;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  background: #fafaf9;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--text-primary);
  background: #f4f3f0;
}
.upload-zone-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--color-gray-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.upload-zone-icon svg { stroke: var(--text-secondary); }
.upload-zone-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.upload-zone-desc {
  font-size: 12px;
  color: var(--text-secondary);
}
.upload-file-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}
.upload-file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--color-gray-bg);
  border-radius: 8px;
  font-size: 13px;
}
.upload-file-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.file-word { background: #dbeafe; color: #1e40af; }
.file-ppt  { background: #fee2e2; color: #991b1b; }
.file-excel{ background: #dcfce7; color: #15803d; }
.file-img  { background: #ede9fe; color: #5b21b6; }
.file-pdf  { background: #fef3c7; color: #92400e; }
.upload-file-name { flex: 1; color: var(--text-primary); font-weight: 500; }
.upload-file-size { color: var(--text-tertiary); font-size: 12px; }
.upload-file-remove {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  transition: all 0.1s;
  flex-shrink: 0;
}
.upload-file-remove:hover { background: #e5e7eb; color: var(--text-primary); }


/* ===== Month selector (dashboard) ===== */
.month-selector-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.month-sel-btn {
  padding: 5px 13px;
  border-radius: 9999px;
  border: 1px solid var(--card-border, transparent);
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}
.month-sel-btn:hover { color: var(--text-primary); box-shadow: 0 0 0 1px rgba(0,0,0,0.2); }
.month-sel-btn.active {
  background: var(--text-primary);
  color: #fff;
  box-shadow: none;
}

/* ===== Task view tabs ===== */
.view-tabs {
  display: flex;
  gap: 0;
  background: var(--color-gray-bg);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 20px;
  width: fit-content;
}
.view-tab {
  padding: 6px 16px;
  border-radius: 8px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.view-tab.active {
  background: #fff;
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  font-weight: 600;
}
.month-select {
  height: 38px;
  min-width: 112px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: #fff;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 0 12px;
  outline: none;
}
.month-select:focus {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.08);
}

/* ===== Task Month Calendar ===== */
.task-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.task-cal-month-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.task-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid #ece9e5;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--card-shadow);
}
.task-cal-weekday {
  padding: 10px 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #fafaf8;
  border-bottom: 1px solid #ece9e5;
}
.task-cal-day {
  min-height: 100px;
  padding: 8px 6px;
  border-right: 1px solid #ece9e5;
  border-bottom: 1px solid #ece9e5;
  vertical-align: top;
  background: #fff;
  transition: background 0.1s;
}
.task-cal-day:hover { background: #fafaf8; }
.task-cal-day:nth-child(7n) { border-right: none; }
.task-cal-day.other-month { background: #fafaf8; }
.task-cal-day.other-month .task-cal-day-num { color: var(--text-tertiary); }
.task-cal-day.today .task-cal-day-num {
  background: var(--text-primary);
  color: #fff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.task-cal-day-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 24px;
  width: 24px;
  text-align: center;
}
.task-cal-events {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.task-cal-event {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  line-height: 1.6;
}
.task-cal-event:hover { filter: brightness(0.95); }
.event-active  { background: #dbeafe; color: #1e40af; }
.event-pending { background: #fef3c7; color: #92400e; }
.event-review  { background: #ede9fe; color: #5b21b6; }
.event-done    { background: #dcfce7; color: #15803d; }
.event-urgent  { border-left: 2px solid #ef4444; }

@media (max-width: 960px) {
  .task-cal-day { min-height: 70px; }
  .task-cal-event { font-size: 10px; }
}

/* ===== Month picker dropdown ===== */
.month-picker-wrap {
  position: relative;
  display: inline-block;
}
.month-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 13px;
  border-radius: 9999px;
  border: 1px solid #e0ddd9;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.12s;
  user-select: none;
}
.month-picker-btn svg { stroke: var(--text-secondary); transition: transform 0.15s; }
.month-picker-btn.open svg { transform: rotate(180deg); }
.month-picker-btn:hover { border-color: #bbb; }

.month-picker-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fff;
  border: 1px solid #e0ddd9;
  border-radius: 14px;
  padding: 12px;
  z-index: 200;
  width: 220px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
.month-picker-dropdown.open { display: block; }
.month-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.month-picker-opt {
  padding: 7px 4px;
  border-radius: 8px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.1s;
  border: none;
  background: none;
}
.month-picker-opt:hover { background: var(--color-gray-bg); color: var(--text-primary); }
.month-picker-opt.active {
  background: var(--text-primary);
  color: #fff;
  font-weight: 700;
}

/* ===== AI Chat Interface ===== */
.ai-bubble {
  max-width: 88%;
  border-radius: 16px;
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.75;
}
.ai-bubble-user {
  align-self: flex-end;
  background: #111111;
  color: #ffffff;
  border-radius: 16px 16px 4px 16px;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  max-width: min(72%, 640px);
  min-width: 0;
  padding: 10px 14px;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.ai-bubble-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ai-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #eef2ff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ai-avatar svg { stroke: #6366f1; }

/* Thinking bubble */
.ai-thinking-bubble {
  background: #fafaf9;
  border: 1px solid #ece9e5;
  border-radius: 12px;
  overflow: hidden;
}
.ai-thinking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid #ece9e5;
}
.ai-thinking-header:hover { background: #f5f4f0; }
.ai-thinking-label {
  font-size: 12px;
  font-weight: 600;
  color: #6366f1;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-thinking-toggle {
  font-size: 11px;
  color: var(--text-tertiary);
  transition: transform 0.2s;
}
.ai-thinking-toggle.open { transform: rotate(180deg); }
.ai-thinking-body {
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.8;
  white-space: pre-wrap;
  max-height: 240px;
  overflow-y: auto;
  display: none;
}
.ai-thinking-body.open { display: block; }

/* Response bubble */
.ai-response-bubble {
  background: #ffffff;
  border: 1px solid #ece9e5;
  border-radius: 16px 16px 16px 4px;
  padding: 16px 18px;
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.8;
  white-space: pre-wrap;
  min-width: 200px;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Streaming cursor */
.stream-cursor::after {
  content: '▋';
  display: inline-block;
  color: #6366f1;
  animation: cursor-blink 0.6s step-end infinite;
  margin-left: 1px;
  font-size: 0.85em;
}
@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Thinking spinner */
.thinking-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #c7d2fe;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Print option toggle */
.print-opt.active {
  background: #ffffff !important;
  color: #111111 !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
}

/* ===== Print toggle (exclusive) ===== */
.print-toggle-wrap {
  display: flex;
  background: #f3f4f6;
  border-radius: 9px;
  padding: 3px;
  gap: 2px;
}
.pto {
  flex: 1;
  padding: 7px 8px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  background: transparent;
  color: #6b7280;
  transition: all 0.15s;
  white-space: nowrap;
}
.pto.active {
  background: #ffffff;
  color: #111111;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ===== LLM Provider Settings ===== */
.ai-provider-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.ai-provider-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 260px;
  padding: 6px 12px;
  border-radius: 9999px;
  background: #f3f4f6;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-provider-badge.configured {
  background: #eef2ff;
  color: #4338ca;
}
.llm-settings-page {
  max-width: 1180px;
  margin: 0 auto;
}
.llm-settings-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}
.llm-muted {
  color: var(--text-secondary);
  font-size: 14px;
}
.llm-warning {
  padding: 14px 16px;
  border-radius: 14px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 24px;
}
.llm-provider-panel {
  margin-bottom: 28px;
}
.llm-provider-title {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 12px;
}
.llm-provider-grid {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.llm-provider-chip {
  position: relative;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 14px;
  background: #efefef;
  color: #6b7280;
  font-size: 14px;
  font-weight: 700;
  transition: background .15s, color .15s, transform .15s;
}
.llm-provider-chip:hover {
  transform: translateY(-1px);
  background: #e8e8e8;
}
.llm-provider-chip.active {
  background: #0f8cff;
  color: #ffffff;
}
.llm-provider-chip.recommended::after {
  content: '★';
  position: absolute;
  top: -8px;
  right: -4px;
  width: 22px;
  height: 18px;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  background: #f8aa00;
  color: #ffffff;
  font-size: 10px;
  line-height: 1;
}
.llm-tip {
  margin-top: 14px;
  color: var(--text-secondary);
  font-size: 13px;
}
.llm-config-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  align-items: start;
}
.llm-logo-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}
.llm-logo-preview {
  width: 92px;
  height: 92px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: #f3f4f6;
  color: #111111;
  font-size: 34px;
  font-weight: 800;
}
.llm-logo-title {
  font-size: 16px;
  font-weight: 800;
}
.llm-logo-sub {
  color: var(--text-secondary);
  font-size: 12px;
}
.llm-form {
  background: #fff;
  border-radius: 18px;
  padding: 24px;
}
.llm-switch-row {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.llm-switch-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.llm-switch-item input {
  width: 16px;
  height: 16px;
  accent-color: #111111;
}
.llm-save-status {
  color: var(--text-secondary);
  font-size: 13px;
}

@media (max-width: 900px) {
  .llm-settings-header,
  .ai-provider-summary {
    align-items: stretch;
    flex-direction: column;
  }
  .llm-config-grid {
    grid-template-columns: 1fr;
  }
  .llm-logo-card {
    align-items: flex-start;
    text-align: left;
  }
}
