@charset "utf-8";
/* ==========================================================================
   css_cir2_5_c.css
   DWH2 — Refined working style with center header info
   Color scheme: CER in Rete greens, clean and professional
   Logo reference: ../images/logo.jpeg
   Style: lighter typography, finer weights, slightly more elegant than cir2_4 with institution/date header
   ========================================================================== */

/* ==========================================================================
   1. CSS Custom Properties
   ========================================================================== */

:root {
    --color-primary: #00543D;
    --color-primary-hover: #006E4F;
    --color-accent: #329542;
    --color-accent-light: #E0F2E5;
    --color-danger: #C42B1C;
    --color-danger-hover: #A12315;
    --color-warning: #C8960C;
    --color-text: #222222;
    --color-text-muted: #555555;
    --color-text-light: #777777;
    --color-bg: #EEEEEE;
    --color-surface: #FFFFFF;
    --color-border: #CCCCCC;
    --color-border-light: #DDDDDD;
    --color-row-hover: #F4F4F4;
    --color-row-alt: #F9F9F9;
    --font-body: 'Segoe UI', Calibri, Helvetica, Arial, sans-serif;
    --font-heading: 'Segoe UI', Calibri, Helvetica, Arial, sans-serif;
    --radius: 3px;
    --radius-sm: 2px;
}

/* ==========================================================================
   2. Global Resets & Base Elements
   ========================================================================== */

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-size: 14px;
    line-height: 1.5;
    background: var(--color-bg);
    font-family: var(--font-body);
    color: var(--color-text);
    margin: 0;
    padding: 0;
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--color-text);
    margin-top: 0;
}

a:link {
    color: var(--color-text);
    font-weight: 400;
    text-decoration: none;
}
a:visited {
    color: var(--color-text);
    font-weight: 400;
    text-decoration: none;
}
a:hover {
    color: var(--color-primary);
    text-decoration: underline;
}
a:active {
    color: var(--color-text);
    text-decoration: none;
}

table {
    border-collapse: collapse;
    color: var(--color-text);
    margin-bottom: 10px;
    width: 100%;
    font-size: 14px;
}

form {
    margin: 0;
    padding: 0;
    width: 100%;
}

label {
    display: block;
    font-size: 14px;
    margin-top: 2px;
    margin-bottom: 5px;
    font-weight: 500;
}

input {
    font-size: 14px;
    font-family: var(--font-body);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
}

textarea {
    width: 100%;
    font-size: 14px;
    font-family: var(--font-body);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
}

select {
    font-size: 14px;
    width: auto;
}

input[type=checkbox] {
    width: auto;
}

input[type=radio] {
    width: auto;
}

/* ==========================================================================
   3. Body Layout (flex column for sticky footer)
   ========================================================================== */

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container,
.container-narrow,
.container-medium,
.container-form,
.container-wide,
.container-full {
    flex: 1 0 auto;
    /* body is a column flex container: horizontal auto margins disable the
       default stretch, so without an explicit width the container would
       shrink-wrap to its content instead of filling up to max-width. */
    width: 100%;
}

/* ==========================================================================
   4. Site Footer (body::after)
   ========================================================================== */

body::after {
    display: none;
}

.site-footer {
    flex-shrink: 0;
    font-size: 11px;
    color: var(--color-text-light);
    text-align: center;
    padding: 10px 10px;
    border-top: 1px solid var(--color-border);
    background-color: var(--color-surface);
    width: 100%;
    box-sizing: border-box;
    font-family: var(--font-body);
}

.site-footer a {
    color: var(--color-primary);
}

.site-footer a:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

/* ==========================================================================
   5. Site Header + Navbar
   ========================================================================== */

.navbar {
    background-color: var(--color-surface);
    background-image: url('../images/logo.png');
    background-repeat: no-repeat;
    background-position: right 20px top 10px;
    background-size: 72px;
    padding: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
    border-bottom: 1px solid var(--color-border);
}

