/* ==========================================================================
   BSI UI - foundation stylesheet
   The Business Science Institute design system.
   White surfaces, burgundy #9B0C23 accent, PT Serif, light weights,
   flat 4px corners on controls, soft 8px corners on cards and modals.
   Copy this file as-is into a new project and link it, then assemble
   screens with the documented classes. Pairs with icons.js for pictograms.
   ========================================================================== */

:root {
    /* Accent (burgundy). Used for primary actions, active items, links, focus. */
    --red:          #9B0C23;
    --red-dark:     #7a0a1c;   /* hover / pressed */
    --red-light:    #fef2f2;   /* faint tint background */
    --red-border:   #fecaca;   /* tint border */

    /* Text */
    --text:         #454545;   /* body and headings */
    --text-muted:   #787878;   /* secondary text, captions */
    --text-light:   #9b9b9b;   /* hints, disabled */

    /* Surfaces and lines */
    --surface:      #ffffff;   /* page and card background */
    --bg:           #fafafa;   /* inputs, sidebar, table headers, hovered rows */
    --border:       #e0e0e0;   /* card borders */
    --border-soft:  #e8e8e8;   /* table rows, sidebar edges */
    --border-input: #d0d0d0;   /* form field borders */
    --divider:      #f0f0f0;   /* 2px header/tab dividers */

    /* Status */
    --success-bg:   #f0fdf4;
    --success-text: #166534;
    --success-bdr:  #bbf7d0;
    --danger:       #dc3545;
    --danger-dark:  #c82333;

    /* Radii - flat controls, soft cards */
    --radius:       4px;   /* buttons, inputs, badges */
    --radius-card:  6px;   /* content cards */
    --radius-lg:    8px;   /* modals, login, large surfaces */
    --radius-pill:  20px;  /* status pills, counts */

    /* Shadows - soft and low */
    --shadow-sm:    0 2px 10px rgba(0, 0, 0, .04);
    --shadow:       0 2px 10px rgba(0, 0, 0, .08);
    --shadow-md:    0 4px 20px rgba(0, 0, 0, .10);
    --shadow-lg:    0 10px 40px rgba(0, 0, 0, .15);

    /* Type and metrics */
    --font:         'PT Serif', Arial, Helvetica, 'Nimbus Sans L', sans-serif;
    --control-h:    42px;      /* shared height of inputs and buttons */
    --sidebar-width: 300px;    /* Layout A default; widen for a tree (dataroom uses 450px) */
    --sidebar-collapsed: 60px;
}

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

body {
    font-family: var(--font);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
}

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

a:hover {
    color: var(--red-dark);
    text-decoration: underline;
}

/* Headings are light (font-weight: normal) - the BSI signature.
   Meaning is carried by size and the burgundy accent, never by bold weight. */
h1, h2, h3, h4 {
    color: var(--text);
    font-weight: normal;
    line-height: 1.3;
}

h1 { font-size: 24px; letter-spacing: -0.5px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 15px; }

/* ─── Buttons ────────────────────────────────────────────────────────────
   Every button shares the 42px control height and 4px radius, so it lines
   up with the fields beside it. Primary is a solid burgundy fill; secondary
   is an outline that inverts on hover; danger is red. */

.btn {
    height: var(--control-h);
    padding: 0 24px;
    background: var(--red);
    color: #ffffff;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    font-weight: normal;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn:hover {
    background: var(--red-dark);
    color: #ffffff;
    text-decoration: none;
}

.btn-secondary {
    background: transparent;
    color: var(--red);
    border: 1px solid var(--red);
}

.btn-secondary:hover {
    background: var(--red);
    color: #ffffff;
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

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

.btn-full {
    width: 100%;
}

.btn-small {
    height: auto;
    padding: 8px 16px;
    font-size: 13px;
}

.btn svg {
    display: inline-block;
    vertical-align: -3px;
}

/* Square icon button for toolbars and table rows: outlined, neutral,
   turns burgundy on hover. */
.btn-icon {
    height: 34px;
    min-width: 34px;
    padding: 0 8px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-input);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    color: var(--red);
    border-color: var(--red);
}

.btn-icon svg {
    display: block;
}

/* A borderless icon button used inside modal headers and toolbars. */
.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn:hover {
    color: var(--red);
    background: rgba(155, 12, 35, 0.08);
}

.icon-btn.active {
    color: var(--red);
    background: rgba(155, 12, 35, 0.12);
}

/* ─── Form fields ────────────────────────────────────────────────────────
   Inputs, selects and textareas share the same look: faint gray fill, thin
   border, burgundy focus that turns the fill white. Single-line controls
   sit at the 42px control height so buttons align with them. */

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
    font-size: 14px;
    font-weight: normal;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="number"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    transition: border-color 0.3s, background 0.3s;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="number"],
