:root {
  --bg: #f6f8f9;
  --card: #ffffff;
  --text: #17191c;
  --muted: #727985;
  --border: #dde2e6;
  --accent: #007f82;
  --accent-dark: #006d70;
  --accent-soft: #dceff0;
  --success: #39c77a;
  --danger: #b42318;
  --shadow: 0 6px 18px rgba(23, 25, 28, .06);
  --radius: 10px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: inherit; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.97); border-bottom: 1px solid var(--border); box-shadow: 0 2px 10px rgba(0,0,0,.025); }
.topbar-inner { max-width: 1672px; height: 76px; margin: 0 auto; padding: 0 40px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.topbar-brand-group, .topbar-actions { display: flex; align-items: center; gap: 28px; }
.brand { font-size: 26px; font-weight: 700; letter-spacing: .28em; text-decoration: none; white-space: nowrap; }
.brand-centered { text-align: center; }
.divider { width: 1px; height: 42px; background: var(--border); }
.workspace-label, .hello { font-size: 17px; }
.page-shell { width: min(1250px, calc(100% - 48px)); margin: 28px auto 64px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.project-overview { padding: 28px 34px 18px; }
.project-overview.compact { display: grid; grid-template-columns: 1fr 1.25fr; gap: 32px; align-items: center; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(27px, 3vw, 34px); letter-spacing: -.025em; }
h2 { font-size: 20px; margin-bottom: 0; }
.muted { color: var(--muted); }
.eyebrow { margin-bottom: 6px; color: var(--accent); font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.status-line { display: flex; align-items: center; gap: 12px; margin: 18px 0 22px; }
.status-dot { width: 22px; height: 22px; display: inline-grid; place-items: center; border-radius: 50%; color: #fff; background: var(--success); font-weight: 700; }
.progress-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 28px; box-shadow: 0 3px 12px rgba(0,0,0,.025); }
.progress-heading, .progress-meta, .card-heading, .chat-actions, .dialog-actions, .admin-intro { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.progress-heading strong { color: var(--accent); font-size: 38px; line-height: 1; }
.progress-track { height: 14px; margin: 14px 0 16px; overflow: hidden; background: #e4e7e9; border-radius: 999px; }
.progress-track span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #00989a); border-radius: inherit; transition: width .35s ease; }
.progress-meta { color: #3f4650; font-size: 14px; }
.dashboard-grid { display: grid; grid-template-columns: 1.08fr .96fr; gap: 28px; margin-top: 22px; align-items: stretch; }
.task-card, .chat-card, .secrets-admin { padding: 20px 24px 26px; min-width: 0; }
.card-heading { padding-bottom: 14px; }
.card-heading span { color: var(--accent); font-weight: 700; }
.table-wrap { overflow-x: auto; }
.task-table, .admin-table { width: 100%; border-collapse: collapse; }
.task-table th, .task-table td, .admin-table th, .admin-table td { border: 1px solid var(--border); padding: 12px 16px; text-align: left; }
.task-table th, .admin-table th { color: #444b54; background: #fbfcfc; font-weight: 600; }
.task-table td:first-child { width: 72px; text-align: center; }
.task-complete td:last-child { color: #9298a0; }
.checkbox-readonly { width: 19px; height: 19px; display: inline-grid; place-items: center; border: 1.5px solid #69717a; color: #fff; line-height: 1; }
.checkbox-readonly.checked { border-color: var(--accent); background: var(--accent); font-size: 13px; font-weight: 800; }
.chat-card { display: flex; flex-direction: column; }
.chat-history { min-height: 320px; max-height: 430px; overflow-y: auto; padding: 8px 0 18px; }
.chat-message { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 18px; }
.chat-message.mine { justify-content: flex-end; }
.avatar { flex: 0 0 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #e8eaec; font-size: 13px; font-weight: 700; }
.message-group { max-width: 78%; }
.message-bubble { padding: 11px 14px; border-radius: 7px; background: #eeeeef; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-message.mine .message-bubble { background: var(--accent-soft); }
.message-group time { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; }
.chat-message.mine time { text-align: right; }
.chat-form textarea { width: 100%; min-height: 92px; resize: vertical; border: 1px solid #cfd5da; border-radius: 7px; padding: 14px; outline: none; }
.chat-form textarea:focus, input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,127,130,.12); }
.chat-actions { margin-top: 14px; align-items: stretch; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 42px; padding: 9px 18px; border: 1px solid transparent; border-radius: 6px; font-weight: 650; text-decoration: none; }
.button-primary { color: #fff; background: var(--accent); }
.button-primary:hover { background: var(--accent-dark); }
.button-secondary { color: var(--text); background: #fff; border-color: var(--border); }
.button-outline { color: var(--accent); background: #fff; border-color: var(--accent); }
.button-small { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.button-full { width: 100%; }
.form-feedback { min-height: 20px; margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.form-feedback.error { color: var(--danger); }
.secret-dialog { width: min(570px, calc(100% - 28px)); max-height: 90vh; padding: 0; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 20px 70px rgba(0,0,0,.2); }
.secret-dialog::backdrop { background: rgba(20,24,28,.45); backdrop-filter: blur(2px); }
.dialog-content { padding: 34px; }
.dialog-close-form { position: absolute; right: 14px; top: 12px; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; font-size: 25px; }
.form-stack { display: grid; gap: 16px; }
.form-stack label { display: grid; gap: 7px; font-size: 14px; font-weight: 600; }
.form-stack input, .form-stack textarea { width: 100%; border: 1px solid #cfd5da; border-radius: 7px; padding: 11px 12px; background: #fff; }
.form-stack textarea { min-height: 82px; resize: vertical; }
.dialog-actions { justify-content: flex-end; margin-top: 4px; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.login-card { width: min(420px, 100%); padding: 38px; background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 16px 50px rgba(20,24,28,.08); }
.login-card h1, .login-card .eyebrow, .login-card > .muted { text-align: center; }
.alert { padding: 11px 13px; margin: 16px 0; border-radius: 7px; }
.alert-error { color: #8f1b12; background: #fff0ee; border: 1px solid #f2c7c2; }
.admin-intro { padding: 24px 28px; margin-bottom: 22px; }
.admin-intro h1 { margin-bottom: 4px; }
.admin-table td small { display: block; color: var(--muted); margin-top: 3px; }
.compact-progress { display: inline-block; width: 90px; height: 8px; margin-right: 9px; overflow: hidden; border-radius: 999px; background: #e4e7e9; vertical-align: middle; }
.compact-progress i { display: block; height: 100%; background: var(--accent); }
.token-result, .secret-view { padding: 14px; border: 1px solid #b8d8da; border-radius: 7px; background: #f1fbfb; overflow-wrap: anywhere; }
.back-link { display: inline-block; margin-bottom: 14px; color: var(--accent); text-decoration: none; }
.secrets-admin { margin-top: 22px; }
.secret-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 0; border-top: 1px solid var(--border); }
.secret-row small { display: block; margin-top: 4px; color: var(--muted); }
.empty-state, .empty-inline { padding: 40px; text-align: center; }
.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; }

@media (max-width: 900px) {
  .dashboard-grid, .project-overview.compact { grid-template-columns: 1fr; }
  .topbar-inner { padding: 0 22px; }
  .workspace-label, .hello, .divider { display: none; }
  .page-shell { width: min(100% - 28px, 760px); }
  .admin-table { min-width: 760px; }
}
@media (max-width: 600px) {
  .topbar-inner { height: 66px; }
  .brand { font-size: 19px; }
  .button { min-height: 44px; }
  .topbar-actions .button { padding: 8px 10px; font-size: 0; }
  .topbar-actions .button::first-letter { font-size: 18px; }
  .project-overview { padding: 22px 18px 16px; }
  .progress-card, .task-card, .chat-card, .secrets-admin { padding: 18px; }
  .progress-heading strong { font-size: 31px; }
  .progress-meta { align-items: flex-start; flex-direction: column; gap: 5px; }
  .chat-actions, .dialog-actions, .admin-intro { align-items: stretch; flex-direction: column; }
  .chat-actions .button { width: 100%; }
  .message-group { max-width: 86%; }
  .dialog-content { padding: 30px 20px 22px; }
}
