:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #10b981;
    --success-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --warning: #f59e0b;
    --warning-hover: #d97706;
    --dark: #0f172a;
    --light-bg: #f8fafc;
    --border-color: #cbd5e1;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --sidebar-bg: #0b0f19;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03), 0 20px 25px -5px rgba(0, 0, 0, 0.05);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    /* Old variable mappings for view compatibility */
    --blue: #2563eb;
    --blue-dark: #1d4ed8;
    --green: #10b981;
    --amber: #b45309;
    --red: #ef4444;
    --slate: #0f172a;
    --muted: #64748b;
    --bg: #f8fafc;
    --white: #ffffff;
    --border: #cbd5e1;
    --radius: 12px;
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100%;
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--light-bg);
    color: var(--dark);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

img,
svg {
    max-width: 100%;
}

[hidden] {
    display: none !important;
}

/* APP SHELL */

/* ============================================================
   SIDEBAR — final (clinic-grade, modern, sober)
   Categorii clare, iconuri inline-SVG monocrome, accent albastru
   coeziv cu restul aplicatiei. Stare activa = pastila + bara-accent
   + chip de icon luminos.

   IMPORTANT (cascada): exista un al doilea bloc de sidebar mai jos
   in fisier ("RESTORED PREMIUM VERTICAL COLLAPSIBLE SIDEBAR", ~3610+)
   care redefineste .sidebar/.brand/.nav-link/.nav-icon etc. Acel bloc
   vine DUPA acesta, deci la specificitate egala ar castiga el. De aceea
   selectorii de aici sunt ANCORATI pe .app-shell / .sidebar (specificitate
   mai mare) ca acest redesign sa se aplice efectiv. Numele claselor
   structurale + width:260px sunt pastrate intacte pentru regulile de
   collapse / mobil / print care le refera.
   ============================================================ */

:root {
    /* Sidebar DESCHIS (clinic-clean): fundal aproape alb, accent albastru
       coeziv cu restul aplicatiei (KPI/butoane). Selectorii raman ancorati
       (.app-shell .sidebar / .sidebar .X) ca sa bata blocul duplicat de mai jos. */
    --side-bg-top: #ffffff;
    --side-bg-mid: #f8fafd;
    --side-bg-bottom: #eef3fa;
    --side-accent: #2563eb;        /* albastru aplicatie */
    --side-accent-strong: #1d4ed8;
    --side-accent-soft: #3b82f6;
    --side-accent-glow: rgba(37, 99, 235, 0.28);
    --side-text: #475569;          /* link normal — slate, contrast bun pe alb */
    --side-text-active: #1d4ed8;   /* activ = albastru */
    --side-text-dim: #64748b;      /* iconuri, subtitlu */
    --side-heading: #94a3b8;       /* antete categorii */
    --side-hairline: #e7ecf3;      /* borduri/separatoare */
    --side-surface: #eef2f8;       /* hover + nota roluri */
    --side-teal: #0d9488;          /* strop de teal medical (accent secundar) */
    --side-teal-soft: #14b8a6;
}

.app-shell {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
}

/* Selector ancorat pe .app-shell ca sa bata blocul duplicat de mai jos.
   width/min-width 260px pastrate (collapse->70px si mobil depind de ele). */
.app-shell .sidebar {
    width: 260px;
    min-width: 260px;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    background:
        radial-gradient(120% 55% at 0% 0%, rgba(59, 130, 246, 0.10) 0%, rgba(59, 130, 246, 0) 60%),
        linear-gradient(185deg, var(--side-bg-top) 0%, var(--side-bg-mid) 55%, var(--side-bg-bottom) 100%);
    color: var(--side-text);
    padding: 22px 14px;
    border-right: 1px solid var(--side-hairline);
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 100;
    -webkit-font-smoothing: antialiased;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.18) transparent;
}

/* Scrollbar discret in sidebar */
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.16);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.30);
    background-clip: padding-box;
}

.main {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Brand — logo OS + OrtoSmart + subtitlu. justify-content normal (nu
   space-between ca in blocul duplicat) ca logo+text sa stea lipite. */
.sidebar .brand {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    margin-bottom: 20px;
    padding: 4px 6px 18px;
    border-bottom: 1px solid var(--side-hairline);
}

.sidebar .brand-logo {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 13px;
    background: linear-gradient(140deg, var(--side-accent-soft) 0%, var(--side-accent-strong) 55%, var(--side-teal) 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #ffffff;
    font-size: 15px;
    letter-spacing: 0.01em;
    box-shadow: 0 6px 16px -4px var(--side-accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.28);
    flex-shrink: 0;
}

.sidebar .brand-title {
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.1;
    letter-spacing: -0.01em;
}

.sidebar .brand-subtitle {
    margin-top: 3px;
    color: var(--side-text-dim);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* Antet categorie — punct-accent + separator fin (mod collapse le ascunde). */
.sidebar .nav-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 18px 0 6px;
    padding: 0 8px 0 10px;
    color: var(--side-heading);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .14em;
}

.sidebar .nav-section-title::before {
    content: "";
    width: 6px;
    height: 6px;
    min-width: 6px;
    border-radius: 50%;
    background: var(--side-teal-soft);
    box-shadow: 0 0 8px rgba(20, 184, 166, 0.55);
    flex-shrink: 0;
}

.sidebar .nav-section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(148, 163, 184, 0.16), rgba(148, 163, 184, 0));
}

/* Link navigare */
.sidebar .nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 10px;
    color: var(--side-text);
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 1px;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.sidebar .nav-link:hover {
    color: #1e293b;
    background: var(--side-surface);
}

.sidebar .nav-link.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.18) 0%, rgba(59, 130, 246, 0.04) 70%, rgba(59, 130, 246, 0) 100%);
    color: var(--side-text-active);
    font-weight: 600;
}

/* Bara-accent activa (overlay, nu border — nu strica radius-ul) */
.sidebar .nav-link.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 7px;
    bottom: 7px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: linear-gradient(180deg, var(--side-accent-soft), var(--side-accent-strong));
    box-shadow: 0 0 10px var(--side-accent-glow);
}

/* Icon — chip patrat, inline-SVG monocrom (currentColor). */
.sidebar .nav-icon {
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 8px;
    background: #eef2f7;
    border: 1px solid #e3e9f1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--side-text-dim);
    transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.sidebar .nav-icon svg {
    width: 17px;
    height: 17px;
    display: block;
}

.sidebar .nav-link:hover .nav-icon {
    color: var(--side-accent-soft);
    background: #e4ecfb;
    border-color: #d3e0fa;
}

.sidebar .nav-link.active .nav-icon {
    color: #ffffff;
    background: linear-gradient(140deg, var(--side-accent-soft), var(--side-accent-strong));
    border-color: transparent;
    box-shadow: 0 4px 12px -2px var(--side-accent-glow);
}

/* Nota roluri (Roluri curente) */
.sidebar .sidebar-note {
    margin-top: auto;
    padding: 12px 13px;
    border-radius: 12px;
    background: var(--side-surface);
    border: 1px solid var(--side-hairline);
    color: var(--side-text-dim);
    font-size: 11px;
    line-height: 1.5;
}

.sidebar .sidebar-note strong {
    color: var(--side-accent-soft);
    font-weight: 600;
}

.topbar {
    min-height: 64px;
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 24px;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.03em;
    color: var(--dark);
}

.user-box {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-meta {
    text-align: right;
}

.user-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--dark);
}

.user-role {
    color: #64748b;
    font-size: 11px;
    font-weight: 500;
}

.logout-btn {
    min-height: 34px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--dark);
    font-weight: 600;
    font-size: 12px;
    transition: var(--transition);
}

.logout-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.account-link {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--dark);
    font-weight: 600;
    font-size: 12px;
    text-decoration: none;
    transition: var(--transition);
}

.account-link:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.account-link.active {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.content {
    min-width: 0;
    padding: 24px;
    flex: 1;
    /* Pe ecrane late (ex. 2560px) continutul se intindea edge-to-edge si parea
       risipit. Il limitam si il centram; sub aceasta latime ramane 100% (laptop/mobil). */
    width: 100%;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
}

/* GENERAL COMPONENTS */

.card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
}

.card-body {
    padding: 20px;
}

.section {
    border: 1px solid var(--border-color);
    background: #f8fafc;
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
}

.section-subtitle {
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
    margin-top: -6px;
    margin-bottom: 12px;
}

