:root {
    --brand-primary: #1f3b63;
    --brand-secondary: #305b95;
    --brand-accent: #f29f5c;
    --brand-background: #eef6fb;
    --brand-surface: #ffffff;
    --brand-text: #1d2a35;
    --brand-muted: rgba(29, 42, 53, 0.6);
    --sidebar-gradient-start: #11243d;
    --sidebar-gradient-end: #1f3b63;
    --sidebar-text: #ffffff;
    --sidebar-width-collapsed: 64px;
    --sidebar-width-expanded: 220px;
    --surface-elevated: #ffffff;
    --surface-border: rgba(31, 59, 99, 0.2);
    --button-surface: #e6ebf4;
    --button-border: rgba(31, 59, 99, 0.25);
    --button-text: #1f3b63;
}

body {
    margin: 0;
    color: var(--brand-text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--brand-background);
}

body.layout {
    display: flex;
    min-height: 100vh;
    background: var(--brand-background);
}


.sidebar {
    flex: 0 0 var(--sidebar-width-collapsed);
    width: var(--sidebar-width-collapsed);
    background: linear-gradient(180deg, var(--sidebar-gradient-start) 0%, var(--sidebar-gradient-end) 100%);
    color: var(--sidebar-text, #ffffff);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.9rem 0.3rem;
    gap: 1.6rem;
    box-shadow: 0 10px 30px rgba(17, 36, 61, 0.35);
    transition: flex-basis 0.25s ease, width 0.25s ease, padding 0.25s ease;
}

.sidebar .brand {
    display: none;
}

.brand-name {
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.2;
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    white-space: nowrap;
}

.sidebar nav {
    width: 100%;
    flex: 1;
}

.sidebar nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sidebar nav li {
    width: 100%;
}

.nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0.55rem 0;
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
    position: relative;
}

.nav-link span {
    display: none;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    white-space: nowrap;
}

.nav-link i {
    font-size: 1.15rem;
    width: 32px;
    text-align: center;
}


.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

/* Expanded state on hover/focus */
.sidebar:hover,
.sidebar:focus-within {
    flex-basis: var(--sidebar-width-expanded);
    width: var(--sidebar-width-expanded);
    align-items: flex-start;
    padding: 1.5rem 1rem;
}

.sidebar:hover .brand,
.sidebar:focus-within .brand {
    display: flex;
}

.sidebar:hover .brand-name,
.sidebar:focus-within .brand-name {
    opacity: 1;
    transform: none;
}

.sidebar:hover nav,
.sidebar:focus-within nav {
    width: 100%;
}

.sidebar:hover .nav-link,
.sidebar:focus-within .nav-link {
    justify-content: flex-start;
    gap: 0.75rem;
    padding: 0.65rem 0.5rem;
}

.sidebar:hover .nav-link span,
.sidebar:focus-within .nav-link span {
    display: inline;
    opacity: 1;
    transform: none;
}

.sidebar-footer {
    width: 100%;
    padding: 0 1rem 1rem;
    box-sizing: border-box;
}

.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--brand-background);
}

.content-wrapper {
    padding: 2.5rem 3rem;
    flex: 1;
}

.page-heading {
    margin-bottom: 1.75rem;
}

.page-heading h1 {
    margin: 0;
    font-size: 1.9rem;
    color: var(--brand-primary);
}

.page-heading p {
    margin-top: 0.4rem;
    color: var(--brand-muted);
}

.public-link-banner {
    background: linear-gradient(135deg, var(--brand-surface), var(--brand-background));
    border-radius: 20px;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--surface-border);
    box-shadow: 0 20px 45px rgba(5, 17, 28, 0.22);
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    align-items: center;
    justify-content: space-between;
}

.public-link-title {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--brand-primary);
}

.public-link-subtitle {
    color: var(--brand-muted);
    font-size: 0.9rem;
}

.public-link-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: flex-end;
}

.public-link-actions .form-control {
    flex: 1 1 260px;
    min-width: 220px;
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    background-color: #ffffff !important;
    border-color: #cbd5e1;
    color: #334155 !important;
    font-weight: 500;
}

