:root {
    --primary-dark: #0f172a;
    --primary-medium: #1e293b;
    --accent: #2563eb;
    --soft-accent: #38bdf8;
    --bg: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-secondary: #475569;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0284c7;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

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

body {
    margin: 0;
    font-family: "Inter", system-ui, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

.app-body {
    min-height: 100vh;
}

.guest-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--primary-dark);
    color: #e2e8f0;
    padding: 1.25rem 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand-mark {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--accent), var(--soft-accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
}

.sidebar-brand-text {
    font-weight: 600;
    letter-spacing: 0.02em;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 1rem 0.75rem;
    gap: 0.25rem;
}

.sidebar-link {
    color: #94a3b8;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

.sidebar-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-link.is-active {
    color: #fff;
    background: rgba(37, 99, 235, 0.35);
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.topbar-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-name {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.badge-role {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    background: var(--bg);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.logout-form {
    margin: 0;
}

.content {
    padding: 1.5rem;
    flex: 1;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.grid-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metric {
    padding: 1.25rem;
}

.metric-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0.35rem 0;
}

.metric-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.section {
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.section-title {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.muted {
    color: var(--text-secondary);
    margin: 0;
}

.lead {
    font-size: 1.05rem;
    margin: 0 0 0.5rem;
}

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

.chip {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: var(--bg);
    border: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.page-placeholder {
    padding: 1.5rem;
}

.login-wrap {
    width: 100%;
    max-width: 420px;
}

.login-card {
    padding: 2rem;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.login-brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), var(--soft-accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
}

.login-brand-title {
    font-weight: 700;
    font-size: 1.125rem;
}

.login-brand-sub {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.login-heading {
    margin: 0 0 1rem;
    font-size: 1.25rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    margin-bottom: 0.5rem;
}

.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.btn {
    font: inherit;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-weight: 600;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    filter: brightness(1.05);
}

.btn-block {
    width: 100%;
    padding: 0.65rem 1rem;
    margin-top: 0.5rem;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    color: var(--accent);
}

.alert {
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.alert-danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.alert-success {
    background: #ecfdf3;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.alert-info {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    color: #0c4a6e;
}

.text-danger {
    color: var(--danger);
}

.btn-secondary {
    background: var(--primary-medium);
    color: #fff;
}

.btn-secondary:hover {
    filter: brightness(1.06);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
}

.settings-block {
    margin-bottom: 1.25rem;
}

.settings-form {
    max-width: 640px;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.inline-form-row {
    display: inline-block;
    margin: 0.5rem 0.75rem 0 0;
}

.grid-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    align-items: end;
}

.form-actions {
    display: flex;
    align-items: flex-end;
}

.subsection-title {
    margin: 1rem 0 0.5rem;
    font-size: 0.95rem;
}

.kv-list {
    margin: 0;
    padding-left: 1.2rem;
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th,
.data-table td {
    border-bottom: 1px solid var(--border);
    padding: 0.6rem 0.5rem;
    text-align: left;
    vertical-align: top;
}

.data-table th {
    color: var(--text-secondary);
    font-weight: 600;
}

.data-table code {
    font-family: ui-monospace, monospace;
    font-size: 0.85rem;
}

.two-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

.task-sample-list {
    margin: 0;
    padding-left: 1.1rem;
}

.chip-link {
    text-decoration: none;
    color: var(--accent);
    border-color: rgba(37, 99, 235, 0.35);
}

.chip-link:hover {
    background: rgba(37, 99, 235, 0.08);
}

.badge-risk {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-risk-low {
    background: #ecfdf3;
    color: #166534;
}

.badge-risk-medium {
    background: #fffbeb;
    color: #92400e;
}

.badge-risk-high {
    background: #fef2f2;
    color: #991b1b;
}

.badge-risk-critical {
    background: #450a0a;
    color: #fff;
}

.client-hero {
    margin-bottom: 0.5rem;
}

.report-md {
    white-space: pre-wrap;
    font-size: 0.85rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    max-height: 420px;
    overflow: auto;
}

.report-html-wrap {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    background: var(--surface);
}

.report-body {
    font-size: 0.95rem;
    line-height: 1.55;
}

.standup-md {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text);
}

.standup-md h1 {
    font-size: 1.35rem;
    font-weight: 600;
    margin: 1.25rem 0 0.5rem;
}

.standup-md h2 {
    font-size: 1.12rem;
    font-weight: 600;
    margin: 1.15rem 0 0.45rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border);
}

.standup-md h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0.85rem 0 0.35rem;
    color: var(--text-secondary);
}

.standup-md p {
    margin: 0.35rem 0 0.5rem;
}

.standup-md ul.standup-list {
    margin: 0.25rem 0 0.75rem 1.1rem;
    padding: 0;
    list-style: disc;
}

.standup-md ul.standup-list li {
    margin: 0.3rem 0;
}

.standup-md a {
    color: var(--accent);
}

.standup-generate-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    margin: 0.75rem 0 1rem;
}

.app-footer {
    padding: 0.75rem 1.5rem 1.25rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
}

.footer-debug-link {
    color: var(--text-secondary);
    text-decoration: none;
}

.footer-debug-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

.debug-pre {
    margin: 0;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    line-height: 1.45;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 8px;
    overflow: auto;
    max-height: 320px;
}

.debug-block {
    margin-bottom: 1rem;
}