.navbar h1 {
    color: var(--color-text);
    font-size: 1.5rem;
    font-family: var(--font-heading);
    font-weight: 600;
    padding: 14px 22px 8px;
    margin: 0;
}

.navbar-page-date {
    display: block;
    font-size: 0.82rem;
    color: var(--color-primary);
    font-weight: 500;
    padding: 0 22px 4px;
    letter-spacing: 0.3px;
    font-family: var(--font-body);
}

.navbar-links {
    background-color: var(--color-primary);
    padding: 0 6px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 10px;
}

.navbar-links a,
.navbar-links a:link,
.navbar-links a:visited,
.navbar-links a:active {
    color: white;
    text-decoration: none;
    padding: 6px 12px;
    transition: background-color 0.1s;
    font-weight: 400;
    font-family: var(--font-body);
    line-height: 26px;
    font-size: 13.5px;
}

.navbar-links a:hover {
    background-color: var(--color-primary-hover);
    color: white;
    text-decoration: none;
}

.navbar-links .logout-btn,
.navbar-links .logout-btn:link,
.navbar-links .logout-btn:visited {
    background-color: transparent;
    color: rgba(255, 255, 255, 0.85);
    margin-left: auto;
}

.navbar-links .logout-btn:hover {
    background-color: var(--color-danger);
    color: white;
}

/* --- Navbar Center Info (institution, date, ente code) --- */

.navbar-center-info {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    white-space: nowrap;
    /* Fill the header area above the navbar-links bar, then flex-center */
    height: calc(100% - 48px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.navbar-institution-name {
    display: block;
    font-weight: 600;
    color: var(--color-primary);
    font-size: 1.15rem;
    line-height: 1.2;
    font-family: var(--font-heading);
}

.navbar-ente-code {
    display: block;
    font-size: 0.72rem;
    color: var(--color-text-light);
    margin-top: 0;
    font-family: var(--font-body);
}

/* --- Navbar dropdown mini-menus --- */
/* Markup is generated by the nav-submenus script in base.html:
   <div class="nav-item"><a class="nav-parent">…</a><div class="nav-dropdown" hidden>…</div></div>
   Menus open on click only; the script toggles the [hidden] attribute. */

.navbar-links .nav-item {
    position: relative;
    display: flex;
}

.navbar-links .nav-parent::after {
    content: "▾";
    font-size: 9px;
    margin-left: 6px;
    opacity: 0.75;
}

.navbar-links .nav-item.open > .nav-parent::after {
    content: "▴";
}

.nav-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 195px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-top: 2px solid var(--color-accent);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
    padding: 4px 0;
    z-index: 1000;
}

.nav-dropdown[hidden] {
    display: none;
}

.navbar-links .nav-item.open > a.nav-parent {
    background-color: var(--color-primary-hover);
}

.navbar-links .nav-dropdown a,
.navbar-links .nav-dropdown a:link,
.navbar-links .nav-dropdown a:visited,
.navbar-links .nav-dropdown a:active {
    display: block;
    color: var(--color-text);
    padding: 7px 16px;
    font-size: 13px;
    line-height: 1.4;
    white-space: nowrap;
}

.navbar-links .nav-dropdown a:hover {
    background-color: var(--color-accent-light);
    color: var(--color-primary);
    text-decoration: none;
}

/* ==========================================================================
   6. Container Variants
   ========================================================================== */

.container {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 16px;
}

.container-narrow {
    max-width: 700px;
    margin: 36px auto;
    padding: 0 16px;
}

.container-medium {
    max-width: 850px;
    margin: 36px auto;
    padding: 0 16px;
}

.container-form {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 16px;
}

.container-wide {
    max-width: 1550px;
    margin: 20px auto;
    padding: 0 16px;
}

.container-full {
    max-width: 1700px;
    margin: 20px auto;
    padding: 0 16px;
}

/* ==========================================================================
   7. Cards — flat, bordered, no top accent
   ========================================================================== */

.card {
    background-color: var(--color-surface);
    padding: 22px;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.card-padded {
    padding: 28px;
}

.card-centered {
    text-align: center;
    padding: 35px;
}

.card h2 {
    color: var(--color-text);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--color-primary);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.25rem;
}

.card h2.card-heading-compact {
    margin-bottom: 10px;
}

.card h3 {
    color: var(--color-text);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-primary);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.15rem;
}

