/* ============================================================
   ISU — Custom styles
   ============================================================ */

/* --------------- Variables --------------- */
:root {
    --isu-header-h: 48px;
    --isu-footer-h: 28px;
    --isu-primary: #2563eb;
    --isu-primary-dark: #1d4ed8;
    --isu-bg-header: #1e293b;
    --isu-bg-footer: #f1f5f9;
    --isu-text-header: #e2e8f0;
    --isu-text-footer: #94a3b8;
    --isu-border: #334155;
}

/* --------------- MU Logo --------------- */
.isu-header__logo {
    height: 18px;
    width: auto;
    flex-shrink: 0;
}

/* --------------- Layout --------------- */
.isu-main {
    padding: 1rem 1rem 0;
    margin-top: var(--isu-header-h);
    min-height: calc(100vh - var(--isu-header-h) - var(--isu-footer-h));
}

.isu-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* --------------- Header --------------- */
.isu-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--isu-header-h);
    background: var(--isu-bg-header);
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
    overflow: visible;
}

.isu-header__inner {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 .75rem;
    gap: .5rem;
    overflow: visible;
}

/* Brand */
.isu-header__brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: #fff;
    font-weight: 700;
    font-size: .95rem;
    text-decoration: none;
    white-space: nowrap;
    padding-right: .6rem;
}
.isu-header__brand:hover { color: #fff; opacity: .9; }

.isu-header__brand-text {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: .03em;
    font-family: 'Montserrat', sans-serif;
}

/* Tenant badge */
.isu-header__tenant {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    background: #334155;
    color: #cbd5e1;
    font-size: .75rem;
    font-weight: 600;
    padding: .2rem .55rem;
    border-radius: 4px;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s;
}
.isu-header__tenant:hover { background: #475569; color: #e2e8f0; }

.isu-header__left {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* Separator between brand / tenant / nav */
.isu-header__separator {
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,.25);
    margin: 0 .6rem;
    flex-shrink: 0;
}

/* Tenant area */
.isu-header__tenant-area {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* Nav links */
.isu-header__nav {
    display: flex;
    align-items: center;
    gap: .15rem;
    flex: 1;
}

.isu-header__link {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    color: var(--isu-text-header);
    font-size: .8rem;
    font-weight: 500;
    padding: .35rem .65rem;
    border-radius: 5px;
    text-decoration: none;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.isu-header__link:hover {
    background: rgba(255,255,255,.1);
    color: #fff;
}
.isu-header__link--active {
    background: rgba(255,255,255,.15);
    color: #fff;
}
.isu-header__link i { font-size: .75rem; }

/* Right section */
.isu-header__right {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin-left: auto;
    flex-shrink: 0;
}

.isu-header__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--isu-text-header);
    border-radius: 5px;
    text-decoration: none;
    transition: background .15s;
}
.isu-header__icon:hover { background: rgba(255,255,255,.1); color: #fff; }

/* User menu trigger */
.isu-header__user {
    display: flex;
    align-items: center;
    gap: .4rem;
    cursor: pointer;
    padding: .25rem .4rem;
    border-radius: 5px;
    position: relative;
    transition: background .15s;
}
.isu-header__user:hover { background: rgba(255,255,255,.08); }

.isu-header__avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--isu-primary);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    flex-shrink: 0;
}

.isu-header__username {
    color: var(--isu-text-header);
    font-size: .8rem;
    font-weight: 500;
}

.isu-header__user .fa-chevron-down {
    color: #64748b;
    font-size: .55rem;
}

/* Dropdown */
.isu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 220px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
    border: 1px solid #e2e8f0;
    z-index: 1001;
    overflow: hidden;
}
.isu-dropdown--open { display: block; }

