:root {
    --color-primary: #1f4e5f;
    --color-primary-dark: #163946;

    --color-secondary: #6c757d;
    --color-secondary-dark: #565e64;

    --color-success: #2e7d32;
    --color-success-dark: #1b5e20;

    --color-warning: #f0ad4e;
    --color-warning-dark: #d99632;

    --color-danger: #b00020;
    --color-danger-dark: #8a0019;

    --color-info: #0d6efd;
    --color-info-dark: #0a58ca;

    --color-purple: #6f42c1;
    --color-purple-dark: #59359a;

    --color-teal: #00897b;
    --color-teal-dark: #00695c;

    --color-orange: #fd7e14;
    --color-orange-dark: #dc6502;

    --color-light: #f7f7f7;
    --color-border: #dddddd;
    --color-text: #222222;
    --color-muted: #666666;
    --color-white: #ffffff;

    --page-max-width: 1200px;
    --border-radius: 5px;
}

/* Base page layout */

body {
    font-family: Arial, sans-serif;
    margin: 30px;
    color: var(--color-text);
    background: var(--color-white);
}

.page-wrap {
    max-width: var(--page-max-width);
    margin: 0 auto;
}

h1,
h2,
h3 {
    color: var(--color-text);
}

a {
    color: var(--color-info);
}

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

.sam-page-header {
    margin-bottom: 22px;
    padding-bottom: 12px;
    border-bottom: 3px solid #fbbf24;
}

.sam-header-row {
    width: 100%;
}

.sam-logo-wrap {
    display: flex;
    align-items: center;
}

.sam-logo {
    height: 166px;
    width: auto;
    display: block;
}

.sam-logo-row {
    text-align: center;
    padding: 12px 0 6px;
}

.sam-main-logo {
    height: 42px;
    width: auto;
    display: inline-block;
}

.sam-title-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-top: 4px;
}

.sam-page-title {
    text-align: center;
}

.sam-page-title h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
}

.sam-business-logo-box {
    text-align: right;
    padding-right: 12px;
}

.sam-business-logo-small {
    max-height: 30px;
    max-width: 120px;
    object-fit: contain;
}

.sam-action-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
}

.sam-action-left,
.sam-action-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.signed-in-user {
    font-size: 13px;
    color: #374151;
}

@media (max-width: 700px) {
    .sam-main-logo {
        height: 70px;
    }

    .sam-title-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .sam-title-spacer {
        display: none;
    }

    .sam-business-logo-box {
        text-align: center;
        padding-right: 0;
    }

    .sam-action-row {
        flex-direction: column;
        align-items: stretch;
    }

    .sam-action-left,
    .sam-action-right {
        justify-content: center;
        flex-wrap: wrap;
    }
}

.business-logo {
    height: 42px;
    max-width: 120px;
    object-fit: contain;
}

.business-name {
    font-size: 18px;
    font-weight: 700;
}

.business-subtitle {
    font-size: 12px;
    color: #d1d5db;
}

.app-header {
    margin-bottom: 20px;
}

.app-header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    background: #0f172a;
    border-bottom: 4px solid #fbbf24;
    padding: 14px 20px;
    border-radius: 0 0 12px 12px;
}


.app-header-user-area {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    color: #ffffff;
}

.business-logo-small {
    max-height: 34px;
    max-width: 150px;
    object-fit: contain;
    background: #ffffff;
    padding: 4px 8px;
    border-radius: 8px;
}

.app-header-user-area .signed-in-user {
    font-size: 13px;
    color: #e5e7eb;
}

.app-header-user-area .signed-in-user strong {
    color: #ffffff;
}


/* Logo / header */

.logo-header {
    width: 100%;
    text-align: center;
    margin: 0 auto 5px auto;
}

.logo-header img {
    display: block;
    margin: 0 auto;
    max-width: 520px;
    width: 100%;
    height: auto;
}

.logo-header img.sam-logo {
    width: 620px;
    max-width: 90%;
    height: auto;
}

.logo-header .business-name {
    margin-top: 8px;
    font-size: 22px;
    font-weight: bold;
    text-align: center;
}

.page-heading {
    text-align: center;
}

/* Buttons */

.button,
button,
input[type="submit"] {
    display: inline-block;
    padding: 8px 12px;
    border: 0;
    border-radius: var(--border-radius);
    text-decoration: none;
    cursor: pointer;
    font-family: Arial, sans-serif;
    font-size: 14px;
    line-height: 1.2;
    background: var(--color-primary);
    color: var(--color-white);
    margin-right: 8px;
    margin-top: 8px;
}

.button:hover,
button:hover,
input[type="submit"]:hover {
    background: var(--color-primary-dark);
}

.button.primary {
    background: var(--color-primary);
}

.button.primary:hover {
    background: var(--color-primary-dark);
}

.button.secondary {
    background: var(--color-secondary);
}

.button.secondary:hover {
    background: var(--color-secondary-dark);
}

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