input[type="date"],
select {
    height: var(--control-h);
    padding-top: 0;
    padding-bottom: 0;
}

textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.6;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--red);
    background: var(--surface);
}

/* Select: strip the native chevron and bake in a gray BSI one, so the arrow
   is identical in every browser and the control reads like a text field. */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 40px;
    background-color: var(--bg);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23787878' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

select:focus {
    background-color: var(--surface);
}

/* Checkboxes, radios and range sliders adopt the accent so their native
   render matches BSI without re-implementing them. */
input[type="checkbox"],
input[type="radio"],
input[type="range"] {
    accent-color: var(--red);
    width: auto;
    height: auto;
    cursor: pointer;
}

input[type="checkbox"],
input[type="radio"] {
    width: 16px;
    height: 16px;
    vertical-align: -2px;
}

/* A checkbox or radio sitting inline with its label. */
.check-field,
.radio-field {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.check-field label,
.radio-field label {
    margin-bottom: 0;
    cursor: pointer;
}

/* Toggle switch: a fully custom on/off control for boolean settings.
   Off is a neutral track, on is the burgundy track with the knob to the right. */
.switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.switch .switch-track {
    width: 42px;
    height: 24px;
    border-radius: 20px;
    background: var(--border-input);
    transition: background 0.2s;
    flex-shrink: 0;
    position: relative;
}

.switch .switch-track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.switch input:checked + .switch-track {
    background: var(--red);
}

.switch input:checked + .switch-track::after {
    transform: translateX(18px);
}

/* Range slider value bubble sits next to the track when needed. */
.range-field {
    display: flex;
    align-items: center;
    gap: 12px;
}

.range-field input[type="range"] {
    flex: 1;
}

.range-field .range-value {
    font-size: 13px;
    color: var(--text-muted);
    min-width: 44px;
}

/* Disabled controls: muted, no pointer. */
input:disabled,
select:disabled,
textarea:disabled,
.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.form-group {
    margin-bottom: 25px;
}

/* Two-column grid for natural pairs; collapses on narrow screens. */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ─── File input ─────────────────────────────────────────────────────────
   The native <input type="file"> button is never shown raw: it clashes with
   everything else. Hide it and drive it from a styled label. The visible
   trigger reads like an outlined secondary button at the control height, with
   the chosen file name (or a muted placeholder) sitting to its right. */

.file-input {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.file-input input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.file-input-btn {
    height: var(--control-h);
    padding: 0 20px;
    background: transparent;
    color: var(--red);
    border: 1px solid var(--red);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s;
    white-space: nowrap;
    flex-shrink: 0;
}

.file-input:hover .file-input-btn {
    background: var(--red);
    color: #ffffff;
}

.file-input-name {
    font-size: 14px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-input-name.has-file {
    color: var(--text);
}

/* ─── Alerts ─────────────────────────────────────────────────────────────
   Full-width tinted blocks, centered text, thin matching border. No colored
   left stripe. */

.error,
.alert-error {
    background: var(--red-light);
    color: var(--red);
    border: 1px solid var(--red-border);
    padding: 15px 20px;
    margin-bottom: 25px;
    text-align: center;
    font-size: 14px;
    border-radius: var(--radius);
    line-height: 1.5;
}

.success,
.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-bdr);
    padding: 15px 20px;
    margin-bottom: 25px;
    text-align: center;
    font-size: 14px;
    border-radius: var(--radius);
}

/* ─── App shell (Layout A: light sidebar) ────────────────────────────────
   A flex shell: a light sidebar next to a scrolling content column. The
   sidebar is not a colored block - it is a faint gray panel bordered off
   from the content. It sticks full height and collapses to an icon rail. */

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg);
    border-right: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow: hidden;
    transition: width 0.25s ease, min-width 0.25s ease;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.sidebar-header-text {
    overflow: hidden;
}

.sidebar-header h1 {
    font-size: 18px;
    text-align: left;
    margin-bottom: 4px;
}

.sidebar-header .subtitle {
    text-align: left;
    margin-bottom: 0;
    font-size: 13px;
    color: var(--text-muted);
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sidebar-toggle:hover {
    color: var(--red);
    background: rgba(155, 12, 35, 0.08);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 15px 0;
}

/* A flat navigation item; the active one is a solid burgundy row with white
   text (the single place the accent fills a large surface). */
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    text-decoration: none;
}

.nav-item:hover {
    background: var(--divider);
    text-decoration: none;
}

.nav-item.active {
    background: var(--red);
    color: #ffffff;
}

/* Pictogram at the left of every sidebar item: it is what remains when the
   sidebar collapses to the icon rail, so no nav item ships without one. */
.nav-item .nav-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-item .nav-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-item .nav-count {
    margin-left: auto;
    font-size: 11px;
    background: var(--border-soft);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: var(--radius-pill);
}