.page-actions,
.actions-row,
.inline-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.page-actions {
    justify-content: space-between;
    margin-bottom: 16px;
}

.muted {
    color: #64748b;
}

.strong {
    font-weight: 600;
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

/* BUTTONS */

.btn,
.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger,
.btn-soft,
.btn-link-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 16px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
}

.btn-secondary {
    background: white;
    color: var(--dark);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.btn-success {
    background: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}

.btn-success:hover {
    background: #d1fae5;
    border-color: #6ee7b7;
}

.btn-danger {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.btn-danger:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

.btn-soft,
.btn-link-action {
    background: #eff6ff;
    color: #2563eb;
    border-color: #bfdbfe;
}

.btn-soft:hover,
.btn-link-action:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

.btn-sm {
    min-height: 32px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

/* BADGES */

.badge,
.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    border: 1px solid transparent;
    transition: var(--transition);
}

.badge.blue,
.status-pill.blue {
    background: #eff6ff;
    color: #2563eb;
    border-color: #bfdbfe;
}

.badge.green,
.status-pill.green {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}

.badge.amber,
.status-pill.amber {
    background: #fffbef;
    color: #b45309;
    border-color: #fde68a;
}

.badge.orange,
.status-pill.orange {
    background: #fff7ed;
    color: #c2410c;
    border-color: #fed7aa;
}

.badge.red,
.status-pill.red {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}

.badge.gray,
.status-pill.gray {
    background: #f8fafc;
    color: #475569;
    border-color: #cbd5e1;
}

/* FORMS */

.form-grid,
.form-grid-3,
.form-grid-4,
.form-grid-auto,
.grid-2,
.grid-3,
.grid-4 {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.form-grid > *,
.grid-2 > * {
    flex: 1 1 48%;
}

.form-grid-3 > *,
.grid-3 > * {
    flex: 1 1 31%;
}

.form-grid-4 > *,
.grid-4 > * {
    flex: 1 1 23%;
}

.form-grid-auto > * {
    flex: 1 1 190px;
}

.form-field.full {
    flex-basis: 100%;
}

.form-field label {
    display: block;
    margin-bottom: 6px;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: white;
    color: var(--dark);
    outline: none;
    padding: 8px 12px;
    font-size: 13px;
    transition: var(--transition);
}

.form-field input,
.form-field select {
    min-height: 38px;
}

.form-field textarea {
    min-height: 100px;
    resize: vertical;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus,
.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

/* Checkbox/radio dintr-un .form-field NU trebuie sa preia stilul de input text (lat 100% +
   bordura + inaltime 38px + inel de focus) — raman casute native, langa eticheta. */
.form-field input[type="checkbox"],
.form-field input[type="radio"] {
    width: 17px;
    height: 17px;
    min-height: 0;
    flex: 0 0 auto;
    border: 0;
    border-radius: 0;
    padding: 0;
    background: none;
}

.form-field input[type="checkbox"]:focus,
.form-field input[type="radio"]:focus {
    border: 0;
    box-shadow: none;
}

.form-help {
    margin-top: 6px;
    color: #64748b;
    font-size: 12px;
    line-height: 1.4;
}

.form-error {
    margin-top: 6px;
    color: var(--danger);
    font-size: 12px;
    font-weight: 600;
}

/* ALERTS */

.alert-success,
.alert-error,
.alert-warning {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 600;
    line-height: 1.5;
    font-size: 13px;
    border: 1px solid transparent;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.alert-warning {
    background: #fffbef;
    color: #b45309;
    border-color: #fde68a;
}

/* SEARCH */

.search-box {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    min-height: 42px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: white;
    outline: none;
    padding: 0 16px;
    font-size: 13px;
    transition: var(--transition);
}

.search-input:focus {
    background-color: #f8fafc;
    background-repeat: no-repeat;
    background-position: right 12px center;
}

/* TABLES */

.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    color: #475569;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: #f8fafc;
    font-weight: 600;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    vertical-align: middle;
}

.data-table tr:hover td {
    background: #f8fafc;
}

.table-compact th,
.table-compact td {
    padding: 8px 12px;
}

.money {
    font-weight: 700;
    white-space: nowrap;
}

.money.good {
    color: var(--success);
}

.money.warn {
    color: var(--warning);
}

.meta {
    margin-top: 4px;
    color: #64748b;
    font-size: 12px;
    line-height: 1.4;
}

.empty-box {
    padding: 24px;
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-md);
    background: white;
    color: #64748b;
    font-weight: 600;
    text-align: center;
}

/* ORDERS PAGE */

.orders-page {
    width: 100%;
    min-width: 0;
}

.orders-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.orders-search {
    flex: 1 1 auto;
}

.orders-new-btn {
    flex: 0 0 auto;
    min-width: 145px;
}

.orders-mobile-back {
    display: none;
    margin-bottom: 12px;
}

.orders-shell {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.orders-list-panel {
    width: 480px;
    min-width: 320px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.orders-detail-panel {
    min-width: 0;
    flex: 1;
}

.orders-detail-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    overflow: hidden;
    min-height: 520px;
}

.orders-list-head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: #fbfdff;
}

.orders-list-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.1;
}

.orders-list-count {
    margin-top: 4px;
    color: #64748b;
    font-size: 12px;
}

.orders-list {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8fafc;
    max-height: calc(100vh - 136px);
    overflow-y: auto;
}

.order-row {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: white;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    text-align: left;
    color: var(--dark);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    transition: var(--transition);
}

button.order-row {
    font: inherit;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
}

.order-row:hover {
    border-color: #93c5fd;
    background: #f0f7ff;
    transform: translateY(-1px);
}

.order-row.active {
    border-color: var(--primary);
    background: #eff6ff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.05);
    border-left: 4px solid var(--primary);
}

.order-row.urgent {
    border-color: #fecaca;
}

.order-row.urgent:hover {
    border-color: #fca5a5;
    background: #fff5f5;
}

.order-row.urgent.active {
    border-color: var(--danger);
    background: #fef2f2;
    border-left: 4px solid var(--danger);
}

.order-row-main {
    min-width: 0;
    flex: 1;
}

.order-row-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.order-row-number {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.15;
}

.order-priority {
    min-height: 20px;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}

.order-priority.normal {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.order-priority.urgent {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.order-row-patient {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 4px;
}

.order-row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 3px 8px;
    color: #64748b;
    font-size: 11px;
    line-height: 1.25;
}

.order-row-side {
    min-width: 88px;
    text-align: right;
}

.order-row-rest {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.1;
}

.order-row-rest-label {
    margin-top: 2px;
    color: #64748b;
    font-size: 11px;
}

.orders-empty {
    padding: 16px;
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-md);
    background: white;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.orders-list-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: #fbfdff;
}

/* ORDER DETAIL */

.order-file {
    background: white;
}

.order-file-header {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    background: #fbfdff;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.order-file-number {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--dark);
}

.order-file-patient {
    margin-top: 4px;
    color: #64748b;
    font-size: 12px;
}

.order-file-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.order-file-actions .btn-sm,
.order-file-actions .btn-soft {
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.order-file-status {
    padding: 6px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 16px;
    background: white;
}

.status-text {
    color: #64748b;
    font-size: 12px;
}

.status-text strong {
    color: var(--dark);
    font-weight: 600;
}

.order-money-strip {
    margin: 8px 16px;
    display: flex;
    gap: 10px;
}

.money-cell {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    background: #ffffff;
    border-left: 4px solid #cbd5e1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.money-cell span {
    display: block;
    margin-bottom: 4px;
    color: #64748b;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.money-cell strong {
    display: block;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--dark);
}

.money-cell.total {
    border-left-color: #6366f1;
}

.money-cell.cas {
    border-left-color: #10b981;
}

.money-cell.patient {
    border-left-color: #8b5cf6;
}

.money-cell.rest {
    border-left-color: #ef4444;
}

.money-cell.rest strong {
    color: #ef4444;
}

.order-warning-line {
    margin: 0 20px 16px;
    padding: 10px 12px;
    border: 1px solid #fde68a;
    border-radius: var(--radius-md);
    background: #fffbeb;
    color: #92400e;
    font-size: 12px;
    font-weight: 600;
}

.order-compact-section {
    margin: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: white;
}

.order-section-head {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    background: #fbfdff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.order-section-head span {
    font-size: 13px;
    font-weight: 700;
    color: var(--dark);
}

.order-section-head small {
    color: #64748b;
    font-size: 11px;
    font-weight: 600;
}

.order-products-list {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.order-mini-list {
    padding: 4px 12px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.order-product-row {
    display: flex;
    gap: 12px;
    padding: 12px;
    border: 1px solid #f1f5f9;
    border-radius: var(--radius-md);
    background: #f8fafc;
    transition: var(--transition);
}

.order-product-row:hover {
    border-color: #e2e8f0;
    background: #f1f5f9;
}

.product-index {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 9999px;
    background: #eff6ff;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}

.product-main {
    min-width: 0;
    flex: 1;
}

.product-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
    color: var(--dark);
}

.product-meta,
.product-note {
    margin-top: 4px;
    color: #64748b;
    font-size: 12px;
    line-height: 1.35;
}

.product-side {
    min-width: 120px;
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
}

.product-price {
    font-size: 13px;
    font-weight: 600;
}

.product-cas {
    color: #b45309;
    font-size: 12px;
    font-weight: 600;
}

.order-two-columns {
    display: flex;
    gap: 12px;
    margin: 0 16px 8px;
}

.order-two-columns .order-compact-section {
    margin: 0;
    flex: 1;
    min-width: 0;
}

.order-mini-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 3px 0;
    border: none;
    border-bottom: 1px solid #f1f5f9;
    border-radius: 0;
    background: transparent;
}

.order-mini-row:last-child {
    border-bottom: none;
}

.order-mini-row strong {
    display: block;
    font-size: 12px;
    line-height: 1.15;
    font-weight: 600;
}

.order-mini-row span {
    display: block;
    margin-top: 1px;
    color: #64748b;
    font-size: 11px;
}

.order-mini-row b {
    white-space: nowrap;
    color: var(--success);
    font-size: 12px;
    font-weight: 600;
}

.order-empty-line,
.order-detail-empty {
    padding: 16px;
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-md);
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    background: white;
}

.order-notes {
    padding: 12px;
    color: var(--dark);
    font-size: 13px;
    line-height: 1.5;
}

/* PAGINATION */

.custom-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 11px;
    border-radius: 10px;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    font-size: 13px;
    font-weight: 1000;
}

.page-btn.disabled {
    background: #f1f5f9;
    color: #94a3b8;
    border-color: #e2e8f0;
    cursor: not-allowed;
}

.page-info {
    color: #64748b;
    font-size: 12px;
    font-weight: 900;
}

/* RESPONSIVE */

@media (max-width: 1200px) {
    .orders-list-panel {
        width: 360px;
        min-width: 310px;
    }

    .order-money-strip {
        flex-wrap: wrap;
    }

    .money-cell {
        flex: 1 1 45%;
    }

    .order-two-columns {
        flex-direction: column;
    }

    .grid-4 > *,
    .form-grid-4 > *,
    .grid-3 > *,
    .form-grid-3 > * {
        flex-basis: 48%;
    }
}

@media (max-width: 980px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: relative;
        width: 100%;
        min-width: 0;
        height: auto;
        padding: 13px;
    }

    .topbar {
        position: relative;
    }

    .orders-shell {
        display: block;
    }

    .orders-list-panel {
        width: 100%;
        min-width: 0;
        margin-bottom: 12px;
    }

    .orders-detail-card {
        min-height: 0;
    }

    .orders-list {
        max-height: none;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 13px;
    }

    .topbar {
        min-height: auto;
        align-items: flex-start;
        flex-direction: column;
        padding: 13px;
    }

    .user-box {
        width: 100%;
        justify-content: space-between;
    }

    .user-meta {
        text-align: left;
    }

    .orders-toolbar {
        display: block;
    }

    .orders-search {
        width: 100%;
        margin-bottom: 8px;
    }

    .orders-new-btn {
        width: 100%;
    }

    .orders-mobile-back {
        display: none;
        width: 100%;
    }

    body.orders-detail-open .orders-mobile-back {
        display: inline-flex;
    }

    body.orders-detail-open .orders-list-panel {
        display: none;
    }

    body.orders-detail-open .orders-detail-panel {
        display: block;
    }

    body:not(.orders-detail-open) .orders-list-panel {
        display: block;
    }

    body:not(.orders-detail-open) .orders-detail-panel {
        display: none;
    }

    .order-row {
        display: block;
    }

    .order-row-side {
        text-align: left;
        min-width: 0;
        margin-top: 7px;
    }

    .order-file-header {
        display: block;
    }

    .order-file-actions {
        margin-top: 10px;
        width: 100%;
    }

    .order-file-actions a {
        flex: 1;
    }

    .order-money-strip {
        display: block;
    }

    .money-cell {
        margin-bottom: 8px;
    }

    .order-product-row {
        display: flex;
        align-items: flex-start;
    }

    .product-side {
        min-width: 0;
        text-align: left;
        align-items: flex-start;
        margin-top: 8px;
    }

    .product-main {
        width: 100%;
    }

    .order-product-row {
        flex-wrap: wrap;
    }

    .product-index {
        order: 1;
    }

    .product-main {
        order: 2;
        flex: 1 1 calc(100% - 34px);
    }

    .product-side {
        order: 3;
        flex: 1 1 100%;
        margin-left: 32px;
    }

    .form-grid > *,
    .form-grid-3 > *,
    .form-grid-4 > *,
    .form-grid-auto > *,
    .grid-2 > *,
    .grid-3 > *,
    .grid-4 > * {
        flex-basis: 100%;
    }

    .actions-row,
    .inline-actions {
        width: 100%;
    }

    .actions-row > *,
    .inline-actions > * {
        flex: 1 1 auto;
    }

    .btn,
    .btn-primary,
    .btn-secondary,
    .btn-success,
    .btn-danger,
    .btn-soft,
    .btn-link-action {
        width: 100%;
    }

    .table-wrap {
        overflow-x: auto;
    }
}

