:root {
    --bg: #0b0f1a;
    --bg-panel: #10162a;
    --bg-panel-hover: #161d38;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);

    /* KAIROS core palette */
    --accent: #2563ff;
    --accent-hover: #1d4ed8;
    --accent-soft: rgba(37, 99, 255, 0.12);
    --accent-secondary: #22d3ee;
    --accent-secondary-soft: rgba(34, 211, 238, 0.12);
    --accent-purple: #7c3aed;
    --accent-pink: #ec4899;

    --danger: #e0432a;
    --danger-soft: rgba(224, 67, 42, 0.12);

    --text: #ffffff;
    --text-muted: #a8b0c0;
    --text-faint: #6b7385;

    --radius: 10px;
    --radius-sm: 6px;

    --font-display: "Poppins", "Segoe UI", system-ui, sans-serif;
    --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
}

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

/* ==========================================================================
   Header
   ========================================================================== */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 40px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.app-header__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.02em;
    font-size: 15px;
    text-transform: uppercase;
}

.app-header__brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--accent-secondary);
}

.app-header__nav {
    display: flex;
    gap: 28px;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 14px;
}

.app-header__nav a.active {
    color: var(--text);
}

/* ==========================================================================
   Layout
   ========================================================================== */
.page {
    max-width: 1080px;
    margin: 0 auto;
    padding: 48px 40px 80px;
}

.page__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 32px;
}

.page__eyebrow {
    color: var(--accent-secondary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin: 0 0 8px;
}

.page__title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 28px;
    margin: 0;
    letter-spacing: -0.01em;
}

.page__subtitle {
    color: var(--text-muted);
    margin: 8px 0 0;
    font-size: 14px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, filter 0.15s ease;
}

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

.btn-primary:hover {
    background: var(--accent-hover);
}

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

.btn-ghost:hover {
    background: var(--bg-panel-hover);
}

.btn-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: rgba(224, 67, 42, 0.35);
}

.btn-danger:hover {
    background: rgba(224, 67, 42, 0.2);
}

.btn-sm {
    padding: 7px 14px;
    font-size: 13px;
}

/* ==========================================================================
   Panel / Table
   ========================================================================== */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

tbody td {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--bg-panel-hover);
}

.cell-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.cell-id {
    color: var(--text-faint);
    font-size: 12px;
    font-family: ui-monospace, "SFMono-Regular", monospace;
}

/* ==========================================================================
   Workspace cards (hub do projeto: pontos de diálogo / intents globais)
   ========================================================================== */
.workspace-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.workspace-card {
    display: block;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.workspace-card:hover {
    border-color: var(--accent);
    background: var(--bg-panel-hover);
}

.workspace-card__eyebrow {
    color: var(--accent-secondary);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0 0 10px;
}

.workspace-card__title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 18px;
    margin: 0 0 10px;
}

.workspace-card__desc {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.6;
    margin: 0 0 18px;
}

.workspace-card__cta {
    color: var(--accent-secondary);
    font-size: 13px;
    font-weight: 600;
}

/* ==========================================================================
   Breadcrumb (navegação dentro do contexto de um projeto)
   ========================================================================== */
.breadcrumb {
    color: var(--text-faint);
    font-size: 13px;
    margin-bottom: 8px;
}

.breadcrumb a {
    color: var(--text-muted);
}

.breadcrumb a:hover {
    color: var(--text);
}

/* ==========================================================================
   Empty state
   ========================================================================== */
.empty-state {
    padding: 64px 24px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state__title {
    color: var(--text);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 17px;
    margin: 0 0 8px;
}

/* ==========================================================================
   Form
   ========================================================================== */
.form-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 480px;
}

.field {
    margin-bottom: 20px;
}

.field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.field input[type="text"],
.field select,
.field textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 12px 14px;
    font-size: 14px;
    font-family: var(--font-body);
}

.field textarea {
    resize: vertical;
    line-height: 1.6;
    font-family: ui-monospace, "SFMono-Regular", monospace;
    font-size: 13px;
}

.field-hint {
    color: var(--text-faint);
    font-size: 12px;
    margin-top: 6px;
}

/* Painel de criação compacto embutido no topo das listagens */
.form-panel--compact {
    max-width: none;
    padding: 24px;
    margin-bottom: 24px;
}

.inline-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.inline-form .field {
    margin-bottom: 0;
}

.field--grow {
    flex: 1;
}

.field select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23A8B0C0'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 10.94l3.71-3.71a.75.75 0 111.06 1.06l-4.24 4.25a.75.75 0 01-1.06 0L5.21 8.29a.75.75 0 01.02-1.08z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 40px;
}

.field input[type="text"]:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.field-error {
    color: var(--danger);
    font-size: 13px;
    margin-top: 6px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 28px;
}

/* ==========================================================================
   Alerts (mensagens de feedback pós-ação)
   ========================================================================== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 24px;
    border: 1px solid transparent;
}

.alert-success {
    background: rgba(46, 204, 113, 0.1);
    border-color: rgba(46, 204, 113, 0.3);
    color: #4ade80;
}

.alert-error {
    background: var(--danger-soft);
    border-color: rgba(224, 67, 42, 0.35);
    color: var(--danger);
}

/* ==========================================================================
   Progress bar (status de importação)
   ========================================================================== */
.progress-track {
    width: 100%;
    height: 10px;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 999px;
    transition: width 0.4s ease;
}

/* ==========================================================================
   File input customizado
   ========================================================================== */
.file-field {
    display: flex;
    align-items: center;
    gap: 12px;
}
.file-field input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.file-field__button {
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    color: var(--accent);
}
.file-field__button:hover {
    background: rgba(37, 99, 255, 0.2);
    border-color: var(--accent);
}
.file-field__label {
    color: var(--text-muted);
    font-size: 14px;
}
.file-field__label.has-file {
    color: var(--text);
}

/* ==========================================================================
   Row stats (contagens com ícone, usado na listagem de projetos)
   ========================================================================== */
.row-stats {
    display: flex;
    gap: 16px;
}
.row-stat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-faint);
    font-size: 13px;
}
.row-stat svg {
    width: 14px;
    height: 14px;
    stroke: var(--text-faint);
    flex-shrink: 0;
}
.row-stat__value {
    color: var(--text-muted);
    font-weight: 600;
}

.row-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
}