.nav-item.active .nav-count {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.sidebar-footer .user-name {
    font-size: 13px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer .user-role {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: capitalize;
}

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

/* Collapsed rail: hide the labels, keep the icons, center the header. */
.app-wrapper.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed);
    min-width: var(--sidebar-collapsed);
}

.app-wrapper.sidebar-collapsed .sidebar-header-text,
.app-wrapper.sidebar-collapsed .sidebar-nav .nav-label,
.app-wrapper.sidebar-collapsed .sidebar-nav .nav-count,
.app-wrapper.sidebar-collapsed .sidebar-footer .user-info {
    display: none;
}

.app-wrapper.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding: 20px 0;
}

.app-wrapper.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 10px 0;
}

.app-wrapper.sidebar-collapsed .sidebar-footer {
    justify-content: center;
    padding: 15px 0;
}

.app-wrapper.sidebar-collapsed .sidebar-footer .footer-actions {
    flex-direction: column;
    gap: 10px;
}

/* ─── Main content ───────────────────────────────────────────────────────*/

.main-content {
    flex: 1;
    padding: 30px 40px;
    overflow-y: auto;
    min-width: 0;
}

/* Page header: title on the left, actions on the right, a 2px light rule
   under the whole band. The title appears once, here. */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--divider);
}

.content-header h2 {
    font-size: 22px;
    font-weight: normal;
    color: var(--text);
}

.content-header .breadcrumb {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.content-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ─── Layout B: top header + tabs (no sidebar) ───────────────────────────
   A centered column with a white header band, a horizontal tab row under
   it, then the content. Chosen when screens read better full width or the
   sections are few. */

.dashboard,
.page-shell {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    background: var(--surface);
    border-bottom: 2px solid var(--divider);
    padding: 30px 0;
    margin-bottom: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 28px;
    font-weight: normal;
    text-align: left;
    margin: 0 0 5px 0;
}

.header .user-status {
    color: var(--text-muted);
    font-size: 14px;
    text-transform: capitalize;
}

/* ─── Tabs (top navigation and in-page tabs) ─────────────────────────────
   Transparent tabs on a 2px light rule; the active tab is burgundy with a
   3px burgundy underline. Never boxed, never a filled pill. */

.tabs,
.top-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--divider);
    margin-bottom: 30px;
    overflow-x: auto;
}

.tab,
.top-tab {
    padding: 14px 28px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 15px;
    font-weight: normal;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.tab:hover,
.top-tab:hover {
    color: var(--text);
}

.tab.active,
.top-tab.active {
    color: var(--red);
    border-bottom-color: var(--red);
}

.tab-panel,
.tab-content {
    display: none;
}

.tab-panel.active,
.tab-content.active {
    display: block;
}

/* ─── Cards ──────────────────────────────────────────────────────────────
   A plain white card with a 1px border and a 6px radius; hover lifts the
   border to burgundy with a soft tinted shadow. No colored left stripe. */

.card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-card);
    padding: 30px;
}

.card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: all 0.3s;
}

.card-link:hover {
    border-color: var(--red);
    box-shadow: 0 4px 20px rgba(155, 12, 35, 0.1);
    text-decoration: none;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    align-items: start;
}

/* Square burgundy icon chip that sits at the top of a card. */
.card-icon {
    width: 50px;
    height: 50px;
    background: var(--red);
    color: #ffffff;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.card-title {
    font-size: 18px;
    font-weight: normal;
    color: var(--text);
    margin-bottom: 12px;
}

.card-text {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
}

/* ─── Tables ─────────────────────────────────────────────────────────────
   Full-width table, faint gray header (normal weight), thin row rules,
   rows hover in the same faint gray. Header can stick for long tables. */

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 14px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-soft);
    font-size: 14px;
}

.data-table th {
    background: var(--bg);
    color: var(--text);
    font-weight: normal;
    position: sticky;
    top: 0;
    z-index: 2;
}

.data-table tr:hover {
    background: var(--bg);
}

.data-table .th-actions {
    text-align: right;
}

.data-table .actions-cell {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    white-space: nowrap;
}

.data-table .col-num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Sortable header: pointer cursor, burgundy on hover, arrow shows state. */
.sortable-th {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.sortable-th:hover {
    color: var(--red);
}

.sort-arrow {
    display: inline-block;
    vertical-align: -2px;
    margin-left: 4px;
    color: var(--red);
}

.sort-arrow-inactive {
    display: inline-block;
    vertical-align: -2px;
    margin-left: 4px;
    opacity: 0.25;
}

/* Drag-to-reorder rows: burgundy insertion line above or below the target. */
.drag-row { cursor: grab; }
.drag-row:active { cursor: grabbing; }
.dragging-row { opacity: 0.4; }
.insert-before td { box-shadow: inset 0 2px 0 var(--red); }
.insert-after td { box-shadow: inset 0 -2px 0 var(--red); }

.drag-handle {
    cursor: grab;
    color: var(--border-input);
    padding: 0 4px;
    user-select: none;
}

.drag-handle:hover { color: var(--red); }
.drag-handle:active { cursor: grabbing; }

/* ─── Badges ─────────────────────────────────────────────────────────────
   Two shapes, both tinted, both used in BSI: a flat 4px type badge
   (uppercase, for file types and short tags) and a soft pill (for roles and
   statuses). Pick per meaning. */

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: normal;
}