.card h3.card-heading-spacious {
    margin-bottom: 18px;
}

.card p {
    color: var(--color-text-muted);
    margin-bottom: 18px;
}

.card-subtitle {
    color: var(--color-text-muted);
    margin-bottom: 16px;
}

.card-footer {
    text-align: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border-light);
    color: var(--color-text-muted);
}

.card-footer a,
.card-footer a:link,
.card-footer a:visited {
    color: var(--color-primary);
    text-decoration: underline;
}

.card-footer a:hover {
    text-decoration: underline;
    color: var(--color-primary-hover);
}

.card-footer p {
    margin-bottom: 8px;
}

.card-footer p:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   8. Alerts — soft tints, compact
   ========================================================================== */

.alert {
    padding: 10px 15px;
    margin-bottom: 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 400;
}

.alert-success {
    background-color: var(--color-accent-light);
    color: var(--color-primary);
    border: 1px solid #B7DCC5;
}

.alert-error {
    background-color: #F8D7DA;
    color: #721C24;
    border: 1px solid #F1AEB5;
}

.alert-warning {
    background-color: #FFF3CD;
    color: #664D03;
    border: 1px solid #FFDA6A;
}

/* ==========================================================================
   9. Form Groups and Controls
   ========================================================================== */

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

.form-group-spacious {
    margin-bottom: 18px;
}

.form-group label,
.form-group-spacious label {
    display: block;
    margin-bottom: 5px;
    color: var(--color-text);
    font-weight: 500;
    font-size: 14px;
}

.form-group-spacious label {
    margin-bottom: 7px;
}

/* Asterisk marking a compulsory field, e.g. <label>Email <span class="required-mark">*</span></label> */
.required-mark {
    color: var(--color-danger);
    font-weight: 600;
    margin-left: 1px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background-color: var(--color-surface);
    font-family: var(--font-body);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(0, 84, 61, 0.1);
}

.form-control-otp {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 1.2rem;
    text-align: center;
    letter-spacing: 5px;
    background-color: var(--color-surface);
}

.form-control-otp:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(0, 84, 61, 0.1);
}

.form-group input,
.form-group-spacious input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background-color: var(--color-surface);
    font-family: var(--font-body);
}

.form-group input:focus,
.form-group-spacious input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(0, 84, 61, 0.1);
}

.form-group select,
.form-group-spacious select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background-color: var(--color-surface);
}

.form-group select:focus,
.form-group-spacious select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(0, 84, 61, 0.1);
}

.form-group select[multiple],
.form-group-spacious select[multiple] {
    height: 200px;
}

.form-group small,
.form-group-spacious small {
    display: block;
    color: var(--color-text-light);
    margin-top: 4px;
    font-size: 12.5px;
}

.field-error {
    color: var(--color-danger);
    font-size: 13px;
    margin-top: 4px;
}

.field-error-centered {
    color: var(--color-danger);
    font-size: 13px;
    margin-top: 4px;
    text-align: center;
}

.form-errors {
    background-color: #F8D7DA;
    color: #721C24;
    border: 1px solid #F1AEB5;
    padding: 10px 15px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

.helptext {
    font-size: 12.5px;
    color: var(--color-text-light);
    margin-top: 4px;
}

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 22px;
}

.filter-form {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 18px;
}

.filter-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-form .form-group label {
    color: var(--color-text-muted);
    font-size: 13px;
}

