/* Identity Platform — plain, hand-written CSS (no framework; see
   docs/architecture/web-ui-retrofit.md for why). */

:root {
    --color-bg: #f4f5f7;
    --color-surface: #ffffff;
    --color-border: #dfe3e8;
    --color-text: #1f2933;
    --color-text-muted: #616e7c;
    --color-primary: #2b5fd9;
    --color-primary-dark: #1e46a8;
    --color-danger: #c0392b;
    --color-danger-bg: #fdecea;
    --color-success: #1e8a4c;
    --color-success-bg: #e8f7ee;
    --color-approved-bg: #bef0d3;
    --radius: 6px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
    font-size: 16px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
}

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

a:hover {
    text-decoration: underline;
}

h1, h2, h3 {
    line-height: 1.25;
    margin: 0 0 1rem;
}

/* Layout shell */

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-nav {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.app-nav__brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-text);

    display: flex;
    flex-direction: row;
    gap: 0px;
}

.app-nav__brand img{
    width:80%;
    height: 50px;
}

.app-nav__links {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    align-items: center;
}

.app-nav__links a {
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

.app-nav__links a:hover,
.app-nav__links a.is-active {
    color: var(--color-primary);
}

.app-main {
    flex: 1;
    width: 100%;
    /* max-width: 1442px; */
    margin: 0 auto;
    

    display: flex;
    flex-direction: row;
    gap: 5px;
}

.app-sidebar{
    width: 20%;
    max-width: 250px;
    padding: 1rem;
    background-color: #fff;
}

.sidebar-nav__links {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    flex-wrap: wrap;
    align-items: left;
}

.sidebar-nav__links a {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    padding: 0px 5px;
}

.sidebar-nav__links a:hover,
.sidebar-nav__links a.is-active {
    color: var(--color-primary);
    /* background-color: var(--color-text-muted); */
}

.app-content{
    width: 80%;
    padding: 2rem 1.5rem;
}
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
}

/* Registration/correction forms have far more fields than a login card —
   the default 400px auth-card reads cramped for them. */
.auth-card--wide {
    max-width: 720px;
}

.auth-card__brand {
    text-align: center;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

/* Cards & sections */

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Forms */

.field {
    margin-bottom: 1rem;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.filter-bar .field {
    margin-bottom: 0;
    min-width: 180px;
    flex: 1 1 180px;
}

.filter-bar .field--search {
    flex: 2 1 240px;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="date"],
input[type="number"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--color-surface);
    color: var(--color-text);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(43, 95, 217, 0.15);
}

.field-error {
    color: var(--color-danger);
    font-size: 0.825rem;
    margin-top: 0.3rem;
}

.field-hint {
    color: var(--color-text-muted);
    font-size: 0.825rem;
    margin-top: 0.3rem;
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-field label {
    margin: 0;
    font-weight: 400;
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

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

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

.btn-secondary {
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text);
}

.btn-secondary:hover {
    background: var(--color-bg);
    text-decoration: none;
}

.btn-danger {
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border-color: #f3c6c1;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Alerts / flash messages */

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-success {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.alert-danger {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

/* Tables */

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

th, td {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.9rem;
}

th {
    color: var(--color-text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

tbody tr:hover {
    background: var(--color-bg);
}

.table-actions {
    display: flex;
    gap: 0.5rem;
}

.thumbnail,
.thumbnail-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    display: block;
}

.thumbnail-placeholder {
    background: var(--color-bg);
    border: 1px dashed var(--color-border);
}

/* Badges */

.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-approved{
    background-color: var(--color-approved-bg);
}
.badge-active,
.badge-validated,
.badge-completed,
.badge-downloaded,
.badge-printed {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.badge-pending,
.badge-processing,
.badge-draft {
    background: #fff6e0;
    color: #9c6f00;
}

.badge-rejected,
.badge-deactivated,
.badge-failed {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.badge-neutral,
.badge-archived {
    background: var(--color-bg);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

/* Dashboard KPIs & charts */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-tile {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    /* Tiles are rendered as <button> so they're clickable — reset the
       browser's default button chrome back to plain block styling. */
    width: 100%;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: default;
}

.kpi-tile--clickable {
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.kpi-tile--clickable:hover {
    box-shadow: 0 4px 12px rgba(16, 24, 40, 0.12);
    transform: translateY(-1px);
}

.kpi-tile__value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}

.kpi-tile__label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.chart-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    align-items: stretch;
}

.chart-card h3 {
    margin: 0 0 1rem;
    font-size: 1rem;
}

.donut-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.donut {
    width: 180px;
    height: 180px;
}

.chart-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.85rem;
}

.legend-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 0.4rem;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 1.5rem;
    height: 180px;
    padding-top: 1rem;
}

.bar-chart__col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
}

.bar-chart__bar {
    width: 100%;
    max-width: 48px;
    background: var(--color-primary);
    border-radius: var(--radius) var(--radius) 0 0;
    min-height: 2px;
    transition: height 0.2s ease;
}

.bar-chart__value {
    font-weight: 600;
    font-size: 0.85rem;
    margin-top: 0.4rem;
}

.bar-chart__label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 0.15rem;
    text-align: center;
}

/* Utility */

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

.empty-state {
    text-align: center;
    color: var(--color-text-muted);
    padding: 2.5rem 1rem;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 40;
}

.modal {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    width: 100%;
    max-width: 880px !important;
    max-height: 90vh;
    overflow-y: auto;
}

.modal--wide {
    max-width: 720px;
}

.modal__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

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

.breakdown-table th,
.breakdown-table td {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

.breakdown-table tfoot td {
    border-top: 2px solid var(--color-border);
    border-bottom: none;
}

.print-only {
    display: none;
}

/* Printing/saving-as-PDF a breakdown modal: hide everything else on the
   page (the visibility trick, not display:none, so re-enabling it on the
   modal's own subtree below actually works — display:none on an ancestor
   can't be overridden by a descendant, visibility can). */
@media print {
    body * {
        visibility: hidden;
    }

    .modal-backdrop--printable,
    .modal-backdrop--printable * {
        visibility: visible;
    }

    .modal-backdrop--printable {
        position: absolute;
        inset: 0;
        background: none;
        padding: 0;
    }

    .modal-backdrop--printable .modal {
        box-shadow: none;
        max-width: 100%;
        max-height: none;
    }

    .no-print {
        display: none !important;
    }

    .print-only {
        display: block;
    }
}

.pagination-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.pagination-summary {
    margin: 0;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.pagination {
    display: flex;
    list-style: none;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.pagination .page-item .page-link {
    display: inline-block;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-primary);
    text-decoration: none;
    background: var(--color-surface);
}

.pagination .page-item.active .page-link {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.pagination .page-item.disabled .page-link {
    color: var(--color-text-muted);
    pointer-events: none;
}

.detail-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.5rem 1.5rem;
    margin: 0;
}

.detail-list dt {
    color: var(--color-text-muted);
    font-weight: 600;
}

.detail-list dd {
    margin: 0;
}


.detail-container{
    width: 100%;

    display: flex;
    flex-direction: row;
    justify-content: space-between;
}

.media-passport{
    width: 400px;
    height: 400px;
}

.media-passport img{
    width: 100%;
    height: 100%;
    object-fit: cover;
}