.public-link-actions .btn {
    white-space: nowrap;
}

.card {
    border-radius: 18px;
    background: var(--brand-surface);
    border: 1px solid var(--surface-border);
    box-shadow: 0 18px 36px rgba(5, 17, 28, 0.22);
    color: var(--brand-text);
}

.card-header,
.card-body,
.card-footer {
    background: transparent;
    color: var(--brand-text);
}

.btn-primary {
    background-color: var(--brand-secondary);
    border-color: var(--brand-secondary);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 10px 24px rgba(17, 36, 61, 0.25);
}

.btn-primary:focus,
.btn-primary:active {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #ffffff;
}

.btn-outline-primary {
    color: var(--brand-secondary);
    border-color: var(--brand-secondary);
}

.btn-outline-primary:hover,
.btn-primary:hover {
    background-color: var(--brand-accent);
    border-color: var(--brand-accent);
    color: #ffffff;
}

.btn-outline-secondary {
    color: var(--brand-secondary);
    border-color: var(--surface-border);
    background: rgba(255, 255, 255, 0.02);
}

.btn-outline-secondary:hover {
    background-color: var(--brand-primary);
    color: #ffffff;
    border-color: var(--brand-primary);
}

h1, h2, h3, h4, h5 {
    color: var(--brand-primary);
}

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

a:hover {
    color: var(--brand-secondary);
}

.alert-info {
    background-color: rgba(96, 165, 250, 0.12);
    border-color: rgba(96, 165, 250, 0.28);
    color: var(--brand-primary);
}

.alert-success {
    background-color: rgba(22, 163, 74, 0.16);
    border-color: rgba(22, 163, 74, 0.34);
    color: #166534;
}

.alert-warning {
    background-color: rgba(250, 204, 21, 0.16);
    border-color: rgba(250, 204, 21, 0.30);
    color: #854d0e;
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.16);
    border-color: rgba(239, 68, 68, 0.34);
    color: #991b1b;
}

.badge.bg-success {
    background-color: #2e8f55 !important;
}

.badge.bg-danger {
    background-color: #c04b4b !important;
}

/* Text utility classes */
.text-danger {
    color: #dc2626 !important;
}

.text-warning {
    color: #ca8a04 !important;
}

.text-success {
    color: #16a34a !important;
}

.text-info {
    color: #0284c7 !important;
}

/* Form validation */
.invalid-feedback {
    color: #dc2626 !important;
    font-weight: 500;
}

.is-invalid {
    border-color: #dc2626 !important;
}

.table thead {
    background: rgba(255, 255, 255, 0.04);
    color: var(--brand-text);
}

.table tbody tr {
    color: var(--brand-text);
    background: rgba(255, 255, 255, 0.01);
}

.table-striped>tbody>tr:nth-of-type(odd) {
    background: rgba(255, 255, 255, 0.02);
}

.table-hover>tbody>tr:hover {
    background: rgba(81, 163, 255, 0.08);
    color: var(--brand-text);
}

.table th,
.table td {
    border-color: var(--surface-border);
}

input.form-control,
textarea.form-control,
select.form-select {
    border-radius: 12px;
    border: 1px solid var(--surface-border);
    padding: 0.65rem 0.8rem;
    background: var(--surface-elevated);
    color: var(--brand-text);
}

input.form-control:disabled,
textarea.form-control:disabled,
select.form-select:disabled,
input.form-control[readonly],
textarea.form-control[readonly],
select.form-select[readonly] {
    background: color-mix(in srgb, var(--brand-surface) 70%, #020b14 30%);
    border-color: rgba(81, 163, 255, 0.22);
    color: rgba(214, 226, 248, 0.78);
    opacity: 1;
}

input.form-control::placeholder,
textarea.form-control::placeholder {
    color: var(--brand-muted);
    opacity: 0.72;
}

.btn-close {
    filter: invert(25%);
}

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

.modal-content {
    border-radius: 18px;
    border: none;
    box-shadow: 0 20px 40px rgba(31, 59, 99, 0.25);
}

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

.quick-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 1rem;
    padding: 1.9rem 1.8rem;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(238, 246, 251, 0.9) 100%);
    border: 1px solid rgba(17, 36, 61, 0.08);
    box-shadow: 0 28px 60px rgba(17, 36, 61, 0.14);
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
    min-height: 100%;
    overflow: hidden;
}