@media (max-width: 480px) {
    .content {
        padding: 10px;
    }

    .card-body,
    .section {
        padding: 10px;
    }

    .order-compact-section,
    .order-money-strip,
    .order-warning-line {
        margin-left: 10px;
        margin-right: 10px;
    }

    .order-two-columns {
        margin-left: 10px;
        margin-right: 10px;
    }

    .order-file-header,
    .order-file-status {
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* =========================================================
   CREATE ORDER - compact searchable grids
   ========================================================= */

.table-scroll-sm {
    max-height: 190px;
    overflow-y: auto;
    border: 1px solid #dbe4f0;
    border-radius: 13px;
    background: white;
}

.table-scroll-sm .data-table {
    margin: 0;
}

.table-scroll-sm .data-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafc;
}

.table-scroll-sm .data-table th,
.table-scroll-sm .data-table td {
    padding: 8px 9px;
    font-size: 13px;
}

.table-scroll-sm .data-table tbody tr {
    background: white;
}

.table-scroll-sm .data-table tbody tr:hover td {
    background: #eff6ff;
}

@media (max-width: 768px) {
    .table-scroll-sm {
        max-height: 230px;
    }
}

/* =========================================================
   CREATE ORDER PAGE - 2 COLUMNS DESKTOP / 1 COLUMN MOBILE
   ========================================================= */

.create-order-page {
    width: 100%;
    min-width: 0;
}

/* top: pacient stanga + produse dreapta */
.create-order-grid {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 14px;
}

.create-order-col {
    flex: 1 1 0;
    min-width: 0;
}

/* bottom: produse in comanda + financiar */
.create-order-bottom {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.create-items-col {
    flex: 1 1 0;
    min-width: 0;
}

.create-finance-col {
    width: 390px;
    min-width: 340px;
    flex: 0 0 390px;
}

/* cards */
.create-card {
    background: #ffffff;
    border: 1px solid #dbe4f0;
    border-radius: 16px;
    box-shadow: 0 3px 12px rgba(15, 23, 42, .045);
    overflow: hidden;
}

.create-card + .create-card {
    margin-top: 14px;
}

.create-card-header {
    padding: 12px 14px;
    border-bottom: 1px solid #dbe4f0;
    background: #fbfdff;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.create-card-title {
    font-size: 16px;
    font-weight: 1000;
    line-height: 1.15;
}

.create-card-subtitle {
    margin-top: 3px;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}

.create-card-body {
    padding: 14px;
}

/* form rows */
.create-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
}

.create-form-row > .form-field {
    flex: 1 1 190px;
}

.create-form-row > .form-field.wide {
    flex: 2 1 320px;
}

.create-form-row > .form-field.small {
    flex: 0 1 140px;
}

/* result grids */
.create-result-box {
    margin-top: 10px;
    border: 1px solid #dbe4f0;
    border-radius: 13px;
    background: white;
    overflow: hidden;
}

.create-result-scroll {
    max-height: 188px;
    overflow-y: auto;
}

.create-result-scroll table {
    margin: 0;
}

.create-result-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafc;
}

