/* ========== BiyoForm v2.1 — Light & Clean Theme ========== */

:root {
    --primary: #6366f1;
    --primary-light: #e0e7ff;
    --primary-dark: #4f46e5;
    --accent: #10b981;
    --accent-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-hover: #f1f5f9;
    --bg-input: #f8fafc;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-focus: #6366f1;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
    --radius: 10px;
    --radius-sm: 6px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
}

/* ========== Login Screen ========== */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e0e7ff 0%, #f8fafc 50%, #d1fae5 100%);
}

.login-card {
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 380px;
    text-align: center;
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 6px;
    color: var(--primary);
}

.login-logo h1 {
    font-size: 24px;
    font-weight: 700;
}

.version-badge {
    font-size: 10px;
    background: var(--primary-light);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 99px;
    font-weight: 600;
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 28px;
}

.login-card .form-group {
    text-align: left;
    margin-bottom: 14px;
}

.login-btn {
    width: 100%;
    padding: 12px;
    margin-top: 8px;
}

.login-link-btn {
    width: 100%;
    margin-top: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-secondary);
}

.login-link-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

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

.login-hint {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 12px;
}

/* ========== Layout ========== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ========== Sidebar ========== */
.sidebar {
    width: 240px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
}

.logo h1 {
    font-size: 18px;
    font-weight: 700;
}

.version {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 99px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
}

.nav-group-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 12px 12px 6px;
    text-transform: uppercase;
}

.nav-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
    font-family: inherit;
}

.nav-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.nav-btn.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 6px;
}

.user-badge {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    border-radius: 50%;
    font-size: 14px;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.sidebar-footer .nav-btn {
    font-size: 12px;
    padding: 8px 12px;
}

/* ========== Main Content ========== */
.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 24px 40px;
    max-width: none;
}

.section {
    display: none;
    animation: fadeIn 0.2s ease;
}

.section.active {
    display: block;
}

#admin-section {
    max-width: 1040px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    margin-bottom: 24px;
}

.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.form-header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.visit-permission-warning {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 600;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}

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

.section-header h2 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

/* ========== Cards ========== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg);
    border-radius: var(--radius) var(--radius) 0 0;
}

.card-header h3 {
    font-size: 14px;
    font-weight: 600;
}

.card-actions {
    display: flex;
    gap: 6px;
}

.card-body {
    padding: 16px 20px;
}

.form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) 340px;
    gap: 20px;
    align-items: start;
}

.form-grid {
    min-width: 0;
}

.form-grid .card {
    overflow: visible;
}

.form-visit-sidebar {
    position: sticky;
    top: 24px;
}

.form-visit-item {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: 8px;
}

.form-visit-item:hover,
.form-visit-item.active {
    background: var(--primary-light);
    border-color: var(--primary);
}

.form-visit-item-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    margin-bottom: 4px;
    color: var(--text-secondary);
}

.form-visit-item-drug {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

.form-visit-item-meta {
    font-size: 11px;
    color: var(--text-secondary);
}

.form-visit-sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

/* ========== Form Elements ========== */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input[type="text"],
input[type="password"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg-input);
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

textarea {
    resize: vertical;
}

.file-input {
    font-size: 12px;
    padding: 8px;
}

.input-with-action {
    display: flex;
    gap: 6px;
    align-items: stretch;
    flex-wrap: wrap;
}

.input-with-action input {
    flex: 1;
    min-width: 140px;
}

.seri-no-preview {
    font-size: 11px;
    color: var(--primary);
    margin-top: 2px;
    min-height: 16px;
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    white-space: nowrap;
}

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

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

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

.btn-save:hover {
    background: #059669;
}

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

.btn-print:hover {
    background: #d97706;
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--border);
}

.btn-outline:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--primary);
    cursor: pointer;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-sm:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

.btn-copy {
    background: var(--accent-light) !important;
    color: var(--accent) !important;
    border-color: var(--accent) !important;
}

.btn-copy:hover {
    background: var(--accent) !important;
    color: #fff !important;
}

.btn-today {
    background: var(--warning-light) !important;
    color: #92400e !important;
    border-color: var(--warning) !important;
}

.btn-today:hover {
    background: var(--warning) !important;
    color: #fff !important;
}

.btn-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s;
}