.isu-dropdown__header {
    padding: .6rem .75rem;
    display: flex;
    flex-direction: column;
}
.isu-dropdown__header strong { font-size: .85rem; color: #1e293b; }
.isu-dropdown__header small { font-size: .7rem; color: #64748b; }

.isu-dropdown__divider {
    height: 1px;
    background: #e2e8f0;
}

.isu-dropdown__item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .75rem;
    font-size: .8rem;
    color: #334155;
    text-decoration: none;
    transition: background .1s;
}
.isu-dropdown__item:hover { background: #f1f5f9; color: #1e293b; }
.isu-dropdown__item i { width: 16px; text-align: center; color: #64748b; font-size: .75rem; }
.isu-dropdown__item--danger { color: #dc2626; }
.isu-dropdown__item--danger:hover { background: #fef2f2; }
.isu-dropdown__item--danger i { color: #dc2626; }

/* Mobile burger */
.isu-header__burger {
    display: none;
    background: none;
    border: none;
    color: var(--isu-text-header);
    font-size: 1.1rem;
    cursor: pointer;
    padding: .3rem;
}

/* Mobile nav */
.isu-header__mobile-nav {
    display: none;
    background: var(--isu-bg-header);
    border-top: 1px solid var(--isu-border);
    padding: .4rem 0;
}
.isu-header__mobile-nav--open { display: block; }

.isu-header__mobile-link {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem 1rem;
    color: var(--isu-text-header);
    font-size: .85rem;
    text-decoration: none;
}
.isu-header__mobile-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.isu-header__mobile-link--danger { color: #f87171; }

@media (max-width: 768px) {
    .isu-header__nav { display: none; }
    .isu-header__separator { display: none; }
    .isu-header__tenant-area { display: none; }
    .isu-header__username { display: none; }
    .isu-header__user .fa-chevron-down { display: none; }
    .isu-header__burger { display: block; }
    .isu-header__tenant { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
}

/* --------------- Footer --------------- */
.isu-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--isu-footer-h);
    background: var(--isu-bg-footer);
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .6rem;
    color: var(--isu-text-footer);
    z-index: 999;
    letter-spacing: .02em;
}

/* --------------- Messages --------------- */
.isu-messages {
    position: fixed;
    top: calc(var(--isu-header-h) + 8px);
    right: 12px;
    z-index: 1002;
    max-width: 400px;
}
.isu-messages .toast {
    margin-bottom: .4rem;
    font-size: .85rem;
}

/* --------------- Cards --------------- */
.card--hoverable {
    transition: transform .15s, box-shadow .15s;
}
.card--hoverable:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}

/* --------------- HTMX --------------- */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { display: inline-block; }

/* --------------- Breadcrumb --------------- */
.breadcrumb { font-size: .85rem; }
.breadcrumb a { color: var(--isu-primary); }
.breadcrumb__item--active { color: #334155; font-weight: 600; }
.breadcrumb a::after { content: " / "; color: #94a3b8; margin: 0 .25rem; }

/* --------------- Toast close --------------- */
.toast { position: relative; }
.toast .btn-close {
    position: absolute; top: .4rem; right: .4rem;
    background: none; border: none; cursor: pointer;
    font-size: 1.1rem; opacity: .5;
}
.toast .btn-close:hover { opacity: 1; }
.toast .btn-close::after { content: "\00d7"; }

/* --------------- Landing features grid --------------- */
.mu-features-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
    max-width: 940px;
}
@media (max-width: 640px) {
    .mu-features-grid {
        grid-template-columns: 1fr;
        max-width: 450px;
        margin: 0 auto;
    }
}
.mu-features-grid .card {
    transition: transform .15s, box-shadow .15s;
}
.mu-features-grid .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}
.mu-features-desc {
    color: #64748b;
    font-size: .83rem;
    line-height: 1.3;
    margin: .4rem 0 0;
}

/* --------------- Utilities --------------- */
.u-no-style-link {
    color: inherit;
    text-decoration: none;
}
.u-no-style-link:hover {
    color: inherit;
    text-decoration: none;
}

/* --------------- Tables --------------- */
.table th,
.table td {
    padding: .5rem .75rem !important;
}
.table thead th {
    font-size: .8rem;
    font-weight: 700;
    text-transform: none;
    white-space: nowrap;
    background: #f1f5f9;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
    text-align: center;
}
.small-table thead th {
    background: #f1f5f9;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
    text-align: center;
}
.card .card__header {
    padding: .6rem .75rem;
}

/* Card body list rows — padding za non-table sadrzaj */
.dash-row {
    padding: .4rem .75rem;
    border-bottom: 1px solid #f1f5f9;
}
.dash-row:last-child { border-bottom: none; }

/* --------------- Print --------------- */
@media print {
    .isu-header, .isu-footer, .btn, .breadcrumb { display: none !important; }
    .isu-main { margin-top: 0 !important; min-height: auto !important; }
}

/* --------------- Tenant Select (native) --------------- */
.isu-tenant-select {
    background: #334155;
    color: #cbd5e1;
    font-size: .75rem;
    font-weight: 600;
    padding: .2rem .4rem;
    border-radius: 4px;
    border: 1px solid #475569;
    cursor: pointer;
    font-family: inherit;
    max-width: 200px;
    -webkit-appearance: auto;
    appearance: auto;
}
.isu-tenant-select:hover {
    background: #475569;
    color: #e2e8f0;
}
.isu-tenant-select:focus {
    outline: none;
    border-color: var(--isu-primary);
    box-shadow: 0 0 0 2px rgba(37,99,235,.25);
}
.isu-tenant-select option {
    background: #fff;
    color: #1e293b;
    font-size: .85rem;
    padding: .3rem;
}

.isu-header__tenant--static {
    cursor: default;
}
.isu-header__tenant--static:hover {
    background: #334155;
    color: #cbd5e1;
}

/* --------------- Dashboard --------------- */
.dash-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .75rem;
}
@media (max-width: 768px) {
    .dash-stats { grid-template-columns: repeat(2, 1fr); }
}

.dash-stat {
    background: #fff;
    border-radius: 8px;
    padding: .75rem 1rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    display: flex;
    align-items: center;
}
.dash-stat--ok { border-left: 3px solid #22c55e; }
.dash-stat--warn { border-left: 3px solid #f59e0b; }

.dash-stat__value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}
.dash-stat__value small {
    font-size: .8rem;
    font-weight: 400;
    color: #64748b;
}
.dash-stat__label {
    font-size: .75rem;
    color: #64748b;
    margin-top: .15rem;
}
.dash-stat__link {
    font-size: .7rem;
    color: var(--isu-primary);
    text-decoration: none;
    margin-top: .3rem;
    display: inline-block;
}
.dash-stat__link:hover { text-decoration: underline; }

.dash-stat__bar {
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    margin-top: .4rem;
    overflow: hidden;
}
.dash-stat__bar-fill {
    height: 100%;
    background: #22c55e;
    border-radius: 2px;
    transition: width .5s ease;
}

.dash-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: .35rem;
    vertical-align: middle;
}

.small-table th,
.small-table td {
    padding: .35rem .75rem !important;
    font-size: .8rem;
    vertical-align: middle;
}

.tenant-fullname {
    display: block;
    font-size: .75rem;
    color: #64748b;
    margin-top: 1px;
    line-height: 1.2;
}

.tenant-row--inactive {
    background: #f8fafc;
}

.tenant-row--inactive td {
    opacity: .65;
}

.tenant-row--inactive td:last-child {
    opacity: 1;
}

/* Tables inside cards: ensure last row has visual padding */
.card__body.p-0 table.table {
    margin-bottom: 0;
}

.card__body.p-0 table.table tbody tr:last-child td {
    padding-bottom: .6rem !important;
}

/* Ensure card body has consistent padding */
.card__body {
    padding: 1rem 1.25rem;
}

/* OIB validation feedback */
.oib-feedback {
    font-size: .72rem;
    margin-top: .2rem;
    display: block;
}

.oib-feedback--error {
    color: #ef4444;
}

.oib-feedback--ok {
    color: #22c55e;
}

/* Buttons with hover shadow */
.isu-btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .4rem .85rem;
    transition: box-shadow .2s, transform .1s;
}

.isu-btn:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}

.isu-btn:active {
    transform: scale(.97);
}

/* Icon button for table actions */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    color: var(--isu-primary);
    font-size: .85rem;
    cursor: pointer;
    border-radius: 4px;
    text-decoration: none;
    transition: background .15s;
    vertical-align: middle;
}

.icon-btn:hover {
    background: #f1f5f9;
}

.icon-btn:visited {
    color: var(--isu-primary);
}

/* Side-by-side tables */
.dash-tables-row {
    display: flex;
    gap: .75rem;
    align-items: stretch;
}
.dash-tables-row__main {
    flex: 3;
    min-width: 0;
}
.dash-tables-row__side {
    flex: 2;
    min-width: 0;
}
.dash-tables-row__half {
    flex: 1;
    min-width: 0;
}
@media (max-width: 768px) {
    .dash-tables-row {
        flex-direction: column;
    }
}

/* Mini pie chart in stat cards */
.dash-mini-chart {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    margin-left: auto;
    cursor: pointer;
}
.dash-mini-chart path {
    transition: transform .15s ease, filter .15s ease;
    transform-origin: 18px 18px;
}
.dash-mini-chart rect {
    transition: filter .15s ease;
}
.dash-mini-chart path:hover {
    transform: scale(1.08);
    filter: brightness(1.1);
}
.dash-mini-chart rect:hover {
    filter: brightness(1.15);
}
.dash-chart-tooltip {
    position: fixed;
    background: #1e293b;
    color: #fff;
    font-size: .72rem;
    padding: .25rem .5rem;
    border-radius: 4px;
    pointer-events: none;
    z-index: 9999;
    white-space: nowrap;
    display: none;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.dash-stat__info {
    flex: 1;
    min-width: 0;
}
.u-gap-1 { gap: .5rem; }
.dash-stat > .u-flex { width: 100%; }

/* Birthday row states */
.dash-row--past {
    opacity: .55;
}
.dash-row--today {
    background: #fefce8;
}

/* Table pagination */
.dash-pager {
    display: flex;
    align-items: center;
    gap: .25rem;
    padding: .35rem .6rem;
    border-top: 1px solid #e2e8f0;
    background: #fafbfc;
    font-size: .75rem;
    min-height: 34px;
}
.dash-pager__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 .3rem;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: #fff;
    color: #475569;
    cursor: pointer;
    font-size: .7rem;
    font-family: inherit;
    line-height: 1;
    transition: background .1s, color .1s;
}
.dash-pager__btn:hover {
    background: #f1f5f9;
}
.dash-pager__btn--active {
    background: var(--isu-primary);
    color: #fff;
    border-color: var(--isu-primary);
}
.dash-pager__btn--active:hover {
    background: var(--isu-primary-dark);
}
.dash-pager__btn:disabled {
    opacity: .4;
    cursor: default;
}
.dash-pager__info {
    color: #94a3b8;
    font-size: .68rem;
    margin-left: auto;
    line-height: 24px;
}

/* Table filters */
.dash-filters {
    display: flex;
    gap: .4rem;
    padding: .4rem .6rem;
    border-bottom: 1px solid #e2e8f0;
    background: #fafbfc;
    align-items: center;
}

/* Fixed height table body */
.dash-table-body {
    flex: 1;
    min-height: 320px;
    overflow: hidden;
}
.dash-filter-input {
    font-size: .75rem;
    padding: .2rem .4rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-family: inherit;
    outline: none;
    height: 26px;
    line-height: 1;
    box-sizing: border-box;
}
.dash-filter-input:focus {
    border-color: var(--isu-primary);
    box-shadow: 0 0 0 2px rgba(37,99,235,.12);
}
.dash-filter-input--name {
    flex: 1;
    min-width: 80px;
    max-width: 160px;
}
.dash-filter-input--year {
    width: 90px;
}

/* Logo management */
.logo-grid {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.logo-card {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: .75rem;
    text-align: center;
    width: 160px;
}
.logo-card--primary {
    border-color: #22c55e;
    background: #f0fdf4;
}
.logo-card__img {
    max-width: 120px;
    max-height: 80px;
    object-fit: contain;
    margin-bottom: .5rem;
}
.logo-card__actions {
    display: flex;
    gap: .3rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

/* Email Wizard */
.wiz-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: .5rem 0;
}
.wiz-step {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .4rem .8rem;
    border-radius: 20px;
    background: #f1f5f9;
    color: #94a3b8;
    font-size: .8rem;
    transition: all .2s;
}
.wiz-step--active {
    background: var(--isu-primary);
    color: #fff;
    font-weight: 600;
}
.wiz-step--done {
    background: #dcfce7;
    color: #16a34a;
}
.wiz-step__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255,255,255,.3);
    font-size: .7rem;
    font-weight: 700;
}
.wiz-step--active .wiz-step__num {
    background: rgba(255,255,255,.3);
}
.wiz-step--done .wiz-step__num {
    background: #16a34a;
    color: #fff;
}
.wiz-step__line {
    width: 32px;
    height: 2px;
    background: #e2e8f0;
    flex-shrink: 0;
}