.create-result-scroll th,
.create-result-scroll td {
    padding: 8px 9px;
    font-size: 13px;
}

.create-result-scroll tbody tr:hover td {
    background: #eff6ff;
}

/* selected patient */
.create-selected-box {
    display: none;
    margin-top: 10px;
    padding: 9px 11px;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    background: #dcfce7;
    color: #166534;
    font-size: 13px;
    font-weight: 900;
    line-height: 1.35;
}

.create-selected-box.is-visible {
    display: block;
}

/* catalog/custom buttons */
.create-mode-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* selected product panel */
.selected-product-panel {
    display: none;
    margin-top: 10px;
    border: 1px solid #dbe4f0;
    border-radius: 13px;
    overflow: hidden;
    background: white;
}

.selected-product-panel.is-visible {
    display: block;
}

.selected-product-title {
    padding: 9px 11px;
    border-bottom: 1px solid #dbe4f0;
    background: #fbfdff;
    font-size: 13px;
    font-weight: 1000;
}

.selected-product-body {
    padding: 11px;
}

/* custom product */
.custom-panel {
    display: none;
}

.custom-panel.is-visible {
    display: block;
}

/* items */
.items-empty {
    padding: 14px;
    border: 1px dashed #cbd5e1;
    border-radius: 13px;
    background: white;
    color: #64748b;
    font-size: 13px;
    font-weight: 900;
    text-align: center;
}

/* finance */
.finance-card {
    position: sticky;
    top: 78px;
}

.finance-lines {
    border: 1px solid #dbe4f0;
    border-radius: 13px;
    overflow: hidden;
    background: #ffffff;
}

.finance-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 11px;
    border-bottom: 1px solid #e9eff7;
}

.finance-line:last-child {
    border-bottom: 0;
}

.finance-label {
    color: #64748b;
    font-size: 12px;
    font-weight: 900;
}

.finance-value {
    font-size: 15px;
    font-weight: 1000;
    text-align: right;
    white-space: nowrap;
}

.finance-value.good {
    color: #166534;
}

.finance-value.warn {
    color: #92400e;
}

.finance-value.rest {
    color: #1d4ed8;
}

.finance-inputs {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.finance-inputs .form-field {
    flex: 1 1 150px;
}

/* CAS warning */
.decision-note {
    display: none;
    margin-top: 12px;
    padding: 10px 11px;
    border: 1px solid #fde68a;
    border-radius: 12px;
    background: #fffbeb;
    color: #92400e;
    font-size: 12px;
    font-weight: 900;
    line-height: 1.4;
}

.decision-note.is-visible {
    display: block;
}

/* actions */
.create-actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
}

.create-actions > * {
    flex: 1 1 0;
}

.create-notes {
    margin-top: 14px;
}

/* make result grids compact and scrollable */
.create-result-scroll .data-table {
    width: 100%;
    border-collapse: collapse;
}

.create-result-scroll .data-table th {
    white-space: nowrap;
}

.create-result-scroll .data-table td {
    vertical-align: middle;
}

/* bottom table */
.create-items-col .table-wrap {
    max-width: 100%;
}

.create-items-col .data-table th,
.create-items-col .data-table td {
    padding: 8px 9px;
}

/* tablet */
@media (max-width: 1180px) {
    .create-order-grid,
    .create-order-bottom {
        display: block;
    }

    .create-order-col,
    .create-items-col,
    .create-finance-col {
        width: 100%;
        min-width: 0;
        flex: none;
    }

    .create-order-col + .create-order-col,
    .create-finance-col {
        margin-top: 14px;
    }

    .finance-card {
        position: static;
    }
}

/* phone */
@media (max-width: 768px) {
    .create-card-body {
        padding: 11px;
    }

    .create-card-header {
        padding: 11px;
        display: block;
    }

    .create-card-title {
        font-size: 15px;
    }

    .create-mode-actions {
        margin-top: 8px;
    }

    .create-form-row {
        display: block;
    }

    .create-form-row > .form-field {
        margin-bottom: 10px;
    }

    .create-result-scroll {
        max-height: 230px;
    }

    .create-actions {
        display: block;
    }

    .create-actions > * {
        width: 100%;
        margin-bottom: 8px;
    }

    .finance-line {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }

    .finance-value {
        text-align: left;
    }
}

/* small phone */
@media (max-width: 480px) {
    .create-card-header,
    .create-card-body {
        padding-left: 10px;
        padding-right: 10px;
    }

    .create-result-scroll {
        max-height: 210px;
    }

    .create-result-scroll th,
    .create-result-scroll td {
        padding: 7px 8px;
        font-size: 12px;
    }

    .create-finance-col {
        min-width: 0;
    }
}


/* =========================================================
   CREATE ORDER - equal visible rows for patient/product grids
   ========================================================= */

.create-order-grid {
    align-items: stretch;
}

.create-order-grid > .create-order-col {
    display: flex;
}

.create-order-grid > .create-order-col > .create-card {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.create-order-grid > .create-order-col > .create-card > .create-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.create-order-grid .create-result-box {
    flex: 1;
    min-height: 0;
}

/* pacientul are și câmpul Termen pe rând separat, deci îi dăm scroll puțin mai mic */
.create-patient-scroll {
    height: 260px;
    max-height: 260px;
    overflow-y: auto;
}

/* produsele au header + filtre mai compacte, deci îl facem cât să arate 3-4 rânduri */
.create-product-scroll {
    height: 260px;
    max-height: 260px;
    overflow-y: auto;
}

/* rânduri mai compacte ca să intre 3-4 vizibile frumos */
.create-result-scroll .data-table th,
.create-result-scroll .data-table td {
    padding-top: 7px;
    padding-bottom: 7px;
}

/* dacă apare panoul produs selectat, nu lăsăm cardul să explodeze prea mult */
.selected-product-panel {
    flex: 0 0 auto;
}

/* mobil/tabletă: lăsăm natural */
@media (max-width: 1180px) {
    .create-order-grid > .create-order-col {
        display: block;
    }

    .create-order-grid > .create-order-col > .create-card,
    .create-order-grid > .create-order-col > .create-card > .create-card-body {
        display: block;
    }

    .create-patient-scroll,
    .create-product-scroll {
        height: 230px;
        max-height: 230px;
    }
}
/* =========================================================
   CREATE ORDER - CAS DECISIONS
   ========================================================= */

.decision-create-box {
    margin-top: 12px;
    border: 1px solid #dbe4f0;
    border-radius: 14px;
    background: #f8fafc;
    padding: 12px;
}

.decision-create-title {
    font-size: 13px;
    font-weight: 900;
    color: #0f172a;
    margin-bottom: 8px;
}

.decision-create-grid {
    display: grid;
    grid-template-columns: minmax(240px, 1.5fr) minmax(120px, .8fr) minmax(120px, .8fr) minmax(140px, .8fr);
    gap: 8px;
    align-items: end;
}

.decision-create-grid-small {
    display: grid;
    grid-template-columns: minmax(120px, .7fr) minmax(120px, .7fr) minmax(220px, 1.3fr) auto;
    gap: 8px;
    align-items: end;
    margin-top: 8px;
}

.decision-temp-list {
    display: grid;
    gap: 6px;
    margin-top: 10px;
}

.decision-temp-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
    border: 1px solid #dbe4f0;
    border-radius: 10px;
    background: #ffffff;
    padding: 8px;
    font-size: 12px;
}

.decision-temp-main {
    min-width: 0;
}

.decision-temp-title {
    font-weight: 900;
    color: #0f172a;
    line-height: 1.35;
}

.decision-temp-meta {
    margin-top: 3px;
    color: #64748b;
    line-height: 1.4;
}

.decision-temp-price {
    white-space: nowrap;
    font-weight: 900;
    color: #166534;
}

.decision-remove-btn {
    border: 0;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 8px;
    padding: 5px 8px;
    font-size: 11px;
    font-weight: 900;
    cursor: pointer;
}