.badge-red    { background: var(--red-light); color: var(--red); }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-green  { background: #dcfce7; color: #166534; }
.badge-amber  { background: #fef3c7; color: #92400e; }
.badge-gray   { background: #f3f4f6; color: #374151; }

.pill {
    display: inline-block;
    padding: 4px 14px;
    border-radius: var(--radius-pill);
    font-size: 12px;
}

.pill-amber { background: #fef3c7; color: #92400e; }
.pill-blue  { background: #dbeafe; color: #1e40af; }
.pill-gray  { background: #f3f4f6; color: #374151; }
.pill-green { background: #dcfce7; color: #166534; }

/* ─── Empty state ────────────────────────────────────────────────────────*/

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state p {
    font-size: 15px;
    margin-bottom: 20px;
}

/* ─── Modal ──────────────────────────────────────────────────────────────
   Dark overlay, white card with an 8px radius, header / body / footer bands.
   Replaces every native alert / confirm / prompt. */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-large { max-width: 900px; }

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

.modal-header h3 {
    font-size: 18px;
    font-weight: normal;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover { color: var(--text); }

.modal-body { padding: 30px; }

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid var(--border-soft);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ─── Upload drop zone ───────────────────────────────────────────────────*/

.upload-drop-zone {
    border: 2px dashed var(--border-input);
    border-radius: var(--radius-lg);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 20px;
}

.upload-drop-zone:hover,
.upload-drop-zone.dragover {
    border-color: var(--red);
    background: rgba(155, 12, 35, 0.03);
}

.upload-drop-zone p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 5px;
}

.upload-drop-zone .formats {
    color: var(--text-light);
    font-size: 12px;
}

.upload-drop-zone input[type="file"] {
    display: none;
}

/* ─── Search bar ─────────────────────────────────────────────────────────*/

.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-bar input {
    flex: 1;
    max-width: 350px;
}

/* ─── Login ──────────────────────────────────────────────────────────────
   A centered card on a plain page: institute name, title, fields, a
   full-width burgundy button. */

body.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 50px 40px;
}

.login-card .institute-name {
    text-align: center;
    font-size: 18px;
    color: var(--text);
    margin-bottom: 5px;
    font-weight: normal;
}

.login-card h1 {
    text-align: center;
    margin-bottom: 10px;
}

.login-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 40px;
}

/* ─── Split screen (info + form) ─────────────────────────────────────────
   Two-panel card: a faint gray info panel on the left with the logo and
   explanatory copy, a white form panel on the right. For a richer login or
   a public entry screen. Stacks to one column on narrow screens, info on top. */

.split-page {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 60px 20px;
    min-height: 100vh;
}

.split-card {
    display: flex;
    width: 100%;
    max-width: 1120px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.split-info {
    flex: 1.15;
    background: var(--bg);
    border-right: 1px solid var(--border-soft);
    padding: 56px 52px;
}

.split-info .split-logo { height: 62px; margin: 0 0 30px; }
.split-info h1 { margin-bottom: 22px; }
.split-info p { color: var(--text-muted); line-height: 1.75; margin-bottom: 16px; }
.split-info p:last-child { margin-bottom: 0; }

.split-form {
    flex: 1;
    padding: 56px 52px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.split-form h2 { margin-bottom: 28px; }

@media (max-width: 760px) {
    .split-card { flex-direction: column; }
    .split-info { border-right: none; border-bottom: 1px solid var(--border-soft); }
}

@media (max-width: 480px) {
    .split-page { padding: 28px 14px; }
    .split-info, .split-form { padding: 34px 26px; }
    .split-info .split-logo { height: 54px; margin-bottom: 24px; }
}

/* ─── Responsive ─────────────────────────────────────────────────────────*/

@media (max-width: 900px) {
    .app-wrapper { flex-direction: column; }

    .sidebar {
        width: 100%;
        min-width: 100%;
        height: auto;
        position: relative;
        max-height: 50vh;
    }

    .main-content { padding: 20px; }
    .form-row { grid-template-columns: 1fr; }
    .card-grid { grid-template-columns: 1fr; }

    .content-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .data-table {
        display: block;
        overflow-x: auto;
    }
}