.button.success:hover {
    background: var(--color-success-dark);
}

.button.warning {
    background: var(--color-warning);
    color: #222;
}

.button.warning:hover {
    background: var(--color-warning-dark);
    color: #222;
}

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

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

.button.info {
    background: var(--color-info);
}

.button.info:hover {
    background: var(--color-info-dark);
}

.button.purple {
    background: var(--color-purple);
}

.button.purple:hover {
    background: var(--color-purple-dark);
}

.button.teal {
    background: var(--color-teal);
}

.button.teal:hover {
    background: var(--color-teal-dark);
}

.button.orange {
    background: var(--color-orange);
    color: #222;
}

.button.orange:hover {
    background: var(--color-orange-dark);
    color: #222;
}

/* Forms */

label {
    display: block;
    margin-top: 5px;
    font-weight: bold;
    margin-bottom: 5px;
}

input,
textarea,
select {
    width: 100%;
    min-height: 36px;
    padding: 8px;
    box-sizing: border-box;
    margin-top: 5px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    font-family: Arial, sans-serif;
    font-size: 14px;
    line-height: 1.2;
}

select {
    height: 36px;
}

textarea {
    min-height: 60px;
}

/* Tables */

table {
    border-collapse: collapse;
    width: 100%;
    margin-top: 20px;
}

th,
td {
    border-bottom: 1px solid var(--color-border);
    padding: 10px;
    text-align: left;
    vertical-align: top;
}

.num {
    text-align: right;
    white-space: nowrap;
}

th {
    background: #f3f3f3;
}

.num {
    text-align: right;
    white-space: nowrap;
}

.nowrap {
    white-space: nowrap;
}

/* Panels / alerts */

.panel {
    border: 1px solid var(--color-border);
    background: #fafafa;
    padding: 15px;
    margin-top: 20px;
    border-radius: var(--border-radius);
}

.errors {
    background: #ffe5e5;
    border: 1px solid #cc9999;
    padding: 10px;
    margin-top: 15px;
    border-radius: var(--border-radius);
}

.success-message {
    background: #e5ffe8;
    border: 1px solid #99cc99;
    padding: 10px;
    margin-top: 15px;
    border-radius: var(--border-radius);
}

.warning-message {
    background: #fff8df;
    border: 1px solid #e1c766;
    padding: 12px;
    margin-top: 15px;
    border-radius: var(--border-radius);
}

/* Summary cards */

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.summary-card {
    border: 1px solid var(--color-border);
    background: var(--color-white);
    padding: 12px;
    border-radius: var(--border-radius);
    text-align: center;
}

.summary-card .label {
    color: var(--color-muted);
    font-size: 13px;
    text-align: center;
}

.summary-card .value {
    font-size: 20px;
    font-weight: bold;
    margin-top: 5px;
    text-align: center;
}

.summary-card .muted {
    text-align: center;
}

.summary-card.total {
    background: #eef8ee;
    border-color: #b7d8b7;
}

.heading-value {
    color: var(--color-info);
}

.page-title-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-bottom: 20px;
    width: 100%;
}

.title-left {
    text-align: left;
}

.title-center {
    text-align: center;
}

.title-center h1 {
    margin: 0;
}

.title-right {
    text-align: right;
}

.app-title-row {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 10px;
    position: relative;
}

.app-title-left {
    width: 200px;
    text-align: left;
}

.app-title-main {
    flex: 1;
    text-align: center;
}

.app-title-main h1 {
    margin: 0;
}

.app-title-right {
    width: 200px;
}

.summary {
    width: 360px;
    margin-left: auto;
    margin-top: 25px;
    border: 1px solid #ddd;
    background: #fafafa;
    padding: 15px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
}

.summary-row.total {
    border-top: 2px solid #333;
    margin-top: 8px;
    padding-top: 10px;
    font-weight: bold;
    font-size: 1.1em;
}


.ai-loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.88);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.ai-loading-overlay.active {
    display: flex;
}

.ai-loading-box {
    width: min(420px, 90%);
    padding: 28px;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.ai-loading-box h2 {
    margin-top: 15px;
    margin-bottom: 8px;
}

.ai-loading-box p {
    margin: 8px 0;
}

.ai-spinner {
    width: 46px;
    height: 46px;
    margin: 0 auto;
    border: 5px solid #dddddd;
    border-top-color: var(--color-info);
    border-radius: 50%;
    animation: ai-spin 0.9s linear infinite;
}

@keyframes ai-spin {
    to {
        transform: rotate(360deg);
    }
}

.logo-header-home {
    text-align: center;
    margin-bottom: 15px;
}

.logo-header-home a {
    display: inline-block;
}

.logo-header-home img {
    max-width: 420px;
    max-height: 340px;
    height: auto;
    cursor: pointer;
}


.shared-page-title h1 {
    margin: 0;
}

.shared-action-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    width: 100%;
    margin-bottom: 18px;
}

