/* Auth split-screen layout --------------------------------------------- */

/* Pico v2 adds padding-block to <main>; kill it so the two panels reach the
   viewport edges (this is what made the columns look short). */
main.auth-shell {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    min-height: 100dvh;
    padding: 0;
}

.auth-brand {
    display: flex;
    margin: 0;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
    padding: 3rem;
    color: #fff;
    background:
        radial-gradient(1100px 500px at 85% -10%, rgba(255, 255, 255, 0.1), transparent 60%),
        linear-gradient(135deg, #1d2440 0%, #323b6e 55%, #46508f 100%);
}

.auth-brand .brand-mark {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
}

.auth-brand h1 {
    margin: 0;
    color: #fff;
    font-size: 2.2rem;
}

.auth-brand p {
    margin: 0;
    max-width: 26rem;
    color: rgba(255, 255, 255, 0.75);
}

.auth-form {
    /* Indigo primary, matching the brand panel (like the Pico login example). */
    --pico-primary: #3b4790;
    --pico-primary-hover: #2c356b;
    --pico-primary-background: #3b4790;
    --pico-primary-border: #3b4790;
    --pico-primary-underline: rgba(59, 71, 144, 0.5);
    --pico-primary-focus: color-mix(in srgb, #3b4790 30%, transparent);

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 21rem;
}

.auth-card .auth-flash {
    margin: 0 0 1rem;
    padding: 0.6rem 0.8rem;
    border: 1px solid rgba(192, 57, 43, 0.4);
    border-radius: var(--pico-border-radius);
    background: rgba(192, 57, 43, 0.08);
    color: #c0392b;
    font-size: 0.9rem;
}

.auth-card hgroup {
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    main.auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-brand {
        align-items: center;
        padding: 2rem 1rem 1.5rem;
        text-align: center;
    }

    .auth-brand h1 {
        font-size: 1.5rem;
    }

    .auth-brand p {
        display: none;
    }

    .auth-form {
        align-items: flex-start;
        padding: 1.5rem 1rem;
    }
}

/* App shell header ------------------------------------------------------ */

.app-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--pico-background-color);
    border-bottom: 1px solid var(--pico-muted-border-color);
}

.app-header nav details.dropdown {
  display: inline-block;
}

.app-header nav ul li form {
    display: block;
    width: 100%;
    margin: 0;
}

.app-header nav ul li span {
    white-space: nowrap;
}

.app-header nav a[href] {
    text-decoration: none;
}

.app-header nav ul li button.nav-link {
    margin: 0;
    padding: 0;
    height: auto;
    min-height: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    outline: none;
    color: var(--pico-primary);
    font-size: inherit;
    line-height: inherit;
}

.app-header nav ul li button.nav-link:hover,
.app-header nav ul li button.nav-link:focus {
    border: 0;
    background: none;
    box-shadow: none;
    color: var(--pico-primary-hover);
}

.app-header nav ul li button.nav-link.danger {
    color: #c0392b;
}

.app-header nav ul li button.nav-link.danger:hover,
.app-header nav ul li button.nav-link.danger:focus {
    color: #a93226;
}

.app-header nav a.current,
.app-header nav a.current:hover {
    color: var(--pico-primary);
    font-weight: 600;
}

/* Account dropdown (Pico details.dropdown) -------------------------------- */

.app-header details.dropdown {
    margin: 0;
}

.app-header details.dropdown > summary {
    list-style: none;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    outline: none;
    color: var(--pico-primary);
    font-size: inherit;
    line-height: inherit;
    white-space: nowrap;
    cursor: pointer;
}

.app-header details.dropdown > summary::-webkit-details-marker {
    display: none;
}

.app-header details.dropdown > summary::after {
    content: "▾";
    display: inline;
    float: none;
    width: auto;
    height: auto;
    margin-left: 0.35rem;
    font-size: 0.7em;
    color: var(--pico-muted-color);
}

.app-header details.dropdown > summary:hover,
.app-header details.dropdown > summary:focus,
.app-header details.dropdown[open] > summary {
    border: 0;
    background: none;
    box-shadow: none;
    color: var(--pico-primary-hover);
}

.app-header details.dropdown > summary + ul {
    right: 0;
    left: auto;
    margin-top: 0.5rem;
    min-width: 11rem;
}

/* Page headers ----------------------------------------------------------- */

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

.page-head h1 {
    margin: 0;
}

/* KPI cards --------------------------------------------------------------- */

p.kpi {
    margin: 0.25rem 0 1rem;
    font-size: 2.4rem;
    font-weight: 600;
    line-height: 1.1;
    color: var(--pico-primary);
}

/* Tables ------------------------------------------------------------------ */

#quotation-items td {
    vertical-align: middle;
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    white-space: nowrap;
}

.row-actions-table {
    display: table-cell;
    align-items: center;
    gap: 0.75rem;
    white-space: nowrap;
}

.row-actions .action,
.row-actions .action:hover,
.row-actions .action:focus,
.row-actions-table .action,
.row-actions-table .action:hover,
.row-actions-table .action:focus {
    margin: 0;
    padding: 0;
    height: auto;
    min-height: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    outline: none;
    color: var(--pico-primary);
    font-size: inherit;
    line-height: inherit;
    text-decoration: none;
    cursor: pointer;
}

.row-actions .action:hover,
.row-actions .action:focus,
.row-actions-table .action:hover,
.row-actions-table .action:focus {
    color: var(--pico-primary-hover);
}

.row-actions .action.danger,
.row-actions .action.danger:hover,
.row-actions .action.danger:focus,
.row-actions-table .action.danger,
.row-actions-table .action.danger:hover,
.row-actions-table .action.danger:focus {
    color: #c0392b;
}

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

.pagination .page-info {
    color: var(--pico-muted-color);
}

/* Quotation detail -------------------------------------------------------- */

dl.meta {
    display: grid;
    gap: 0.25rem 2rem;
}

dl.meta div {
    display: grid;
    grid-template-columns: 10rem 1fr;
}

dl.meta dt {
    color: var(--pico-muted-color);
}

.inline-form {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    margin-top: 1rem;
}

.inline-form label {
    margin-bottom: 0;
}

.item-form {
    margin-top: 1rem;
}

/* HTMX loading ------------------------------------------------------------ */

.htmx-request {
    opacity: 0.6;
    transition: opacity 0.2s;
}

.htmx-indicator {
    display: none;
    color: var(--pico-muted-color);
}

.htmx-request .htmx-indicator {
    display: inline;
}

.htmx-request.htmx-indicator {
    display: inline;
}

/* Quotation parties (issuer vs customer) ---------------------------------- */

.quote-parties {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.quote-parties h2 {
    margin-bottom: 0.5rem;
}