.btn-icon:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.btn-danger {
    color: var(--danger) !important;
    border-color: var(--danger) !important;
    background: transparent;
}

.btn-danger:hover {
    background: var(--danger) !important;
    color: #fff !important;
}

.btn-sm-action {
    padding: 6px 14px;
    font-size: 12px;
}

/* ========== Action Bar ========== */
.action-bar {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.autosave-indicator {
    display: none;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--accent);
    margin-top: 10px;
    text-align: right;
}

.autosave-indicator.show {
    display: flex;
    justify-content: flex-end;
}

.autosave-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

/* ========== Patient Split Layout ========== */
.patients-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    min-height: 500px;
}

.patients-left {
    display: flex;
    flex-direction: column;
}

.patients-right {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-height: 400px;
    overflow-y: auto;
}

.filter-bar {
    margin-bottom: 12px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group input[type="text"] {
    flex: 1;
}

.patient-list-header {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr;
    gap: 8px;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.patients-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    max-height: 500px;
}

.patient-row {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr;
    gap: 8px;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 13px;
}

.patient-row:hover,
.patient-row.selected {
    background: var(--primary-light);
    border-color: var(--primary);
}

.patient-row .p-name {
    font-weight: 600;
}

.patient-row .p-tc {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: monospace;
}

.patient-row .p-tani span {
    font-size: 11px;
}

.patient-row .p-visits {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 500;
}

.tag-accent {
    background: var(--accent-light);
    color: #065f46;
}

/* ========== Patient Detail Panel ========== */
.detail-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 12px;
    text-align: center;
    padding: 40px;
}

.patient-detail {
    padding: 20px;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.detail-name {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.detail-tc {
    font-size: 13px;
    color: var(--text-secondary);
    font-family: monospace;
    margin-right: 8px;
}

.detail-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.visits-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text);
}

.visit-history-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.visit-item {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
}

.visit-item:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.visit-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.visit-date {
    font-weight: 600;
    font-size: 13px;
}

.visit-seri {
    font-size: 11px;
    color: var(--text-muted);
    font-family: monospace;
}

.visit-drug {
    font-size: 12px;
    color: var(--primary);
    font-weight: 500;
}

.visit-doz {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: 8px;
}

.visit-count {
    font-size: 10px;
    background: var(--primary-light);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 99px;
    font-weight: 600;
}

/* ========== Users List ========== */
.users-list {
    margin-bottom: 12px;
}

.users-editor {
    min-width: 0;
}

.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.admin-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.admin-panel-card {
    margin-bottom: 20px;
}

.user-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.user-row:last-child {
    border-bottom: none;
}

.ur-name {
    font-weight: 600;
    font-size: 13px;
}

.ur-role {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 99px;
}

.ur-role.admin {
    background: var(--danger-light);
    color: var(--danger);
}

.ur-role.standard {
    background: var(--primary-light);
    color: var(--primary);
}

.user-management-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.user-directory,
.user-editor-card,
.serial-list-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
}

.user-directory.compact {
    padding: 14px;
}

.user-picker-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-picker-wrap label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.user-picker-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.user-directory-header,
.serial-list-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}

.user-directory-header span,
.serial-list-panel-header span,
.user-editor-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

.user-directory-list {
    display: flex;
    flex-direction: column;
    max-height: 360px;
    overflow-y: auto;
}

.user-select-row {
    width: 100%;
    border: none;
    border-bottom: 1px solid var(--border);
    background: transparent;
    padding: 12px 14px;
    text-align: left;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: background 0.15s, border-color 0.15s;
}

.user-select-row:last-child {
    border-bottom: none;
}

.user-select-row:hover,
.user-select-row.active {
    background: var(--primary-light);
}

.user-select-main {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-select-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.user-editor-card {
    padding: 16px;
    max-width: 100%;
}

.user-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 12px;
    margin-bottom: 14px;
}

.user-editor-header strong {
    display: block;
    font-size: 15px;
    margin-bottom: 4px;
}

.user-editor-save {
    display: flex;
    justify-content: flex-end;
}

/* ========== Serial ========== */
.serial-list-container {
    margin-top: 0;
}

.serial-view-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.serial-view-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.serial-drug-group {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}

