/* Verba — base styles (Phase 1) */

:root {
    --bg: #f0f2f8;
    --bg-glass: rgba(255, 255, 255, 0.72);
    --border: rgba(15, 23, 42, 0.08);
    --text: #0f172a;
    --text-muted: #64748b;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --sidebar: #111827;
    --sidebar-text: #e2e8f0;
    --radius: 14px;
    --shadow: 0 8px 32px rgba(15, 23, 42, 0.08);
    --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

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

a {
    color: var(--primary);
    text-decoration: none;
}

code {
    font-size: 0.9em;
    background: rgba(15, 23, 42, 0.06);
    padding: 0.15em 0.4em;
    border-radius: 6px;
}

/* ── Auth / guest pages ── */

.auth-page-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 20% 20%, rgba(79, 70, 229, 0.12), transparent 40%),
        radial-gradient(circle at 80% 0%, rgba(14, 165, 233, 0.1), transparent 35%),
        var(--bg);
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem 1rem;
}

.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 2rem;
}

.install-card {
    max-width: 480px;
}

.auth-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-header h1 {
    margin: 0.75rem 0 0.25rem;
    font-size: 1.5rem;
}

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

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

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), #06b6d4);
    color: #fff;
    font-weight: 700;
}

.brand-mark--lg {
    width: 3rem;
    height: 3rem;
    font-size: 1.25rem;
}

/* ── Forms ── */

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font: inherit;
    background: rgba(255, 255, 255, 0.9);
}

.form-group input:focus {
    outline: 2px solid rgba(79, 70, 229, 0.25);
    border-color: var(--primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    border: none;
    border-radius: 10px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

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

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

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

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.875rem;
}

.btn-block {
    width: 100%;
}

.inline-form {
    display: inline;
}

/* ── Alerts ── */

.alert {
    padding: 0.85rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

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

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* ── App shell ── */

body {
    min-height: 100vh;
}

.app-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.support-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    background: #f59e0b;
    color: #78350f;
    text-align: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.sidebar {
    background: var(--sidebar);
    color: var(--sidebar-text);
    padding: 1.25rem 1rem;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding: 0 0.5rem;
}

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

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

.nav-item {
    display: block;
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    color: var(--sidebar-text);
    font-size: 0.9rem;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255, 255, 255, 0.08);
}

.nav-item--disabled {
    opacity: 0.45;
    cursor: default;
}

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

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
}

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

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-name {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.content {
    padding: 1.5rem;
}

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

.stat-card {
    padding: 1.25rem;
}

.stat-card h2,
.stat-card h3 {
    margin-top: 0;
}

.meta-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.35rem 1rem;
    margin: 0;
}

.meta-list dt {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.meta-list dd {
    margin: 0;
    font-weight: 600;
}

.checklist {
    list-style: none;
    padding: 0;
    margin: 0;
}

.checklist li {
    padding: 0.35rem 0;
    color: var(--text-muted);
}

.checklist li.done {
    color: var(--text);
}

.checklist li.done::before {
    content: "✓ ";
    color: #059669;
}

@media (max-width: 768px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }
}

/* ── Page layout ── */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.page-header h2 {
    margin: 0;
    font-size: 1.35rem;
}

.text-sm {
    font-size: 0.875rem;
}

.form-card,
.table-card {
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.form-card h3,
.table-card h3 {
    margin-top: 0;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font: inherit;
    background: rgba(255, 255, 255, 0.9);
}

.form-hint {
    margin: 0.35rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.search-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.search-bar input {
    flex: 1;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font: inherit;
}

.form-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
}

.form-inline .form-group {
    margin-bottom: 0;
    min-width: 180px;
}

/* ── Tables ── */

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

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

.data-table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

.table-actions {
    white-space: nowrap;
    text-align: right;
}

.btn-danger {
    color: #b91c1c;
}

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

.badge-active {
    background: #ecfdf5;
    color: #065f46;
}

.badge-suspended,
.badge-pending {
    background: #fef3c7;
    color: #92400e;
}

.support-exit-form {
    margin: 0;
}

/* ── Quote editor ── */

.page-header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.btn-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h3 {
    margin: 0;
}

.filters-bar select {
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font: inherit;
    background: #fff;
}

.quote-lines-table input[type="text"] {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
}

.quote-lines-table .line-description {
    min-width: 180px;
}

.quote-lines-table .line-note {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.line-actions {
    white-space: nowrap;
}

.totals-list {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.35rem 2rem;
    max-width: 320px;
    margin-left: auto;
}

.totals-list dt {
    color: var(--text-muted);
}

.totals-list dd {
    margin: 0;
    text-align: right;
    font-weight: 600;
}

.totals-list .total-final {
    font-size: 1.125rem;
    color: var(--primary);
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.form-group--checkbox label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
    padding-top: 1.75rem;
}

.badge-status-draft { background: #f1f5f9; color: #475569; }
.badge-status-sent { background: #eff6ff; color: #1d4ed8; }
.badge-status-accepted { background: #ecfdf5; color: #065f46; }
.badge-status-rejected { background: #fef2f2; color: #991b1b; }
.badge-status-archived { background: #f5f5f4; color: #78716c; }

/* ── PDF preview ── */

.preview-card {
    padding: 0;
    overflow: hidden;
}

.pdf-preview-wrap {
    background: #fff;
    padding: 1rem;
    overflow-x: auto;
    min-height: 480px;
}

.legal-content {
    font-size: 0.95rem;
    line-height: 1.6;
}

.legal-content h2,
.legal-content h3 {
    margin-top: 1.25rem;
}

/* ── Dark mode ── */

[data-theme="dark"] {
    --bg: #0f172a;
    --bg-glass: rgba(30, 41, 59, 0.88);
    --border: rgba(148, 163, 184, 0.12);
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --primary: #818cf8;
    --primary-hover: #a5b4fc;
    --sidebar: #020617;
    --sidebar-text: #cbd5e1;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] code {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .pdf-preview-wrap {
    background: #fff;
    color: #0f172a;
}

[data-theme="dark"] .badge-status-draft { background: #334155; color: #e2e8f0; }
[data-theme="dark"] .badge-status-sent { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge-status-accepted { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .badge-status-rejected { background: #7f1d1d; color: #fca5a5; }
[data-theme="dark"] .badge-status-archived { background: #44403c; color: #d6d3d1; }

.theme-toggle {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    border-radius: 8px;
    padding: 0.35rem 0.65rem;
    cursor: pointer;
    font-size: 0.85rem;
}

/* ── Logo crop ── */

.logo-preview {
    margin-bottom: 1rem;
}

.logo-preview img {
    max-height: 80px;
    max-width: 240px;
    object-fit: contain;
}

.logo-remove-form {
    margin-bottom: 1rem;
}

.form-hint {
    margin: 0.35rem 0 0;
    font-size: 0.875rem;
}

.logo-crop-panel {
    margin: 1rem 0;
}

.logo-crop-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.logo-crop-toolbar .is-active {
    border-color: var(--primary);
    color: var(--primary);
}

.logo-crop-stage {
    max-height: 420px;
    background: #e2e8f0;
    border-radius: var(--radius);
    overflow: hidden;
}

.logo-crop-stage img {
    display: block;
    max-width: 100%;
}

.logo-form-actions {
    margin-top: 0.5rem;
}

[data-theme="dark"] .logo-crop-stage {
    background: #334155;
}