/* Wizard editor */
.wiz-editor {
    min-height: 180px;
    max-height: 350px;
    overflow-y: auto;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: .75rem;
    font-size: .85rem;
    line-height: 1.5;
    outline: none;
}
.wiz-editor:focus {
    border-color: var(--isu-primary);
    box-shadow: 0 0 0 2px rgba(37,99,235,.12);
}
.wiz-editor-toolbar {
    display: flex;
    align-items: center;
    gap: .2rem;
}

/* Quill editor — Cirrus CSS reset */
.ql-editor { min-height: 200px; }
.ql-toolbar { background: #f8fafc; border-radius: 6px 6px 0 0; }
.ql-container { border-radius: 0 0 6px 6px; font-size: .9rem; background: #fff; }
.ql-toolbar * { box-sizing: content-box; }
.ql-toolbar button {
    height: 24px !important;
    width: 28px !important;
    padding: 3px 5px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    vertical-align: middle !important;
    float: none !important;
    background: none !important;
    border: none !important;
    margin: 0 !important;
    line-height: 1 !important;
}
.ql-toolbar button svg {
    width: 18px; height: 18px;
    vertical-align: middle;
}
.ql-toolbar .ql-picker {
    height: 24px !important;
    vertical-align: middle !important;
    display: inline-flex !important;
    align-items: center !important;
}
.ql-toolbar .ql-picker-label {
    padding: 2px 8px !important;
    line-height: 24px !important;
    display: inline-flex !important;
    align-items: center !important;
}
.ql-toolbar .ql-formats {
    display: inline-flex !important;
    align-items: center !important;
    vertical-align: middle !important;
    margin-right: 12px !important;
}

/* Variable tag buttons */
.var-btn {
    display: inline-block;
    padding: .2rem .5rem;
    margin: .15rem;
    font-size: .75rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 4px;
    color: #2563eb;
    cursor: pointer;
    transition: background .15s;
}
.var-btn:hover { background: #dbeafe; }

/* Wizard panels — center cards under steps */
.wiz-panel {
    display: flex;
    justify-content: center;
}
.wiz-panel > .card {
    width: 100%;
    max-width: 720px;
}

/* Preview modal */
.wiz-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.wiz-modal__content {
    background: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.wiz-modal__header {
    padding: .6rem 1rem;
    border-bottom: 1px solid #e2e8f0;
}

@media (max-width: 768px) {
    .wiz-steps { flex-wrap: wrap; gap: .3rem; }
    .wiz-step__label { display: none; }
    .wiz-step__line { width: 16px; }
    .wiz-modal__content { width: 98%; }
}

/* Utility colors for wizard */
.text-green-500 { color: #22c55e; }

/* Generic modal */
.isu-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.isu-modal.is-open {
    display: flex;
}
.isu-modal__box {
    background: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.isu-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
}
.isu-modal__body {
    padding: 1rem;
}
.isu-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    padding: .75rem 1rem;
    border-top: 1px solid #e2e8f0;
}

/* Sortable table headers */
.sortable-th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.sortable-th:hover {
    background: #e2e8f0 !important;
}
.sort-icon {
    margin-left: .25rem;
    color: var(--isu-primary);
}
.sort-icon--inactive {
    color: #cbd5e1;
}

/* ============================================================
   Login / Auth pages
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8ecf4 50%, #f0f4ff 100%);
    padding: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(30, 41, 59, .08), 0 1px 3px rgba(30, 41, 59, .06);
    overflow: hidden;
}

.login-card__brand {
    text-align: center;
    padding: 2rem 2rem 1.25rem;
    background: var(--isu-bg-header);
    border-bottom: none;
}

.login-logo {
    height: 28px;
    width: auto;
}

.login-brand {
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .5rem;
}

.login-brand-text {
    font-family: 'Montserrat', sans-serif;
    font-size: 2.15rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: .03em;
}

.login-subtitle {
    font-size: .85rem;
    color: #94a3b8;
    margin: 0;
    line-height: 1.4;
}

.login-form {
    padding: 1.5rem 2rem 2rem;
}

.login-field {
    margin-bottom: 1.25rem;
}

.login-field label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: .35rem;
    letter-spacing: .01em;
}

.login-field label i {
    color: #94a3b8;
    width: 14px;
    font-size: .75rem;
}

.login-field .input-control,
.login-field input[type="email"],
.login-field input[type="password"],
.login-field input[type="text"] {
    width: 100%;
    padding: .6rem .75rem;
    font-size: .9rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #1e293b;
    transition: border-color .2s, box-shadow .2s, background .2s;
    outline: none;
    box-sizing: border-box;
}

.login-field .input-control:focus,
.login-field input:focus {
    border-color: var(--isu-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
    background: #fff;
}

.login-field-error {
    display: block;
    font-size: .75rem;
    color: #ef4444;
    margin-top: .3rem;
}

.login-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: 1.5rem;
    gap: .75rem;
}

.login-forgot {
    font-size: .8rem;
    color: #64748b;
    text-decoration: none;
    transition: color .2s;
    white-space: nowrap;
}

.login-forgot:hover {
    color: var(--isu-primary);
}

.login-btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem 1.5rem;
    background: var(--isu-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, transform .1s, box-shadow .2s;
    text-decoration: none;
    white-space: nowrap;
}

.login-btn:hover {
    background: var(--isu-primary-dark);
    box-shadow: 0 2px 8px rgba(37, 99, 235, .25);
}

.login-btn:active {
    transform: scale(.98);
}

.login-error {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0 2rem;
    padding: .65rem .85rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    font-size: .82rem;
    font-weight: 500;
}

.login-error i {
    flex-shrink: 0;
}

.login-info {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    margin-bottom: 0;
    padding: .75rem 1rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    color: #1e40af;
    font-size: .82rem;
    line-height: 1.4;
}

.login-info i {
    flex-shrink: 0;
    margin-top: .15rem;
    font-size: 1.1rem;
}

.login-info p {
    margin: 0;
}

.login-info--success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.login-card__footer {
    text-align: center;
    padding: .75rem 2rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    font-size: .82rem;
    color: #64748b;
}

.login-card__footer p {
    margin: .25rem 0;
}

.login-card__footer a {
    color: var(--isu-primary);
    font-weight: 600;
    text-decoration: none;
}

.login-card__footer a:hover {
    text-decoration: underline;
}

.login-attribution {
    margin-top: 1.5rem;
    font-size: .72rem;
    color: #94a3b8;
    text-align: center;
}

/* Password reset confirm — style Django's default form widgets */
.login-form #id_new_password1,
.login-form #id_new_password2 {
    width: 100%;
    padding: .6rem .75rem;
    font-size: .9rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #1e293b;
    transition: border-color .2s, box-shadow .2s, background .2s;
    outline: none;
    box-sizing: border-box;
}

.login-form #id_new_password1:focus,
.login-form #id_new_password2:focus {
    border-color: var(--isu-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
    background: #fff;
}

/* Hide Django's password help text list */
.login-form .helptext {
    display: block;
    font-size: .72rem;
    color: #94a3b8;
    margin-top: .3rem;
    line-height: 1.3;
}

.login-form .helptext ul {
    margin: .25rem 0 0;
    padding-left: 1.2rem;
}

@media (max-width: 480px) {
    .login-card {
        border-radius: 0;
        box-shadow: none;
    }
    .login-page {
        padding: 0;
        background: #fff;
    }
    .login-form {
        padding: 1.25rem 1.25rem 1.5rem;
    }
    .login-card__brand {
        padding: 1.5rem 1.25rem .75rem;
    }
}

/* Member role badges */
.badge-au {
    display: inline-block;
    font-size: .6rem;
    font-weight: 700;
    line-height: 1;
    padding: .25rem .35rem;
    border-radius: 3px;
    background: #dc2626;
    color: #fff;
    vertical-align: middle;
    margin-left: .3rem;
    cursor: default;
    letter-spacing: .03em;
}
.badge-au--editor {
    background: #2563eb;
}
.badge-au--viewer {
    background: #6b7280;
}

/* Role filter badges in member list */
.role-filter-group {
    display: inline-flex;
    gap: .25rem;
    margin-left: .25rem;
}
.role-filter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .65rem;
    font-weight: 700;
    padding: .15rem .35rem;
    border-radius: 3px;
    cursor: pointer;
    user-select: none;
    border: 1.5px solid #cbd5e1;
    color: #94a3b8;
    background: #fff;
    transition: all .15s ease;
    line-height: 1;
}
.role-filter:hover {
    border-color: #94a3b8;
    color: #64748b;
}
.role-filter.is-active[data-role="admin"] {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}
.role-filter.is-active[data-role="editor"] {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}
.role-filter.is-active[data-role="viewer"] {
    background: #6b7280;
    border-color: #6b7280;
    color: #fff;
}
.role-filter.is-active[data-role="member"] {
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: #fff;
}

.badge-au--member {
    background: #8b5cf6;
}

/* Settings list rows */
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .12rem .75rem;
    font-size: .85rem;
    border-bottom: 1px solid #f1f5f9;
    min-height: 2rem;
}
.setting-row:last-child { border-bottom: none; }
.setting-row__name { flex: 1; line-height: 2rem; }
.setting-row__input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: .15rem .4rem;
    font-size: .85rem;
    outline: none;
    height: 1.6rem;
}
.setting-row__input:focus { border-color: var(--isu-primary); }
.setting-row__actions {
    display: flex;
    align-items: center;
    gap: .1rem;
    margin-left: .5rem;
    height: 2rem;
}
.setting-row__actions form {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 0;
    line-height: 1;
}
.setting-row__btn {
    display: inline-flex;
    align-items: center !important;
    justify-content: center !important;
    width: 1.6rem !important;
    height: 1.6rem !important;
    border: none !important;
    background: transparent !important;
    cursor: pointer;
    font-size: .8rem !important;
    border-radius: 3px;
    color: #64748b;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    vertical-align: middle;
    box-shadow: none !important;
}
.setting-row__btn.u-hide { display: none !important; }
.setting-row__btn:hover { background: #f1f5f9 !important; }
.setting-row__btn--danger { color: #ef4444 !important; }
.setting-row__btn--danger:hover { background: #fef2f2 !important; }
.setting-row__btn--success { color: #22c55e !important; }
.setting-row--add {
    background: #f8fafc;
    gap: .5rem;
    padding: .2rem .75rem;
}
.setting-row--add .setting-row__input {
    border-color: #e2e8f0;
}
.setting-row__add-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 1.6rem !important;
    height: 1.6rem !important;
    border: none !important;
    background: var(--isu-primary) !important;
    color: #fff !important;
    cursor: pointer;
    font-size: .9rem !important;
    font-weight: 700;
    border-radius: 4px;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    flex-shrink: 0;
    box-shadow: none !important;
}
.setting-row__add-btn:hover { background: var(--isu-primary-dark) !important; }

/* Password toggle eye button */
.pw-toggle {
    position: absolute;
    right: .4rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    font-size: .8rem;
    padding: .2rem;
    line-height: 1;
}
.pw-toggle:hover { color: #475569; }