.serial-list-panel {
    margin-bottom: 16px;
    padding: 12px;
}

.serial-list-panel-header {
    padding: 0 0 12px;
    margin-bottom: 12px;
}

.serial-list-panel .serial-list-container {
    min-height: 180px;
    max-height: 360px;
    overflow-y: auto;
    padding-right: 4px;
}

.serial-list-panel .empty-state {
    padding: 20px 12px;
}

.serial-drug-group h4 {
    font-size: 14px;
    margin-bottom: 10px;
}

.serial-drug-group .count {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 8px;
}

.serial-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.serial-group-actions {
    display: flex;
    gap: 6px;
}

.serial-bulk-delete {
    margin-top: 10px;
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

.sbd-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.sbd-row input {
    flex-shrink: 0;
}

.serial-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.serial-text-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.serial-text-list-flat {
    max-height: 180px;
    overflow-y: auto;
    padding-right: 4px;
}

.serial-item {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
    border: 1px solid transparent;
}

.serial-item.available {
    background: var(--accent-light);
    color: #065f46;
    border-color: rgba(16, 185, 129, 0.25);
}

.serial-item.reserved {
    background: var(--warning-light);
    color: #92400e;
    border: 1px dashed var(--warning);
}

.serial-item.used,
.serial-item.assigned {
    background: var(--bg);
    color: var(--text-muted);
    text-decoration: line-through;
    border-color: var(--border);
}

/* ========== History ========== */
.history-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.history-item:last-child {
    border-bottom: none;
}

.h-patient {
    font-weight: 600;
    font-size: 13px;
}

.h-details {
    font-size: 12px;
    color: var(--text-secondary);
}

.history-date {
    font-size: 12px;
    color: var(--text-muted);
}

/* ========== Modal ========== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-body {
    padding: 20px;
}

.modal-patient-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 12px;
    max-height: 50vh;
    overflow-y: auto;
}

.modal-patient-item {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
}

.modal-patient-item:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

.mp-name {
    font-weight: 600;
    font-size: 13px;
}

.mp-tc {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ========== Scanner ========== */
.scanner-modal-content {
    width: 520px;
}

.scan-instructions {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.scan-upload-area {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
}

.scan-preview {
    margin-top: 12px;
}

.scan-preview img {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.scan-progress {
    margin-top: 10px;
    background: var(--bg);
    border-radius: 99px;
    height: 24px;
    overflow: hidden;
    position: relative;
}

.scan-progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 99px;
    width: 0%;
    transition: width 0.3s;
}

#scan-progress-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--text-secondary);
}

.scan-results {
    margin-top: 16px;
}

.scan-results h4 {
    font-size: 14px;
    margin-bottom: 10px;
}

.scan-result-item {
    margin-bottom: 10px;
}

.scan-result-item label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    display: block;
    margin-bottom: 4px;
}

/* ========== Toast ========== */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.toast {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    animation: toastIn 0.3s ease;
    display: flex;
    gap: 8px;
    align-items: center;
    max-width: 360px;
}

.toast.success {
    background: var(--accent-light);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.toast.error {
    background: var(--danger-light);
    color: #991b1b;
    border: 1px solid #fecaca;
}

.toast.info {
    background: var(--primary-light);
    color: var(--primary-dark);
    border: 1px solid #c7d2fe;
}

.toast.warning {
    background: var(--warning-light);
    color: #92400e;
    border: 1px solid #fde68a;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

.empty-state p {
    font-size: 14px;
}

/* ========== Responsive ========== */
@media (max-width: 900px) {
    .form-layout {
        grid-template-columns: 1fr;
    }

    .form-visit-sidebar {
        position: static;
    }

    .patients-split {
        grid-template-columns: 1fr;
    }

    .user-management-layout {
        grid-template-columns: 1fr;
    }

    .patients-right {
        min-height: 300px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }

    .sidebar .logo h1,
    .version,
    .nav-group-label,
    .user-info,
    .sidebar-footer .nav-btn {
        display: none;
    }

    .nav-btn {
        justify-content: center;
        padding: 12px;
    }

    .main-content {
        margin-left: 60px;
        padding: 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .action-bar {
        flex-direction: column;
    }

    .form-header-actions {
        width: 100%;
        justify-content: flex-start;
    }
}