.decision-remove-btn:hover {
    background: #fecaca;
}

.item-decisions-mini {
    margin-top: 5px;
    font-size: 11px;
    color: #166534;
    font-weight: 800;
    line-height: 1.35;
}

.cas-search-wrap {
    position: relative;
}

.cas-search-results {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 40;
    margin-top: 4px;
    border: 1px solid #dbe4f0;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 18px 35px rgba(15, 23, 42, .14);
    max-height: 220px;
    overflow-y: auto;
    display: none;
}

.cas-search-results.is-visible {
    display: block;
}

.cas-search-option {
    padding: 8px 10px;
    cursor: pointer;
    border-bottom: 1px solid #eef2f7;
}

.cas-search-option:last-child {
    border-bottom: 0;
}

.cas-search-option:hover {
    background: #eff6ff;
}

.cas-search-option-title {
    font-size: 12px;
    font-weight: 900;
    color: #0f172a;
    line-height: 1.35;
}

.cas-search-option-meta {
    margin-top: 2px;
    font-size: 11px;
    color: #64748b;
    line-height: 1.35;
}

@media (max-width: 1000px) {
    .decision-create-grid,
    .decision-create-grid-small {
        grid-template-columns: 1fr;
    }

    .decision-temp-row {
        flex-direction: column;
    }
}
/* =========================================================
   ORDER PANEL - VISUAL SEPARATION PRODUCTS / CAS DECISIONS
   Scoped only for order detail panel
   ========================================================= */