.filter-form .form-group input,
.filter-form .form-group select {
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    min-width: 190px;
    background-color: var(--color-surface);
}

/* ==========================================================================
   10. Buttons + Link-State Overrides
   ========================================================================== */

.btn {
    display: inline-block;
    /* Border lives on the base so every variant has the same total size
       (9+1 = the 10px/20px footprint of the old borderless buttons).
       Bare .btn without a variant renders as a readable neutral outline —
       never white-on-light. */
    padding: 9px 19px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.1s, border-color 0.1s;
    background-color: var(--color-surface);
    color: var(--color-text-muted);
    font-family: var(--font-body);
}

.btn:hover {
    background-color: var(--color-row-hover);
    border-color: #999999;
    color: var(--color-text);
}

.btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}

.btn-block {
    width: 100%;
    padding: 10px;
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.1s;
    font-family: var(--font-body);
}

.btn-block:hover {
    background-color: var(--color-primary-hover);
}

.btn-block:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}

.btn-primary {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    color: white;
}

.btn-success {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
    color: white;
}

.btn-success:hover {
    background-color: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    color: white;
}

.btn-danger {
    background-color: var(--color-danger);
    border-color: var(--color-danger);
    color: white;
}

.btn-danger:hover {
    background-color: var(--color-danger-hover);
    border-color: var(--color-danger-hover);
    color: white;
}

/* Same neutral outline as bare .btn; kept so templates stay explicit. */
.btn-secondary {
    background-color: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text-muted);
}

.btn-secondary:hover {
    background-color: var(--color-row-hover);
    border-color: #999999;
    color: var(--color-text);
}

.btn-sm {
    padding: 5px 11px;
    font-size: 13px;
}

.btn-institution {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--color-accent);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-sm);
}

.btn-institution:hover {
    background-color: var(--color-primary-hover);
    color: white;
}

/* --- Button link-state overrides --- */

/* Bare a.btn is the neutral outline: muted text, never white.
   Solid variants re-assert white below (later rules win the tie). */
a.btn,
a.btn:link,
a.btn:visited,
a.btn:active {
    color: var(--color-text-muted);
    text-decoration: none;
}

a.btn-primary,
a.btn-primary:link,
a.btn-primary:visited,
a.btn-primary:active,
a.btn-success,
a.btn-success:link,
a.btn-success:visited,
a.btn-success:active {
    color: white;
}

a.btn-danger,
a.btn-danger:link,
a.btn-danger:visited,
a.btn-danger:active {
    color: white;
}

a.btn-secondary,
a.btn-secondary:link,
a.btn-secondary:visited,
a.btn-secondary:active {
    color: var(--color-text-muted);
}

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

a.btn-institution,
a.btn-institution:link,
a.btn-institution:visited,
a.btn-institution:active {
    color: white;
}

a.back-link,
a.back-link:link,
a.back-link:visited {
    color: var(--color-primary);
}

a.back-link:hover {
    color: var(--color-primary-hover);
}

/* ==========================================================================
   11. User Info Blocks
   ========================================================================== */

.user-info {
    margin-bottom: 16px;
}

.user-info p {
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.user-info strong {
    color: var(--color-text);
}

.user-info-box {
    background-color: var(--color-row-alt);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    border: 1px solid var(--color-border);
}

.user-info-box p {
    margin: 4px 0;
    color: var(--color-text);
}

.user-info-box strong {
    color: var(--color-primary);
}

.user-info-select {
    background-color: var(--color-row-alt);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    border: 1px solid var(--color-border);
}

.user-info-select p {
    margin: 0;
    color: var(--color-text);
}

.user-info-select strong {
    color: var(--color-primary);
}

/* ==========================================================================
   12. Auth Links + Welcome Text (home page)
   ========================================================================== */

.auth-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.auth-links a,
.auth-links a:link,
.auth-links a:visited,
.auth-links a:active {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--color-primary);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.auth-links a:hover {
    background-color: var(--color-primary-hover);
    color: white;
    text-decoration: none;
}

.auth-links .logout-link,
.auth-links .logout-link:link,
.auth-links .logout-link:visited {
    background-color: var(--color-danger);
    color: white;
}

.auth-links .logout-link:hover {
    background-color: var(--color-danger-hover);
}

.welcome-text {
    color: var(--color-text-muted);
    margin-bottom: 14px;
}

/* --- Home page (authenticated): user strip + action tiles --- */

.home-user-strip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    background-color: var(--color-row-alt);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 20px;
}