.quick-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(48, 91, 149, 0.16) 0%, rgba(242, 159, 92, 0.12) 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.quick-card > * {
    position: relative;
    z-index: 1;
}

.quick-card .icon {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    background: linear-gradient(140deg, rgba(48, 91, 149, 0.18) 0%, rgba(48, 91, 149, 0.05) 100%);
    box-shadow: inset 0 0 0 1px rgba(48, 91, 149, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.65rem;
    color: var(--brand-primary);
}

.quick-card h5 {
    font-size: 1.14rem;
    font-weight: 700;
    color: var(--brand-primary);
    margin-bottom: 0.2rem;
}

.quick-card p {
    color: color-mix(in srgb, var(--brand-text) 86%, rgba(17, 36, 61, 0.55) 14%);
    font-size: 0.93rem;
    margin-bottom: 0;
}

.quick-card .btn {
    margin-top: auto;
    align-self: flex-start;
    font-weight: 600;
    border-radius: 12px;
    padding: 0.6rem 1.25rem;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.quick-card .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(48, 91, 149, 0.28);
}

.quick-card:hover {
    transform: translateY(-10px);
    border-color: rgba(48, 91, 149, 0.25);
    box-shadow: 0 36px 72px rgba(17, 36, 61, 0.18);
}

.quick-card:hover::before {
    opacity: 1;
}

.photo-uploader-card {
    background: var(--brand-surface);
    border: 1px dashed rgba(48, 91, 149, 0.35);
    border-radius: 20px;
    padding: 1.2rem 1.3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.photo-preview-frame {
    width: 160px;
    height: 160px;
    border-radius: 20px;
    background: rgba(48, 91, 149, 0.08);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(17, 36, 61, 0.12);
}

.photo-preview-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    transition: transform 0.3s ease;
}

.photo-preview-frame.has-photo img {
    display: block;
}

.photo-preview-frame .photo-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.6rem;
    font-weight: 700;
    color: var(--brand-primary);
    background: linear-gradient(140deg, rgba(48, 91, 149, 0.15), rgba(48, 91, 149, 0.05));
}

.photo-preview-frame.has-photo .photo-fallback {
    display: none;
}

.photo-action-grid {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    width: 100%;
}

.photo-action-grid .btn {
    width: 100%;
}

.photo-action-grid .btn i {
    margin-right: 0.4rem;
}

.photo-action-grid small {
    display: block;
    text-align: center;
    color: var(--brand-muted);
}

.photo-uploader-card.compact .photo-preview-frame {
    width: 130px;
    height: 130px;
    border-radius: 18px;
}

.photo-uploader-card.compact .photo-action-grid .btn {
    font-size: 0.85rem;
    padding: 0.45rem 1.1rem;
}

@media (min-width: 992px) {
    .photo-preview-frame {
        width: 180px;
        height: 180px;
    }
}

.featured-card {
    border: 1px solid rgba(242, 159, 92, 0.4);
    background: linear-gradient(180deg, rgba(255, 247, 237, 0.96) 0%, rgba(255, 229, 203, 0.88) 100%);
    box-shadow: 0 36px 74px rgba(242, 159, 92, 0.28);
}

.featured-card::before {
    background: linear-gradient(140deg, rgba(242, 159, 92, 0.26) 0%, rgba(255, 194, 120, 0.18) 100%);
}

.featured-card .icon {
    background: linear-gradient(140deg, rgba(242, 159, 92, 0.25) 0%, rgba(242, 159, 92, 0.08) 100%);
    box-shadow: inset 0 0 0 1px rgba(242, 159, 92, 0.28);
    color: #c45f1b;
}