.orders-detail-card .order-compact-section {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.orders-detail-card .order-section-head {
    background: #eff6ff;
    border-bottom-color: #cbd5e1;
}

.orders-detail-card .order-section-head span {
    color: var(--primary);
}

.orders-detail-card .order-products-list {
    background: #f8fafc;
    padding: 6px;
}

/* produsul comandat */
.orders-detail-card .order-product-row {
    border: 1px solid var(--border-color);
    background: #ffffff;
    border-radius: var(--radius-md);
    padding: 12px 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.orders-detail-card .order-product-row + .order-product-row {
    margin-top: 10px;
}

.orders-detail-card .product-index {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 5px rgba(37, 99, 235, .2);
}

.orders-detail-card .product-title {
    font-size: 15px;
    color: var(--dark);
    font-weight: 700;
}

.orders-detail-card .product-meta {
    color: #475569;
}

.orders-detail-card .product-side {
    min-width: 145px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: #f8fafc;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.orders-detail-card .product-price {
    color: var(--dark);
    font-size: 14px;
    font-weight: 600;
}

.orders-detail-card .product-cas {
    color: #b45309;
    font-size: 12px;
    font-weight: 600;
}

/* pastile metadate produs */
.orders-detail-card .product-meta-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.orders-detail-card .meta-badge {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.orders-detail-card .meta-badge.success {
    background: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}

.orders-detail-card .meta-badge.success a {
    color: #065f46;
    text-decoration: none;
    font-weight: 600;
}

.orders-detail-card .meta-badge.info {
    background: #eff6ff;
    color: #1e40af;
    border-color: #bfdbfe;
}

.orders-detail-card .meta-badge .badge-btn {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    font-weight: 600;
}

.orders-detail-card .meta-badge .badge-action-btn {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: #ef4444;
    cursor: pointer;
    text-decoration: underline;
    margin-left: 4px;
}

/* scurtături de printare */
.orders-detail-card .product-print-shortcuts {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.orders-detail-card .btn-print-shortcut {
    font-size: 11px;
    padding: 3px 8px;
    text-decoration: none;
    background: #ffffff;
    color: #3b82f6;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    transition: all 0.15s ease;
    font-weight: 500;
}

.orders-detail-card .btn-print-shortcut:hover {
    background: #f8fafc;
    border-color: #3b82f6;
}

/* breakdown preturi */
.orders-detail-card .product-price-breakdown {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
    text-align: right;
    margin-top: 4px;
    width: 100%;
}

.orders-detail-card .price-row {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    align-items: center;
}

.orders-detail-card .price-row .price-lbl {
    color: #64748b;
    font-weight: 500;
}

.orders-detail-card .price-row .price-val {
    font-weight: 600;
    color: #334155;
}

.orders-detail-card .price-row.total .price-val {
    color: #0f172a;
    font-size: 12px;
    font-weight: 700;
}

.orders-detail-card .price-row.cas .price-val {
    color: #059669;
}

.orders-detail-card .price-row.patient .price-val {
    color: #7c3aed;
    font-size: 12px;
    font-weight: 700;
}

/* containerul mare de decizii - FLAT INTEGRATED */
.orders-detail-card .cas-decision-box {
    margin-top: 10px;
    border: none;
    border-top: 1px dashed #cbd5e1;
    border-radius: 0;
    background: transparent;
    padding-top: 10px;
    overflow: visible;
}

.orders-detail-card .cas-decision-head {
    padding: 0 0 8px 0;
    background: transparent;
    border-bottom: none;
}

.orders-detail-card .cas-decision-head strong {
    color: #334155;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.orders-detail-card .cas-decision-head span {
    color: #64748b;
    font-size: 11px;
    font-weight: 500;
}

/* lista deciziilor */
.orders-detail-card .cas-decision-list {
    padding: 0;
    background: transparent;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* fiecare decizie existentă - FLAT INTEGRATED */
.orders-detail-card .cas-decision-row {
    border: 1px solid #e2e8f0;
    border-left: 4px solid #3b82f6;
    border-radius: var(--radius-sm);
    background: #f8fafc;
    padding: 10px 12px;
    box-shadow: none;
}

.orders-detail-card .cas-decision-row.announced {
    border-left-color: #10b981;
}

.orders-detail-card .cas-decision-row.not-announced {
    border-left-color: #f59e0b;
}

.orders-detail-card .cas-decision-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e2e8f0;
}

.orders-detail-card .cas-decision-title {
    color: #1e293b;
    font-size: 13px;
    font-weight: 600;
}

.orders-detail-card .cas-decision-meta {
    color: #64748b;
    font-size: 11px;
    margin-top: 4px;
    line-height: 1.4;
}

.orders-detail-card .cas-decision-price {
    color: #065f46;
    background: #dcfce7;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

/* formularul de editare decizie */
.orders-detail-card .cas-decision-row form {
    margin-top: 12px;
}

.orders-detail-card .cas-form-grid,
.orders-detail-card .cas-form-grid-5 {
    gap: 10px;
}

.orders-detail-card .cas-form-grid .form-field label,
.orders-detail-card .cas-form-grid-5 .form-field label,
.orders-detail-card .cas-decision-form .form-field label {
    color: #475569;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .045em;
}

.orders-detail-card .cas-form-grid input,
.orders-detail-card .cas-form-grid select,
.orders-detail-card .cas-form-grid-5 input,
.orders-detail-card .cas-form-grid-5 select,
.orders-detail-card .cas-decision-form input,
.orders-detail-card .cas-decision-form select {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.orders-detail-card .cas-form-grid input:focus,
.orders-detail-card .cas-form-grid select:focus,
.orders-detail-card .cas-form-grid-5 input:focus,
.orders-detail-card .cas-form-grid-5 select:focus,
.orders-detail-card .cas-decision-form input:focus,
.orders-detail-card .cas-decision-form select:focus {
    background: #ffffff;
    border-color: var(--primary);
}

/* formularul de adăugare decizie nouă */
.orders-detail-card .cas-decision-form {
    margin: 0 12px 12px;
    padding: 14px;
    border: 1px dashed var(--warning);
    border-radius: var(--radius-md);
    background: #fffbeb;
}

.orders-detail-card .cas-decision-form::before {
    content: "Adaugă o decizie nouă";
    display: block;
    margin-bottom: 10px;
    color: #b45309;
    font-size: 12px;
    font-weight: 600;
}

/* statusuri */
.orders-detail-card .cas-mini-status.ok {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}

.orders-detail-card .cas-mini-status.warn {
    background: #fffbeb;
    color: #b45309;
    border-color: #fde68a;
}

/* butoane decizii */
.orders-detail-card .cas-decision-actions {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
}

/* când nu există decizii */
.orders-detail-card .cas-empty-line {
    border: 1px dashed #93c5fd;
    background: #ffffff;
    color: #475569;
}

/* responsive */
@media (max-width: 900px) {
    .orders-detail-card .product-side {
        width: 100%;
        min-width: 0;
        align-items: flex-start;
        text-align: left;
    }

    .orders-detail-card .cas-decision-main {
        display: block;
    }

    .orders-detail-card .cas-decision-price {
        display: inline-flex;
        margin-top: 8px;
    }
}

/* =========================================================
   PATIENTS FORM - LOCALITY SEARCH & GUARDIAN FIELDS
   ========================================================= */

.locality-field {
    position: relative;
}

.locality-suggestions {
    position: absolute;
    z-index: 30;
    left: 0;
    right: 0;
    top: 42px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    max-height: 260px;
    overflow-y: auto;
}

.locality-option {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
}

.locality-option:last-child {
    border-bottom: 0;
}

.locality-option:hover {
    background: #eff6ff;
}

.locality-option strong {
    display: block;
    font-size: 13px;
    color: var(--dark);
}

.locality-option span {
    display: block;
    color: #64748b;
    font-size: 11px;
    margin-top: 2px;
}

.section-box {
    grid-column: 1 / -1;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: #f8fafc;
    padding: 18px;
}

.section-box .section-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 12px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    margin-bottom: 14px;
}

.checkbox-row input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.guardian-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-top: 14px;
}

.guardian-fields.is-hidden {
    display: none;
}

@media (max-width: 900px) {
    .guardian-fields {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   APPOINTMENTS LIST
   ========================================================= */

.period-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.period-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: white;
    color: var(--dark);
    font-weight: 600;
    font-size: 13px;
    transition: var(--transition);
}

.period-btn:hover {
    background: #f1f5f9;
}

.period-btn.active {
    background: #eff6ff;
    color: var(--primary);
    border-color: #93c5fd;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.filter-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 12px;
    color: #475569;
}

.filter-field input,
.filter-field select {
    width: 100%;
    height: 38px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    font-size: 13px;
    outline: none;
    background: white;
    transition: var(--transition);
}

.filter-field input:focus,
.filter-field select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.appointment-row-closed {
    opacity: 0.7;
}

.appointment-row-closed td {
    color: #64748b;
}

.appointment-row-closed .badge {
    opacity: 0.6;
}

.appointment-row-closed .product-pill {
    opacity: 0.6;
}

.patient-name {
    font-weight: 600;
    color: var(--dark);
}

.prospect-name {
    font-weight: 600;
    color: #9a3412;
}

.prospect-pill {
    display: inline-flex;
    width: fit-content;
    margin-top: 5px;
    padding: 3px 8px;
    border-radius: 9999px;
    background: #ffedd5;
    color: #9a3412;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid #fed7aa;
}

.products-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 240px;
    max-width: 380px;
}

.product-pill {
    display: inline-flex;
    width: fit-content;
    max-width: 100%;
    padding: 4px 10px;
    border-radius: 9999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #c7d2fe;
    line-height: 1.25;
}

.product-pill.catalog {
    background: #ecfeff;
    color: #0891b2;
    border-color: #a5f3fc;
}

.product-count {
    display: inline-flex;
    width: fit-content;
    padding: 3px 8px;
    border-radius: 9999px;
    background: #f1f5f9;
    color: #475569;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid #e2e8f0;
}

/* Specific type badges using premium colors */
.badge-type-consultatie {
    background: #eff6ff !important;
    color: #1e40af !important;
    border: 1px solid #bfdbfe !important;
}

.badge-type-mulaj {
    background: #fff7ed !important;
    color: #c2410c !important;
    border: 1px solid #fed7aa !important;
}

.badge-type-masuratori {
    background: #faf5ff !important;
    color: #6b21a8 !important;
    border: 1px solid #e9d5ff !important;
}

.badge-type-proba {
    background: #ecfdf5 !important;
    color: #065f46 !important;
    border: 1px solid #a7f3d0 !important;
}

.badge-type-livrare {
    background: #f0fdfa !important;
    color: #0f766e !important;
    border: 1px solid #99f6e4 !important;
}

.badge-type-ajustare {
    background: #fff1f2 !important;
    color: #be123c !important;
    border: 1px solid #fecdd3 !important;
}

.badge-type-control {
    background: #e0e7ff !important;
    color: #3730a3 !important;
    border: 1px solid #c7d2fe !important;
}

.badge-type-reparatie {
    background: #fef2f2 !important;
    color: #991b1b !important;
    border: 1px solid #fecaca !important;
}

.badge[class*="badge-type-"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 96px;
    padding: 6px 12px !important;
    border-radius: 9999px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: .04em;
    text-align: center;
    box-shadow: none;
}

.appointment-history-note {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.appointment-history-note.red {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

.appointment-history-note.amber {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}

.appointment-history-note.green {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

.cancel-form {
    display: none;
    margin-top: 10px;
    padding: 12px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    border-radius: var(--radius-md);
}

.cancel-form textarea {
    width: 100%;
    min-height: 70px;
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    resize: vertical;
    font-family: inherit;
    font-size: 13px;
    outline: none;
}

.cancel-form textarea:focus {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* =========================================================
   PRODUCTS LIST
   ========================================================= */

.badge-category {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
}

.badge-report {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.badge-report.status-active {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}

.badge-report.status-inactive {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

/* =========================================================
   MOBILE RESPONSIVENESS & PREMIUM ANIMATIONS
   ========================================================= */

/* Micro-animations and Transitions */
.nav-link, .btn-primary, .btn-secondary, .tech-card, .photo-card, .file-input-wrapper {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:active, .btn-primary:active, .btn-secondary:active {
    transform: scale(0.98);
}

/* Tactile enhancements for portal */
.btn-template {
    padding: 10px 16px;
    font-size: 13px;
    border-radius: 12px;
    margin: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Mobile responsive media query */
@media (max-width: 768px) {
    .app-shell {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 15px;
    }
    
    .sidebar-note {
        display: none;
    }
    
    .main {
        padding: 10px;
    }
    
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 15px 10px;
    }
    
    .user-box {
        width: 100%;
        justify-content: space-between;
    }
    
    /* Make tables stackable into cards on small screens */
    table.table, table.info-table {
        display: block;
        width: 100%;
    }
    
    table.table thead, table.info-table thead {
        display: none; /* Hide headers */
    }
    
    table.table tbody, table.info-table tbody {
        display: block;
        width: 100%;
    }
    
    table.table tr, table.info-table tr {
        display: block;
        background: white;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        margin-bottom: 15px;
        padding: 15px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    }
    
    table.table td, table.info-table td {
        display: flex;
        justify-content: space-between;
        padding: 8px 0;
        border-bottom: 1px solid #f1f5f9;
        font-size: 13px;
    }
    
    table.table td:last-child, table.info-table td:last-child {
        border-bottom: 0;
    }
    
    table.table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: #64748b;
        margin-right: 15px;
    }
    
    .show-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Premium print layout for Advance Contract A4 */
@media print {
    body {
        background: white;
        color: black;
        font-size: 12px;
        line-height: 1.4;
    }
    
    .app-shell, .sidebar, .topbar, .back-link, button, .actions, form {
        display: none !important;
    }
    
    .main {
        padding: 0;
        margin: 0;
        width: 100%;
        display: block;
    }
    
    .content {
        padding: 0;
        margin: 0;
    }
    
    .contract-print-container {
        padding: 0;
        margin: 0;
        border: none;
        box-shadow: none;
        width: 100%;
        max-width: 100%;
    }
    
    .page-break {
        page-break-after: always;
    }
}

/* Premium Searchable Select styles */
.searchable-select-wrapper {
    position: relative;
    width: 100%;
}

.searchable-select-input {
    width: 100%;
    height: 38px;
    padding: 8px 30px 8px 12px;
    font-size: 13px;
    border-radius: 8px;
    border: 1px solid var(--border-color, #cbd5e1);
    background: #fff;
    color: var(--dark, #0f172a);
    outline: none;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    cursor: pointer;
}

.searchable-select-input:focus {
    border-color: var(--primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%233b82f6'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E");
    background-size: 15px;
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-color: #f8fafc;
}

.searchable-select-input.has-value {
    font-weight: 600;
}

.searchable-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    max-height: 250px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--border-color, #cbd5e1);
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    margin-top: 4px;
    display: none;
}

.searchable-select-dropdown.is-open {
    display: block;
}

.searchable-select-item {
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    color: var(--dark, #0f172a);
    transition: background 0.1s ease, color 0.1s ease;
}

.searchable-select-item:hover,
.searchable-select-item.is-active {
    background: #f1f5f9;
    color: var(--primary, #2563eb);
}

.searchable-select-item.is-selected {
    background: rgba(37, 99, 235, 0.08);
    color: var(--primary, #2563eb);
    font-weight: 600;
}

.searchable-select-empty {
    padding: 12px;
    color: #64748b;
    font-size: 12px;
    text-align: center;
    font-style: italic;
}

/* Premium KPI Card Styling */
.kpi-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    padding: 20px;
    flex: 1 1 22%;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px -8px rgba(0,0,0,0.08), 0 4px 4px -2px rgba(0,0,0,0.03);
    border-color: #93c5fd;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

.kpi-card:nth-child(2)::before {
    background: var(--success);
}

.kpi-card:nth-child(3)::before {
    background: var(--warning);
}

.kpi-card:nth-child(4)::before {
    background: var(--danger);
}

.kpi-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--dark);
    line-height: 1.1;
    letter-spacing: -0.03em;
}

/* Dashboard Header Typography */
.page-actions .strong {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--dark);
}

.page-actions .meta {
    font-size: 13px;
    color: #64748b;
    margin-top: 2px;
}

/* COLLAPSIBLE & RESPONSIVE SIDEBAR STYLES (OPTION B) */

/* Collapse controls */
.sidebar-toggle-btn {
    background: transparent;
    border: none;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-toggle-btn:hover {
    color: #f3f4f6;
    background: rgba(255, 255, 255, 0.08);
}

/* Sidebar collapse on desktop */
.app-shell.sidebar-collapsed .sidebar {
    width: 70px;
    min-width: 70px;
    padding: 24px 10px;
}

.app-shell.sidebar-collapsed .brand {
    justify-content: center;
    padding-left: 0;
}

.app-shell.sidebar-collapsed .brand div {
    display: none;
}

.app-shell.sidebar-collapsed .nav-section-title {
    display: none;
}

.app-shell.sidebar-collapsed .nav-link span:not(.nav-icon) {
    display: none;
}

.app-shell.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 8px;
}

.app-shell.sidebar-collapsed .nav-link:hover {
    transform: none;
}

.app-shell.sidebar-collapsed .sidebar-note {
    display: none;
}

/* Hamburger button in Topbar */
.hamburger-menu-btn {
    display: none; /* Hidden on desktop */
    background: transparent;
    border: none;
    color: var(--dark);
    padding: 8px;
    cursor: pointer;
    font-size: 20px;
    align-items: center;
    justify-content: center;
}

/* Mobile responsive navigation overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* Responsive styles */
@media (max-width: 768px) {
    /* iOS face zoom la focus pe orice input cu font-size < 16px (de-aia „caseta de login
       se marea aiurea"). 16px = pragul care opreste zoom-ul. !important ca sa bata
       font-size-urile pe clasa (.filter-field input etc.). */
    input:not([type=checkbox]):not([type=radio]),
    select,
    textarea,
    .live-search-input {
        font-size: 16px !important;
    }

    .hamburger-menu-btn {
        display: inline-flex; /* Show hamburger button on mobile */
    }

    .sidebar-toggle-btn {
        display: none; /* Hide collapse toggle inside sidebar on mobile */
    }

    /* Ancorat pe .app-shell ca sa bata redesign-ul `.app-shell .sidebar` (0,2,0) de mai
       sus — altfel sidebar-ul ramane `position: sticky` pe mobil si NU mai iese off-canvas
       (hamburger-ul „nu mai ascunde meniul"). */
    .app-shell .sidebar {
        position: fixed;
        left: -260px; /* Hidden offscreen by default */
        top: 0;
        bottom: 0;
        height: 100vh;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000; /* DEASUPRA overlay-ului (998) ca meniul sa fie utilizabil, nu blurat in spate */
        box-shadow: 10px 0 30px rgba(0,0,0,0.25);
    }

    .app-shell.show-mobile-sidebar .sidebar {
        left: 0; /* Slide into view */
    }

    /* Keep main layout stretched */
    .app-shell.sidebar-collapsed .sidebar {
        left: -260px;
    }

    .app-shell.sidebar-collapsed.show-mobile-sidebar .sidebar {
        left: 0;
        width: 260px;
        min-width: 260px;
    }

    .app-shell.sidebar-collapsed.show-mobile-sidebar .brand div,
    .app-shell.sidebar-collapsed.show-mobile-sidebar .nav-section-title,
    .app-shell.sidebar-collapsed.show-mobile-sidebar .nav-link span:not(.nav-icon),
    .app-shell.sidebar-collapsed.show-mobile-sidebar .sidebar-note {
        display: block;
    }

    .app-shell.sidebar-collapsed.show-mobile-sidebar .nav-link {
        justify-content: flex-start;
        padding: 8px 12px;
    }
}

/* HORIZONTAL MENU REMOVED - RESTORED PREMIUM VERTICAL COLLAPSIBLE SIDEBAR */

.app-shell {
    display: flex;
    min-height: 100vh;
    align-items: stretch;
}

.sidebar {
    width: 260px;
    min-width: 260px;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: white;
    padding: 24px 16px;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--light-bg);
}

.sidebar-toggle-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding: 0 4px;
    transition: justify-content 0.3s;
}

.brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: white;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    flex-shrink: 0;
}

.brand-text {
    transition: opacity 0.2s;
}

.brand-title {
    font-size: 18px;
    font-weight: 800;
    color: white;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.brand-subtitle {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
    font-weight: 500;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.nav-section-title {
    margin: 20px 0 6px;
    color: #64748b;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .12em;
    padding-left: 12px;
    transition: opacity 0.2s;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 8px;
    color: #94a3b8;
    font-size: 13.5px;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}

.nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.04);
}

.nav-link.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.02) 100%);
    color: #60a5fa;
    font-weight: 700;
    border-left: 3px solid #2563eb;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    transition: color 0.2s;
}

.nav-link.active .nav-icon {
    color: #3b82f6;
}

.nav-label {
    transition: opacity 0.2s;
    white-space: nowrap;
}

.sidebar-note {
    margin-top: auto;
    padding: 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    color: #64748b;
    font-size: 11px;
    line-height: 1.4;
    transition: opacity 0.2s;
}

/* COLLAPSED STATE RULES */
.sidebar-collapsed .sidebar {
    width: 76px;
    min-width: 76px;
    padding: 24px 12px;
}

.sidebar-collapsed .brand {
    justify-content: center;
    padding: 0;
}

.sidebar-collapsed .brand-text,
.sidebar-collapsed .nav-section-title,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .sidebar-note {
    display: none !important;
}

.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 8px;
}

.sidebar-collapsed .nav-link.active {
    border-left: none;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    background: rgba(59, 130, 246, 0.12);
}

.sidebar-collapsed .sidebar-toggle-btn {
    transform: rotate(180deg);
}

/* topbar search and toggle button alignments */
.topbar {
    min-height: 64px;
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 24px;
}

/* RESPONSIVE MEDIA QUERIES */
@media (max-width: 1024px) {
    .sidebar-toggle-btn {
        display: none;
    }

    .hamburger-menu-btn {
        display: inline-flex;
    }

    /* Ancorat pe .app-shell (0,2,0) ca sa bata `.app-shell .sidebar { position:sticky }` din
       redesign — altfel pe TABLETA (768-1024px) sidebar-ul ramane sticky si nu iese off-canvas.
       z-index 1000 = deasupra overlay-ului (998). */
    .app-shell .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        height: 100vh;
        z-index: 1000;
        box-shadow: 8px 0 25px rgba(0, 0, 0, 0.15);
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .show-mobile-sidebar .sidebar {
        left: 0 !important;
        width: 260px !important;
        min-width: 260px !important;
    }

    .show-mobile-sidebar .brand-text,
    .show-mobile-sidebar .nav-section-title,
    .show-mobile-sidebar .nav-label,
    .show-mobile-sidebar .sidebar-note {
        display: block !important;
    }

    .show-mobile-sidebar .nav-link {
        justify-content: flex-start !important;
        padding: 8px 12px !important;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(15, 23, 42, 0.4);
        backdrop-filter: blur(4px);
        z-index: 998;
    }

    .sidebar-overlay.active {
        display: block;
    }
}

/* PAGINATION STYLING (BOOTSTRAP & GENERAL OVERRIDES) */
.pagination {
    display: flex;
    padding-left: 0;
    list-style: none;
    gap: 6px;
    align-items: center;
    justify-content: center;
    margin: 24px 0;
    flex-wrap: wrap;
}

.pagination .page-item,
.pagination li {
    display: inline-block;
}

.pagination .page-link,
.pagination .page-item span,
.pagination .page-item a,
.pagination li a,
.pagination li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color, #cbd5e1);
    background: #fff;
    color: var(--dark, #0f172a);
    font-weight: 600;
    font-size: 13px;
    transition: all 0.15s ease-in-out;
    text-decoration: none;
    cursor: pointer;
}

.pagination .page-item a:hover,
.pagination .page-link:hover,
.pagination li a:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #2563eb;
}

.pagination .page-item.active .page-link,
.pagination .page-item.active span,
.pagination li.active a,
.pagination li.active span {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.15);
}

.pagination .page-item.disabled .page-link,
.pagination .page-item.disabled span,
.pagination li.disabled a,
.pagination li.disabled span {
    color: #94a3b8;
    background: #f8fafc;
    border-color: #e2e8f0;
    cursor: not-allowed;
}

/* Guard against giant SVGs in Laravel default pagination views */
.pagination svg, 
.pagination .w-5, 
.pagination .h-5 {
    width: 16px !important;
    height: 16px !important;
    max-width: 16px !important;
    max-height: 16px !important;
    display: inline-block !important;
}

/* Hide mobile pagination wrapper completely */
nav[aria-label="pagination"] > div:first-child,
nav[aria-label="pagination"] > div.d-sm-none,
nav[aria-label="pagination"] > div.flex-fill {
    display: none !important;
}

/* Ensure desktop wrapper displays page numbers and info correctly */
nav[aria-label="pagination"] > div:last-child,
nav[aria-label="pagination"] > div.d-sm-flex {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
}

/* Hide the prev and next buttons inside the page numbers list */
.pagination li:first-child,
.pagination li:last-child,
.pagination .page-item:first-child,
.pagination .page-item:last-child {
    display: none !important;
}

/* Helper class to hide elements */
.hidden {
    display: none !important;
}

/* ============================================================================
   === RESPONSIVE MOBIL/TABLETA (ultracode) ===
   Fundatie globala pentru componentele PARTAJATE. STRICT ADITIV: doar reguli
   noi in @media, nimic din desktop nu e modificat. Vine la finalul fisierului,
   deci la specificitate egala castiga (override curat al cazurilor descoperite).
   NU atinge sidebar-ul (reparat separat) si NU rescrie input/select 16px (fix
   global existent). Breakpoint-uri: 1024 tableta / 768 telefon / 480 telefon mic.
   ============================================================================ */

/* ---------- TABLETA: max 1024px ---------- */
@media (max-width: 1024px) {
    /* Content mai stramt ca sa nu para risipit, dar inca aerisit. */
    .content {
        padding: 18px;
    }

    /* Pastreaza hamburger-ul pe acelasi rand cu titlul (topbar inca orizontal
       pana la 768). Nu modificam regula desktop — doar aliniem la tableta. */
    .topbar {
        gap: 12px;
        padding: 0 16px;
    }

    /* KPI-uri: 2 pe rand in loc de 4, fara sa devina minuscule. */
    .kpi-card {
        flex: 1 1 calc(50% - 12px);
        min-width: 0;
    }

    /* Grile auto cu min-width mare -> coloane mai inguste ca sa incapa 2-3. */
    .filters-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    /* Randuri de actiuni care pe desktop stau intinse — lasam wrap curat. */
    .page-actions {
        gap: 12px;
    }
}

/* ---------- TELEFON: max 768px ---------- */
@media (max-width: 768px) {
    /* Zero scroll orizontal: nimic partajat nu depaseste viewport-ul. */
    .content,
    .orders-page,
    .create-order-page,
    .card,
    .section {
        max-width: 100%;
    }

    /* Padding content redus deja la 480; il coboram si la 768 pentru confort. */
    .content {
        padding: 14px;
    }

    /* TOPBAR compact: titlu mai mic, user-box trece pe rand nou aliniat,
       contul + logout impart un rand si devin tinte comode. */
    .page-title {
        font-size: 17px;
        line-height: 1.2;
    }

    .user-box {
        gap: 8px;
        flex-wrap: nowrap;
    }

    /* Pe telefon scoatem numele/rolul din topbar (sunt si in sidebar, la „Roluri curente")
       ca topbar-ul sa ramana UN SINGUR rand scund, nu trei. */
    .user-meta {
        display: none;
    }

    .account-link,
    .logout-btn {
        min-height: 36px;
        padding: 0 10px;
        font-size: 13px;
    }

    .page-title {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* CARDURI / sectiuni partajate: padding redus pe telefon. */
    .card-body {
        padding: 14px;
    }

    .section {
        padding: 14px;
    }

    .section-box {
        padding: 14px;
    }

    /* TABELE partajate: wrapper scroll-abil + celule mai compacte ca tabelele
       cu multe coloane sa incapa fara sa rupa pagina. (.table-wrap are deja
       overflow-x:auto; intarim ca .data-table direct sa poata scrolla si cand
       nu e invelit.) */
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table th,
    .data-table td {
        padding: 9px 10px;
        font-size: 12.5px;
    }

    .data-table th {
        white-space: nowrap;
    }

    /* Grile generice form (flex-basis fix) -> deja stivuite la 768 in blocul
       principal; aici ne ocupam de grile pe display:grid ramase. */
    .filters-grid,
    .guardian-fields,
    .decision-create-grid,
    .decision-create-grid-small {
        grid-template-columns: 1fr;
    }

    /* Randuri de butoane / chips de actiune -> full-width, tinta >= 44px. */
    .period-buttons,
    .create-mode-actions {
        width: 100%;
    }

    .period-btn {
        flex: 1 1 calc(50% - 8px);
        min-height: 44px;
    }

    .create-mode-actions > * {
        flex: 1 1 auto;
        min-height: 44px;
    }

    /* Inaltime tinta pe butoanele principale (latimea 100% e setata la 768 in
       blocul existent — aici doar ridicam tinta de atins). */
    .btn,
    .btn-primary,
    .btn-secondary,
    .btn-success,
    .btn-danger,
    .btn-soft,
    .btn-link-action {
        min-height: 44px;
    }

    /* Lista de produse din programari: scapa de min-width fix. */
    .products-list {
        min-width: 0;
        max-width: 100%;
    }

    /* PAGINARE: tinte comode la atins pe ambele variante (custom + Bootstrap). */
    .page-btn {
        min-height: 44px;
        padding: 0 14px;
    }

    .pagination .page-link,
    .pagination .page-item a,
    .pagination .page-item span,
    .pagination li a,
    .pagination li span {
        min-width: 44px;
        height: 44px;
    }

    /* DROPDOWN-URI / sugestii partajate: nu depasesc ecranul, scroll-abile. */
    .locality-suggestions,
    .cas-search-results,
    .live-search-results,
    .searchable-select-dropdown {
        max-height: 50vh;
    }

    /* MODALE / OVERLAY partajate (registry picker): aproape full-screen pe
       telefon, scroll-abile, lipite sus, nu taiate. */
    .reg-modal-overlay {
        padding: 0;
        align-items: stretch;
        justify-content: stretch;
    }

    .reg-modal {
        max-width: 100%;
        width: 100%;
        max-height: 100vh;
        height: 100%;
        border-radius: 0;
    }

    .reg-modal-list {
        flex: 1;
    }
}

/* ---------- TELEFON MIC: max 480px ---------- */
@media (max-width: 480px) {
    /* Titlu si KPI inca lizibile dar mai compacte. */
    .page-title {
        font-size: 16px;
    }

    .kpi-card {
        flex: 1 1 100%;
        padding: 16px;
    }

    .kpi-value {
        font-size: 24px;
    }

    /* Tabele si mai compacte ca sa incapa coloanele pe ecran mic. */
    .data-table th,
    .data-table td {
        padding: 8px 8px;
        font-size: 12px;
    }

    /* Carduri / sectiuni: padding minim, dar respirabil. */
    .card-body,
    .section,
    .section-box {
        padding: 12px;
    }

    /* Butoane perioada full-width (1 pe rand) pe ecran foarte mic. */
    .period-btn {
        flex: 1 1 100%;
    }
}