.shared-action-left,
.shared-action-right {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.shared-action-right {
    margin-left: auto;
    justify-content: right;
}

.shared-action-row .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    margin-top: 0;
    margin-bottom: 0;
    white-space: nowrap;
}

.signed-in-user {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    line-height: 1.2;
}

@media (max-width: 850px) {
    .shared-action-row {
        flex-wrap: wrap;
    }

    .shared-action-left,
    .shared-action-right {
        width: 100%;
    }

    .shared-action-left {
        justify-content: flex-start;
    }

    .shared-action-right {
        justify-content: flex-end;
        margin-left: 0;
    }
}



.shared-page-title {
    text-align: center;
    margin-bottom: 1px;
}

.shared-action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--color-border);
    padding: 0 0 16px 0;
}

/* SAM workflow top band */

.sam-workflow-band {
    width: calc(100% + 60px);
    margin: -30px -30px 18px -30px;
    background: #050505;
    color: #ffffff;
    border-bottom: 3px solid #f5a400;
    padding: 12px 18px 10px;
    display: flex;
    justify-content: center;
    gap: 18px;
    overflow-x: auto;
    white-space: nowrap;
    box-sizing: border-box;
}

.sam-workflow-button {
    display: inline-flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: transparent !important;
    border: 0 !important;
    color: #ffffff !important;
    box-shadow: none !important;
    cursor: pointer;
    text-align: center;
    min-width: 82px;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: inherit;
    line-height: normal;
}

.sam-workflow-button:hover {
    background: transparent !important;
}

.sam-workflow-circle {
    position: relative;
    display: inline-flex;
    width: 54px;
    height: 54px;
    border: 1px solid #777;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    background: #111;
}

.sam-workflow-button:hover .sam-workflow-circle {
    border-color: #f5a400;
    box-shadow: 0 0 14px rgba(245, 164, 0, 0.8);
}

.sam-workflow-icon {
    font-size: 26px;
}

.sam-workflow-no {
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: #f5a400;
    color: #111;
    font-size: 11px;
    font-weight: bold;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sam-workflow-title {
    display: block;
    margin-top: 15px;
    font-size: 12px;
    font-weight: bold;
    color: #ffffff;
}

/* SAM workflow modal */

#samWorkflowModal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.72);
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

#samWorkflowModal.active {
    display: flex;
}

#samWorkflowModal .sam-workflow-modal-card {
    position: relative;
    width: min(760px, 92vw);
    max-height: 88vh;
    overflow-y: auto;
    background: #070707;
    color: #ffffff;
    border: 1px solid #f5a400;
    border-radius: 10px;
    padding: 28px 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65);
}

#samWorkflowModal .sam-workflow-close {
    position: absolute;
    top: 10px;
    right: 14px;
    width: auto !important;
    background: transparent !important;
    border: 0 !important;
    color: #ffffff !important;
    font-size: 30px !important;
    padding: 0 !important;
    margin: 0 !important;
    cursor: pointer;
}

.sam-workflow-modal-head {
    display: flex;
    gap: 24px;
    align-items: center;
    border-bottom: 1px solid #f5a400;
    padding-bottom: 18px;
    margin-bottom: 18px;
}

.sam-modal-icon-wrap {
    position: relative;
    width: 104px;
    height: 104px;
    border: 3px solid #f5a400;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 18px rgba(245, 164, 0, 0.75);
    flex: 0 0 auto;
}

#samModalIcon {
    font-size: 50px;
}

#samModalNo {
    position: absolute;
    bottom: -14px;
    background: #f5a400;
    color: #111;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

#samWorkflowModal h2 {
    color: #ffffff;
    margin: 0 0 4px;
    font-size: 30px;
}

#samWorkflowModal h3 {
    color: #f5a400;
    margin: 0 0 12px;
    font-size: 17px;
}

#samWorkflowModal p {
    color: #e5e5e5;
}

.sam-modal-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 34px;
}

.sam-modal-columns h4 {
    color: #f5a400;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.sam-modal-columns ul {
    margin: 0;
    padding-left: 20px;
}

.sam-modal-columns li {
    margin-bottom: 9px;
    line-height: 1.35;
    color: #ffffff;
}

.sam-modal-footer {
    margin-top: 24px;
    border: 1px solid #f5a400;
    border-radius: 8px;
    padding: 14px 18px;
    color: #ffffff;
    background: rgba(245, 164, 0, 0.09);
}

.sam-modal-footer strong {
    color: #f5a400;
}

@media (max-width: 850px) {
    .sam-workflow-band {
        justify-content: flex-start;
    }

    .sam-modal-columns {
        grid-template-columns: 1fr;
    }

    .sam-workflow-modal-head {
        align-items: flex-start;
    }
}

/* restart of workflow */
.sam-top-band {
    background: #000;
    color: #f5a400;
    height: 60px;
    line-height: 60px;
    text-align: center;
    font-weight: bold;

    width: calc(100% + 60px);
    margin: -30px -30px 20px -30px;
}