.featured-card .btn-outline-primary {
    color: #c45f1b;
    border-color: rgba(242, 159, 92, 0.35);
    background: rgba(255, 255, 255, 0.6);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.featured-card .btn-outline-primary:hover {
    background: linear-gradient(135deg, rgba(242, 159, 92, 0.85), rgba(242, 159, 92, 0.72));
    color: #ffffff;
    border-color: rgba(242, 159, 92, 0.55);
    box-shadow: 0 12px 26px rgba(242, 159, 92, 0.35);
    transform: translateY(-1px);
}

.footer {
    text-align: center;
    padding: 1.5rem 0;
    color: var(--brand-muted);
    font-size: 0.85rem;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 3rem 0.5rem;
    gap: 1.5rem;
    background: var(--brand-surface);
    border-bottom: 1px solid var(--surface-border);
    border-radius: 0 0 24px 24px;
    box-shadow: 0 12px 32px rgba(8, 24, 33, 0.18);
}

.topbar-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.clinic-logo {
    max-height: 80px;
    max-width: 420px;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(31, 59, 99, 0.15);
}

.clinic-name {
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    font-weight: 700;
    font-size: 1.8rem;
    color: var(--brand-primary);
    margin: 0;
    text-align: center;
    letter-spacing: -0.01em;
    text-shadow: 1px 1px 2px rgba(31, 59, 99, 0.08);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.topbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 1.6rem;
    text-decoration: none;
    color: var(--brand-primary);
}

.topbar-brand:hover {
    text-decoration: none;
    color: var(--brand-secondary);
}

.brand-heart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(242, 159, 92, 0.15), rgba(242, 159, 92, 0.05));
    border: 1px solid rgba(242, 159, 92, 0.28);
    box-shadow: 0 10px 18px rgba(242, 159, 92, 0.2);
}

.brand-heart img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.topbar-brand-heart {
    width: 52px;
    height: 52px;
    background: rgba(255, 255, 255, 0.85);
    border: 2px solid rgba(242, 159, 92, 0.32);
    box-shadow: 0 10px 22px rgba(242, 159, 92, 0.18);
}

.topbar-brand-heart img {
    width: 68%;
    height: 68%;
}

.topbar-brand-logo {
    height: 120px;
    width: auto;
    max-width: 420px;
    object-fit: contain;
    border-radius: 14px;
    display: block;
}

.topbar-title {
    font-family: 'Fredoka', 'Poppins', 'Segoe UI', sans-serif;
    font-weight: 700;
    font-size: 1.3rem;
    letter-spacing: 0.02em;
    color: var(--brand-primary);
    text-shadow: 2px 2px 4px rgba(31, 59, 99, 0.1);
}

.palette-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.6rem;
}

.palette-radio {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.palette-option {
    position: relative;
    border: 2px solid transparent;
    border-radius: 18px;
    padding: 1rem;
    background: var(--brand-surface);
    box-shadow: 0 10px 24px rgba(17, 36, 61, 0.08);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    min-height: 160px;
}

.palette-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(17, 36, 61, 0.12);
}

.palette-radio:focus-visible + .palette-option {
    outline: 2px solid var(--brand-secondary);
    outline-offset: 4px;
}

.palette-radio:checked + .palette-option {
    border-color: var(--brand-primary);
    box-shadow: 0 18px 32px rgba(17, 36, 61, 0.16);
}

.palette-option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.palette-option-name {
    font-weight: 700;
    color: var(--brand-primary);
    font-family: 'Poppins', 'Segoe UI', sans-serif;
}

