* {
    box-sizing: border-box;
}

:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --border: #e5e7eb;
    --text: #111827;
    --muted: #6b7280;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --danger-border: #fca5a5;
    --light: #f9fafb;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    text-decoration: none;
    color: inherit;
}

/* LOGIN */

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(37,99,235,0.08), transparent 30%),
        radial-gradient(circle at bottom right, rgba(16,185,129,0.08), transparent 30%),
        var(--bg);
}

.login-card {
    width: 100%;
    max-width: 430px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 34px;
    box-shadow: var(--shadow);
}

.login-card h1 {
    margin: 0 0 8px;
    font-size: 42px;
    line-height: 1.1;
}

.login-subtitle {
    margin: 0 0 26px;
    color: var(--muted);
    font-size: 16px;
}

/* LAYOUT */

.page {
    max-width: 1240px;
    margin: 0 auto;
    padding: 24px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.page-header-border {
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.page-header h1 {
    margin: 0 0 8px;
    font-size: 36px;
    line-height: 1.1;
}

.page-header p {
    margin: 0;
    color: var(--muted);
}

.page-header-left {
    flex: 1;
}

.back-link {
    display: inline-block;
    margin-bottom: 18px;
    color: #374151;
    font-weight: 600;
}

.patient-box {
    display: flex;
    gap: 16px;
    align-items: center;
}

.avatar {
    width: 74px;
    height: 74px;
    border-radius: 999px;
    background: #dbeafe;
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    flex-shrink: 0;
}

.patient-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    color: var(--muted);
    font-size: 14px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
}

.section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 14px;
    letter-spacing: .03em;
}

/* TOOLBAR */

.toolbar,
.tool-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tool-btn {
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    border-radius: 14px;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 600;
    transition: .2s ease;
}

.tool-btn:hover,
.tool-btn.active {
    background: #111827;
    color: #fff;
    border-color: #111827;
}

/* ODONTOGRAMA SIMPLE */

.chart-card {
    text-align: center;
}

.quadrant-title {
    font-size: 22px;
    font-weight: 700;
    color: #4b5563;
    margin: 14px 0 20px;
}

.quadrant-divider {
    border-top: 1px dashed #d1d5db;
    margin: 22px 0;
}

.teeth-row {
    display: flex;
    justify-content: center;
    gap: 22px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.tooth-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.tooth-number {
    font-size: 14px;
    color: var(--muted);
    font-weight: 600;
}

.tooth {
    width: 56px;
    height: 56px;
    border-radius: 999px;
    border: 1.8px solid #9ca3af;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: .18s;
    padding: 0;
}

.tooth:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(0,0,0,0.08);
}

.tooth.selected {
    border: 2px solid #111827;
    box-shadow: 0 0 0 4px rgba(17,24,39,0.08);
}

.tooth-inner {
    width: 16px;
    height: 16px;
    border: 1px solid rgba(107,114,128,0.5);
    border-radius: 4px;
    background: rgba(255,255,255,0.55);
}

.legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 24px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #4b5563;
    font-size: 14px;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
}

/* NOTAS */

.notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.notes-header h3 {
    margin: 0;
    font-size: 24px;
}

.info-box {
    padding: 14px 16px;
    border: 1px solid #f3d19e;
    background: #fff8eb;
    color: #9a6700;
    border-radius: 12px;
    margin-bottom: 16px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
}

.input,
.textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 15px;
    outline: none;
    background: #fff;
}

.textarea {
    min-height: 120px;
    resize: vertical;
}

.textarea-lg {
    min-height: 170px;
}

.input:focus,
.textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
}

/* TABLA */

.table-wrap {
    overflow-x: auto;
    margin-top: 16px;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead th {
    text-align: left;
    background: #f9fafb;
    color: #374151;
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.table tbody td {
    padding: 14px 12px;
    border-bottom: 1px solid #eef2f7;
    font-size: 15px;
}

.table tbody tr:hover {
    background: #fafcff;
}

.text-center {
    text-align: center;
}

/* BOTONES */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 16px;
    border-radius: 14px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: .18s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-sm {
    padding: 8px 12px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-dark {
    background: #111827;
    color: #fff;
}

.btn-light {
    background: #f3f4f6;
    color: #374151;
    border-color: #d1d5db;
}

.btn-outline-danger {
    background: #fff;
    color: var(--danger);
    border-color: var(--danger-border);
}

/* ALERTAS */

.alert {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 18px;
}

.alert-danger {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* RESPONSIVE */

@media (max-width: 900px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .notes-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .teeth-row {
        gap: 14px;
    }

    .login-card {
        padding: 26px;
    }

    .page {
        padding: 16px;
    }
}

@media (max-width: 768px) {
    .patient-box {
        align-items: flex-start;
    }

    .avatar {
        width: 60px;
        height: 60px;
        font-size: 22px;
    }

    .page-header h1 {
        font-size: 28px;
    }
}