.home-user-strip p {
    margin: 0;
}

.home-user-name {
    color: var(--color-text);
}

.home-user-name strong {
    color: var(--color-primary);
}

.home-user-meta {
    color: var(--color-text-muted);
    font-size: 13px;
}

.home-user-ente {
    text-align: right;
}

.home-user-ente strong {
    display: block;
    color: var(--color-primary);
}

.home-actions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 12px;
}

a.home-tile,
a.home-tile:link,
a.home-tile:visited,
a.home-tile:active {
    display: block;
    padding: 14px 16px;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    text-decoration: none;
}

a.home-tile:hover {
    border-color: var(--color-primary);
    background-color: var(--color-accent-light);
    text-decoration: none;
}

.home-tile-title {
    display: block;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 2px;
}

.home-tile-desc {
    display: block;
    font-size: 12.5px;
    color: var(--color-text-muted);
}

.home-footer-actions {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--color-border-light);
    text-align: right;
}

a.home-logout,
a.home-logout:link,
a.home-logout:visited,
a.home-logout:active {
    color: var(--color-danger);
    font-weight: 500;
    text-decoration: none;
}

a.home-logout:hover {
    color: var(--color-danger-hover);
    text-decoration: underline;
}

/* ==========================================================================
   13. Dashboard
   ========================================================================== */

.welcome-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-primary);
    color: var(--color-text);
    padding: 20px 28px;
    border-radius: var(--radius);
    margin-bottom: 22px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.welcome-section h2 {
    font-size: 1.4rem;
    margin-bottom: 6px;
    border-bottom: none;
    color: var(--color-primary);
    padding-bottom: 0;
    font-family: var(--font-heading);
}

.welcome-section p {
    color: var(--color-text-muted);
    margin-bottom: 0;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 18px;
}

.quick-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

/* Links here (bare or .btn .btn-primary) are navigation, not CTAs: they
   render as quiet outline tiles matching the home page. Solid buttons
   outside .quick-actions (form submits, header-actions) keep their fill. */
.quick-actions a,
.quick-actions a:link,
.quick-actions a:visited,
.quick-actions a:active {
    display: inline-block;
    /* 1px less than .btn's 10px 20px: the border keeps total size identical */
    padding: 9px 19px;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-primary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.quick-actions a:hover {
    background-color: var(--color-accent-light);
    border-color: var(--color-primary);
    color: var(--color-primary);
    text-decoration: none;
}

.quick-actions-intro {
    color: var(--color-text-muted);
    margin-bottom: 10px;
}

/* --- Dashboard "Azioni Rapide": vertical link list --- */

.action-list {
    display: flex;
    flex-direction: column;
}

.action-list a,
.action-list a:link,
.action-list a:visited,
.action-list a:active {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 10px;
    color: var(--color-text);
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
}

.action-list a:last-child {
    border-bottom: none;
}

.action-list a:hover {
    background-color: var(--color-accent-light);
    color: var(--color-primary);
    text-decoration: none;
}

.action-list .action-arrow {
    color: var(--color-text-light);
    font-size: 16px;
    line-height: 1;
}

.action-list a:hover .action-arrow {
    color: var(--color-primary);
}

/* ==========================================================================
   14. Info Rows
   ========================================================================== */

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border-light);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--color-text-muted);
    font-weight: 500;
}