.palette-option-tag {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: rgba(31, 59, 99, 0.1);
    color: var(--brand-primary);
    font-weight: 600;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.palette-radio:checked + .palette-option .palette-option-tag {
    opacity: 1;
    transform: translateY(0);
}

.palette-option-description {
    font-size: 0.85rem;
    color: var(--brand-muted);
}

.palette-swatch-row {
    display: flex;
    gap: 0.45rem;
}

.palette-swatch {
    flex: 1;
    height: 24px;
    border-radius: 999px;
    background: var(--swatch-color, #cccccc);
    border: 1px solid rgba(17, 36, 61, 0.1);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.highlight-card {
    animation: card-focus 2s ease-out;
    box-shadow: 0 0 0 0 rgba(45, 212, 191, 0.45);
}

@keyframes card-focus {
    0% {
        box-shadow: 0 0 0 0 rgba(45, 212, 191, 0.45);
    }
    40% {
        box-shadow: 0 0 0 6px rgba(45, 212, 191, 0.25);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(45, 212, 191, 0);
    }
}

.settings-card .settings-card-meta {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--brand-primary);
    margin-bottom: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    background: rgba(48, 91, 149, 0.12);
    border: 1px solid rgba(48, 91, 149, 0.18);
}

.custom-palette-editor {
    margin-top: 1.5rem;
    padding: 1.5rem;
    border-radius: 18px;
    border: 1px dashed rgba(31, 59, 99, 0.18);
    background: var(--brand-surface);
    box-shadow: 0 10px 30px rgba(17, 36, 61, 0.08);
}

.custom-palette-editor .form-control-color {
    width: 100%;
    height: 46px;
    padding: 0;
    border: 1px solid rgba(31, 59, 99, 0.2);
    border-radius: 12px;
}

.doctor-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
}

.doctor-action-bar {
    width: 100%;
}

.doctor-integration {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.45rem;
}

.doctor-action-note {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.35rem;
    color: var(--brand-muted);
    font-size: 0.85rem;
}

.doctor-action-note__label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 600;
}

.doctor-action-note__value {
    color: var(--brand-muted);
    font-weight: 500;
}

.doctor-action-inline-form,
.table-action-inline-form {
    margin: 0;
    display: inline-flex;
}

.action-icon-bar {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.45rem;
    justify-content: flex-end;
    align-items: center;
}

.action-icon {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    border: 1px solid rgba(31, 59, 99, 0.12);
    background: rgba(31, 59, 99, 0.08);
    color: var(--brand-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
    text-decoration: none;
    cursor: pointer;
}

.action-icon i {
    font-size: 1.15rem;
    line-height: 1;
}

.action-icon:hover,
.action-icon:focus {
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(17, 36, 61, 0.16);
}

.action-icon:focus {
    outline: none;
}

.action-icon--neutral {
    background: rgba(31, 59, 99, 0.08);
    border-color: rgba(31, 59, 99, 0.18);
    color: var(--brand-primary);
}

.action-icon--primary {
    background: rgba(48, 91, 149, 0.18);
    border-color: rgba(48, 91, 149, 0.35);
    color: #15396a;
}

.action-icon--info {
    background: rgba(13, 202, 240, 0.2);
    border-color: rgba(13, 202, 240, 0.3);
    color: #0a93b6;
}

.action-icon--warning {
    background: rgba(242, 159, 92, 0.22);
    border-color: rgba(242, 159, 92, 0.35);
    color: #a44e1d;
}

.action-icon--success {
    background: rgba(40, 167, 69, 0.2);
    border-color: rgba(40, 167, 69, 0.35);
    color: #1c6a34;
}

.action-icon--accent {
    background: rgba(242, 159, 92, 0.18);
    border-color: rgba(242, 159, 92, 0.3);
    color: #c96a26;
}

.action-icon--danger {
    background: rgba(220, 53, 69, 0.2);
    border-color: rgba(220, 53, 69, 0.36);
    color: #a71d33;
}

.action-icon--ghost {
    background: rgba(31, 59, 99, 0.05);
    border-color: rgba(31, 59, 99, 0.12);
    color: rgba(31, 59, 99, 0.7);
}

.topbar-user {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    gap: 0.25rem;
}

.topbar-user-icons {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
}

.topbar-user-name {
    font-size: 0.65rem;
    color: rgba(31, 59, 99, 0.5);
    font-weight: 500;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

/* Minimalist Topbar Components */
.btn-icon-minimal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(96, 165, 250, 0.2);
    background: rgba(96, 165, 250, 0.08);
    color: var(--brand-primary);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(31, 59, 99, 0.08);
}

.btn-icon-minimal:hover,
.btn-icon-minimal:focus {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.25);
}

.btn-icon-minimal:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(31, 59, 99, 0.15);
}

