/**
 * LincWeb — tema escuro + azul, mobile first.
 */
:root {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #243044;
    --border: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 12px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    --safe-bottom: env(safe-area-inset-bottom, 0);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100dvh;
}

.app-shell {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 16px calc(24px + var(--safe-bottom));
}

/* Login */
.login-page {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 0;
}

.login-card {
    width: 100%;
}

.login-brand {
    text-align: center;
    margin-bottom: 24px;
}

.login-brand h1 {
    margin: 12px 0 4px;
    font-size: 1.5rem;
}

.login-brand p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.icon-lg {
    width: 48px;
    height: 48px;
    color: var(--primary);
}

/* Topbar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.topbar-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}

.card-highlight {
    border-color: rgba(59, 130, 246, 0.45);
    background: linear-gradient(135deg, #1e293b 0%, #172554 100%);
}

.card h2 {
    margin: 0 0 8px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hint {
    margin: 0 0 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Forms */
.form-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.form-mt {
    margin-top: 12px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 120px;
}

.field-grow {
    flex: 1 1 180px;
}

.field span {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.field input[type="text"],
.field input[type="search"],
.field input[type="date"],
.field input[type="number"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    font-size: 16px; /* evita zoom no iOS */
}

.field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.field-check {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.field-check input {
    width: 18px;
    height: 18px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    background: var(--border);
    transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
    touch-action: manipulation;
}

.btn:active {
    transform: scale(0.98);
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: #475569;
}

.btn-success {
    background: var(--success);
    color: #052e16;
}

.btn-warning {
    background: var(--warning);
    color: #422006;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
}

.btn-sm {
    padding: 8px 12px;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
}

.inline-form {
    display: inline;
}

/* Alerts */
.alert {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.alert-success,
.alert-info {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.alert-info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.4);
}

/* Empresa cards */
.empresa-card.is-blocked {
    opacity: 0.85;
    border-color: rgba(239, 68, 68, 0.35);
}

.empresa-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.empresa-card-head h3 {
    margin: 0 0 4px;
    font-size: 1rem;
    word-break: break-word;
}

.cnpj-tag {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: ui-monospace, monospace;
}

.badge {
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 999px;
    font-weight: 600;
    flex-shrink: 0;
}

.badge-success {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.empresa-meta {
    margin: 10px 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.list-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 8px 0;
}

.empty-state {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 40px;
    height: 40px;
    margin-bottom: 8px;
    opacity: 0.6;
}

.hidden {
    display: none !important;
}

/* Details (accordion) */
.details-panel summary {
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.details-panel summary::-webkit-details-marker {
    display: none;
}

.delete-form {
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-top: 12px;
}

@media (min-width: 480px) {
    .form-inline .btn {
        flex-shrink: 0;
    }
}