.info-value {
    color: var(--color-text);
    font-weight: 600;
}

/* ==========================================================================
   15. Stats (dashboard)
   ========================================================================== */

.stat-card {
    text-align: center;
    padding: 20px;
}

.stat-number {
    font-size: 2.4rem;
    font-weight: 600;
    color: var(--color-primary);
}

.stat-label {
    color: var(--color-text-muted);
    margin-top: 6px;
    font-size: 13px;
}

/* ==========================================================================
   16. Badges
   ========================================================================== */

.user-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
}

.badge-user {
    background-color: var(--color-row-alt);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border-light);
}

.badge-staff {
    background-color: var(--color-accent-light);
    color: var(--color-primary);
    border: 1px solid #B7DCC5;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 11.5px;
    font-weight: 600;
}

.badge-success {
    background-color: #D4EDDA;
    color: #155724;
}

.badge-danger {
    background-color: #F8D7DA;
    color: #721C24;
}

/* --- Current Institution card (dashboard) --- */

.card-institution {
    margin-top: 14px;
    border-left: 3px solid var(--color-primary);
}

.card-institution-actions {
    margin-top: 10px;
}

.card-institution-compact {
    display: flex;
    align-items: baseline;
    gap: 14px;
    flex-wrap: wrap;
    padding: 12px 16px;
}

.institution-compact-label {
    color: var(--color-text-muted);
    font-size: 13px;
    font-weight: 500;
}

.institution-compact-name {
    color: var(--color-primary);
}

.institution-compact-code {
    color: var(--color-text-muted);
    font-size: 13px;
}

a.institution-compact-change,
a.institution-compact-change:link,
a.institution-compact-change:visited,
a.institution-compact-change:active {
    margin-left: auto;
    color: var(--color-primary);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

a.institution-compact-change:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

/* ==========================================================================
   17. Tables — tinted header
   ========================================================================== */

thead tr {
    background-color: var(--color-accent-light);
    color: var(--color-primary);
    border-bottom: 2px solid var(--color-primary);
}

thead a,
thead a:link,
thead a:visited,
thead a:active {
    color: var(--color-primary);
}

thead a:hover {
    color: var(--color-primary-hover);
}

th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 13.5px;
}

td {
    padding: 8px 14px;
    text-align: left;
}

tbody tr {
    border-bottom: 1px solid var(--color-border-light);
}

tbody tr:nth-child(even) {
    background-color: var(--color-row-alt);
}

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

.table-wrapper {
    overflow-x: auto;
}

.card table {
    margin-top: 10px;
}

/* --- Actions column --- */

.actions {
    display: flex;
    gap: 6px;
}

.actions form {
    display: inline;
}

/* ==========================================================================
   18. Pagination
   ========================================================================== */

.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 18px;
}

.pagination a,
.pagination a:link,
.pagination a:visited,
.pagination span {
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--color-text);
    font-size: 13.5px;
}

.pagination a:hover {
    background-color: var(--color-accent-light);
    color: var(--color-primary);
    border-color: var(--color-primary);
    text-decoration: none;
}

.pagination .current {
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    line-height: inherit;
    cursor: default;
}

/* ==========================================================================
   19. Header Actions + Back Link
   ========================================================================== */

.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

/* Header buttons render at one compact size whether or not templates add
   .btn-sm, so a row never mixes two button heights. */
.header-actions .btn {
    padding: 5px 11px;
    font-size: 13px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--color-primary);
    text-decoration: none;
    margin-bottom: 16px;
    font-size: 14px;
}

.back-link:hover {
    text-decoration: underline;
    color: var(--color-primary-hover);
}

/* ==========================================================================
   20. Grid Layout
   ========================================================================== */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 18px;
}

/* ==========================================================================
   21. Registration Pending
   ========================================================================== */