.user-avatar-btn {
    padding: 0;
    overflow: hidden;
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-language-minimal,
.user-menu-minimal {
    position: relative;
}

.user-menu-dropdown {
    border-radius: 16px;
    border: 1px solid rgba(96, 165, 250, 0.2);
    box-shadow: 0 12px 32px rgba(31, 59, 99, 0.2),
                0 4px 12px rgba(31, 59, 99, 0.12);
    padding: 0;
    margin-top: 0.5rem;
    min-width: 280px;
    overflow: hidden;
}

.user-menu-header {
    padding: 1rem 1.25rem;
    background: linear-gradient(145deg,
        color-mix(in srgb, var(--brand-surface) 98%, #ffffff 2%),
        color-mix(in srgb, var(--brand-surface) 90%, #e8f0fe 10%)
    );
    border-bottom: 1px solid rgba(96, 165, 250, 0.15);
    position: relative;
}

.user-menu-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        var(--brand-primary),
        var(--brand-secondary),
        var(--brand-accent)
    );
}

.user-menu-name {
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--brand-primary);
    margin: 0;
    line-height: 1.3;
}

.user-menu-org {
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(31, 59, 99, 0.7);
    margin: 0.25rem 0 0;
    line-height: 1.3;
}

.user-menu-badges {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    flex-wrap: wrap;
}

.user-menu-badges .badge {
    border-radius: 12px;
    padding: 0.4rem 0.9rem;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.user-menu-dropdown .dropdown-item {
    padding: 0.75rem 1.25rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.user-menu-dropdown .dropdown-item:hover {
    background: rgba(96, 165, 250, 0.08);
    color: var(--brand-primary);
}

.user-menu-dropdown .dropdown-item.text-danger:hover {
    background: rgba(220, 53, 69, 0.08);
    color: #dc3545;
}

.user-menu-dropdown .dropdown-divider {
    margin: 0;
    border-color: rgba(96, 165, 250, 0.15);
}

.topbar-user-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--brand-surface), var(--brand-background));
    border: 1px solid var(--surface-border);
    box-shadow: 0 12px 32px rgba(5, 17, 28, 0.25);
    min-width: 260px;
}

.topbar-user-top {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.topbar-user-badges {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.account-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    font-size: 0.75rem;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.account-type-badge:hover {
    color: #fff;
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    box-shadow: 0 6px 18px rgba(31, 59, 99, 0.2);
}

.topbar-user-main {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.topbar-user-main.single-action {
    justify-content: flex-end;
}

.topbar-user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.2rem;
    text-align: right;
}

.user-organization {
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(31, 59, 99, 0.75);
}

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

.user-language .dropdown-toggle {
    border-radius: 999px;
}

.topbar-user .user-name {
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--brand-primary);
}

.topbar-user .btn {
    border-radius: 999px;
    padding: 0.3rem 1.1rem;
    font-size: 0.85rem;
    color: var(--brand-primary);
    border-color: rgba(31, 59, 99, 0.35);
}

.topbar-user .btn:hover {
    color: #fff;
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.sidebar-toggle {
    display: none;
}

.sidebar-overlay {
    display: none;
}

@media (max-width: 992px) {
    body.layout {
        flex-direction: column;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1050;
        transform: translateX(-100%);
        flex-basis: var(--sidebar-width-expanded);
        width: var(--sidebar-width-expanded);
        padding: 2rem 1.5rem;
        align-items: flex-start;
        gap: 1.5rem;
        transition: transform 0.3s ease;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .brand-name {
        opacity: 1;
        transform: none;
    }

    .sidebar .brand {
        justify-content: flex-start;
        padding: 0;
    }

    .nav-link {
        justify-content: flex-start;
        padding: 0.75rem 1rem;
        gap: 0.85rem;
    }

    .nav-link span {
        display: inline;
        opacity: 1;
        transform: none;
    }

    body.sidebar-open .nav-link span {
        display: inline;
    }

    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(17, 36, 61, 0.45);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 1040;
    }

    body.sidebar-open .sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    .topbar {
        padding: 1.1rem 1.8rem 0.55rem;
        gap: 1.6rem;
    }

    .topbar-left {
        gap: 1.6rem;
    }

    .topbar-brand-heart {
        width: 44px;
        height: 44px;
    }

    .topbar-brand-logo {
        height: 46px;
        max-width: 160px;
    }

    .topbar-title {
        font-size: 1.15rem;
    }

    .sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        border-radius: 12px;
        border: none;
        background: var(--brand-primary);
        color: #fff;
        box-shadow: 0 8px 18px rgba(31, 59, 99, 0.25);
        cursor: pointer;
    }

    .sidebar-toggle:focus {
        outline: none;
        box-shadow: 0 0 0 3px rgba(31, 59, 99, 0.35);
    }

    .content-wrapper {
        padding: 1.75rem 1.5rem 2.5rem;
    }
}

@media (max-width: 768px) {
    .panel-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 1.25rem;
    }

    .quick-card {
        padding: 1.5rem;
    }
}

@media (max-width: 576px) {
    .content-wrapper {
        padding: 1.5rem 1rem 2rem;
    }

    .page-heading h1 {
        font-size: 1.55rem;
    }

    .panel-grid {
        grid-template-columns: 1fr;
    }

    .quick-card {
        align-items: flex-start;
        text-align: left;
    }

    .topbar {
        padding: 0.75rem 1rem 0.25rem;
        gap: 0.75rem;
        flex-wrap: wrap;
    }

    .topbar-center {
        width: 100%;
        order: 3;
        padding: 0.5rem 0;
        border-top: 1px solid rgba(31, 59, 99, 0.1);
    }

    .clinic-logo {
        max-height: 50px;
        max-width: 120px;
    }

    .clinic-name {
        font-size: 1.2rem;
    }

    .topbar-left {
        flex: 1;
        min-width: 0;
    }

    .topbar-brand {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
    }

    .topbar-brand-heart {
        width: 40px;
        height: 40px;
    }

    .topbar-brand-logo {
        height: 44px;
        max-width: 150px;
    }

    .topbar-title {
        font-size: 1rem;
        letter-spacing: 0.01em;
    }

    .topbar-user {
        width: auto;
        justify-content: flex-end;
    }

    .topbar-user-name {
        display: none;
    }

    .btn-icon-minimal {
        width: 38px;
        height: 38px;
        font-size: 1.15rem;
    }

    .user-menu-dropdown {
        min-width: 260px;
        max-width: calc(100vw - 2rem);
    }

    .topbar-user-card {
        width: 100%;
        min-width: 0;
        padding: 0.75rem 0.85rem;
    }

    .topbar-user-top {
        justify-content: space-between;
    }

    .topbar-user-badges {
        justify-content: flex-start;
    }

    .account-type-badge {
        font-size: 0.7rem;
        padding: 0.3rem 0.7rem;
    }

    .topbar-user-main {
        align-items: flex-start;
        gap: 0.65rem;
    }

    .topbar-user-main.single-action {
        justify-content: flex-start;
    }

    .topbar-user-info {
        align-items: flex-start;
        text-align: left;
    }

    .topbar-user .user-name {
        font-size: 0.95rem;
    }

    .user-organization {
        font-size: 0.8rem;
    }

    .topbar-user-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .topbar-user .btn {
        padding: 0.25rem 0.85rem;
        font-size: 0.8rem;
    }

    .card {
        border-radius: 12px;
    }

    .modal-content {
        border-radius: 12px;
        margin: 0.5rem;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .btn-lg {
        padding: 0.65rem 1.25rem;
        font-size: 1rem;
    }

    .btn-sm {
        padding: 0.35rem 0.75rem;
        font-size: 0.8rem;
    }

    .doctor-actions {
        align-items: flex-start;
        gap: 1.6rem;
    }

    .doctor-action-bar,
    .doctor-integration .action-icon-bar {
        justify-content: flex-start;
    }

    .doctor-action-note {
        justify-content: flex-start;
        gap: 0.25rem;
    }

    .action-icon-bar {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .palette-options {
        grid-template-columns: 1fr;
    }

    .custom-palette-editor {
        padding: 1.25rem;
    }

    input.form-control,
    textarea.form-control,
    select.form-select {
        font-size: 16px;
        padding: 0.75rem 0.85rem;
        border-radius: 10px;
    }

    .table {
        font-size: 0.85rem;
    }

    .table td,
    .table th {
        padding: 0.6rem 0.5rem;
    }
}

/* Adicionar responsividade extra para telas muito pequenas */
@media (max-width: 380px) {
    .content-wrapper {
        padding: 1.25rem 0.75rem 1.5rem;
    }

    .topbar {
        padding: 0.5rem 0.75rem 0.25rem;
    }

    .topbar-brand-heart {
        width: 36px;
        height: 36px;
    }

    .topbar-brand-logo {
        height: 40px;
        max-width: 140px;
    }

    .topbar-title {
        font-size: 0.9rem;
    }

    .sidebar-toggle {
        width: 38px;
        height: 38px;
    }

    .page-heading h1 {
        font-size: 1.35rem;
    }

    .card-body {
        padding: 1rem;
    }
}

/* Melhorias para tablets em paisagem */
@media (min-width: 768px) and (max-width: 992px) {
    .content-wrapper {
        padding: 2rem 2rem;
    }

    .topbar {
        padding: 1.25rem 2rem 0.5rem;
    }
}

/* Melhorias para touch e mobile em geral */
@media (hover: none) and (pointer: coarse) {
    /* Botões maiores para toque */
    .btn {
        min-height: 44px;
        padding: 0.65rem 1.2rem;
    }

    /* Links e áreas clicáveis maiores */
    .nav-link {
        min-height: 44px;
        padding: 0.75rem 1rem;
    }

    /* Inputs maiores para facilitar digitação */
    input.form-control,
    textarea.form-control,
    select.form-select {
        min-height: 44px;
        font-size: 16px;
    }

    /* Remover efeitos hover em touch */
    .feature-card:hover::before,
    .specialty-card:hover::before,
    .plan-card:hover::before {
        display: none;
    }

    /* Feedback visual ao tocar */
    .card, .btn, a {
        -webkit-tap-highlight-color: rgba(31, 59, 99, 0.1);
    }

    .btn:active {
        transform: scale(0.97);
        transition: transform 0.1s ease;
    }
}

/* Tabelas responsivas */
@media (max-width: 768px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        min-width: 600px;
    }

    .table-sm td,
    .table-sm th {
        padding: 0.5rem 0.4rem;
        font-size: 0.85rem;
    }
}

/* Modais em mobile */
@media (max-width: 576px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    .modal-body {
        padding: 1.25rem;
    }

    .modal-header {
        padding: 1rem 1.25rem;
    }

    .modal-footer {
        padding: 1rem 1.25rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        flex: 1;
        min-width: 120px;
    }
}

/* Melhorar área de toque em checkboxes e radios */
.form-check {
    min-height: 44px;
    display: flex;
    align-items: center;
}

.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0;
}