.email-icon {
    font-size: 3rem;
    margin-bottom: 14px;
}

.email-address {
    color: var(--color-primary);
    font-weight: 600;
}

/* ==========================================================================
   22. Checkbox Groups, Permissions, Action Lists
   ========================================================================== */

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--color-primary);
}

/* --- Permission header: label + bulk-action buttons side by side --- */

.permission-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.permission-header label {
    font-size: 15px;
    font-weight: 600;
}

.permission-header-actions {
    display: flex;
    gap: 8px;
}

/* --- Permission groups (user_add_action) --- */

.permission-group {
    margin-bottom: 16px;
    padding: 14px;
    background-color: var(--color-row-alt);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-light);
}

.permission-group h4 {
    color: var(--color-text);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
    font-weight: 600;
}

/* --- Action list partial --- */

.action-list-controller {
    margin-bottom: 10px;
}

.action-list-controller strong {
    color: var(--color-text);
    /* Flex row keeps the select-all toggle beside the group name
       (the global label rule would otherwise push it to its own line). */
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--color-border-light);
    font-size: 14.5px;
}

.action-list-controller strong label {
    display: inline;
    margin: 0;
    font-weight: 600;
    cursor: pointer;
}

.action-list-controller .group-toggle {
    width: 19px;
    height: 19px;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.action-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 6px;
}

.action-list-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-list-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--color-primary);
}

.action-list-item label {
    font-size: 13.5px;
    color: var(--color-text-muted);
}

.action-list-empty {
    color: var(--color-text-light);
    text-align: center;
}

/* --- Scrollable action list (user_add_institution) --- */

.action-list-scroll {
    margin-top: 12px;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    padding: 14px;
    border-radius: var(--radius-sm);
}

.action-list-placeholder {
    color: var(--color-text-light);
}

/* ==========================================================================
   23. Empty States + Detail Actions
   ========================================================================== */

.empty-state {
    color: var(--color-text-light);
    text-align: center;
    padding: 28px;
}

.empty-state-error {
    text-align: center;
    color: var(--color-danger);
    padding: 18px;
}

.detail-actions {
    margin-top: 18px;
    display: flex;
    gap: 8px;
}

/* ==========================================================================
   24. Page Actions Toolbar (top-right export/action buttons)
   Mirrors PHP default.ctp #link-stampa pattern
   ========================================================================== */

.page-actions-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    padding: 8px 0;
    margin-bottom: 4px;
}

.page-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 12px;
    font-family: var(--font-body);
    transition: background-color 0.1s, border-color 0.1s;
}

.page-action-btn:hover {
    background: var(--color-row-hover);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.page-action-btn svg {
    flex-shrink: 0;
}

/* --- Page Action Modals --- */

.page-action-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

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

.page-action-modal {
    background: var(--color-surface);
    border-radius: var(--radius);
    width: 480px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.page-action-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--color-border-light);
}

.page-action-modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--color-text);
}

.page-action-modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--color-text-light);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.page-action-modal-close:hover {
    color: var(--color-danger);
}

.page-action-modal-body {
    padding: 18px;
    overflow-y: auto;
    flex: 1;
    color: var(--color-text-muted);
    font-size: 14px;
}

.page-action-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid var(--color-border-light);
}

/* ==========================================================================
   Maintenance banner — site-wide notice below the navbar
   (announcements app; see templates/includes/_maintenance_banner.html)
   ========================================================================== */

.maintenance-banner {
    padding: 10px 20px;
    font-size: 14px;
    text-align: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}

.maintenance-banner strong {
    font-weight: 600;
}

.maintenance-banner--info {
    background-color: var(--color-accent-light);
    color: var(--color-primary);
}

.maintenance-banner--warning {
    background-color: #FFF3CD;
    color: #664D03;
    border-bottom-color: #FFDA6A;
}

.maintenance-banner--danger {
    background-color: var(--color-danger);
    color: white;
}