.form-check-label {
    margin-left: 0.5rem;
    cursor: pointer;
}

/* Cards em grid mobile */
@media (max-width: 576px) {
    .row.g-4 {
        gap: 1rem !important;
    }

    .row.g-3 {
        gap: 0.75rem !important;
    }

    .col-md-6, .col-lg-4, .col-lg-6 {
        margin-bottom: 1rem;
    }
}

/* Melhorar scroll horizontal em mobile */
.table-responsive,
.kanban-board-wrapper,
.overflow-auto {
    scrollbar-width: thin;
    scrollbar-color: rgba(31, 59, 99, 0.3) transparent;
}

.table-responsive::-webkit-scrollbar,
.kanban-board-wrapper::-webkit-scrollbar,
.overflow-auto::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track,
.kanban-board-wrapper::-webkit-scrollbar-track,
.overflow-auto::-webkit-scrollbar-track {
    background: transparent;
}

.table-responsive::-webkit-scrollbar-thumb,
.kanban-board-wrapper::-webkit-scrollbar-thumb,
.overflow-auto::-webkit-scrollbar-thumb {
    background: rgba(31, 59, 99, 0.3);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover,
.kanban-board-wrapper::-webkit-scrollbar-thumb:hover,
.overflow-auto::-webkit-scrollbar-thumb:hover {
    background: rgba(31, 59, 99, 0.5);
}
