:root {
    --app-bg: #eff4f8;
    --app-bg-accent: #dfeef0;
    --surface: rgba(255, 255, 255, 0.9);
    --surface-strong: #ffffff;
    --surface-soft: #f6fafb;
    --text-main: #16202b;
    --text-muted: #5f6d7b;
    --line: rgba(21, 35, 48, 0.1);
    --brand: #0f766e;
    --brand-strong: #115e59;
    --brand-soft: rgba(15, 118, 110, 0.12);
    --accent: #d97706;
    --accent-soft: rgba(217, 119, 6, 0.12);
    --danger-soft: rgba(220, 38, 38, 0.12);
    --success-soft: rgba(22, 163, 74, 0.12);
    --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.08);
    --shadow-sm: 0 10px 30px rgba(15, 23, 42, 0.06);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

html {
    font-size: 15px;
    min-height: 100%;
}

body.app-body {
    min-height: 100vh;
    margin: 0;
    color: var(--text-main);
    font-family: "Segoe UI Variable Text", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.14), transparent 34%),
        radial-gradient(circle at top right, rgba(217, 119, 6, 0.12), transparent 28%),
        linear-gradient(180deg, var(--app-bg-accent) 0%, var(--app-bg) 18%, #f7fafc 100%);
}

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

a:hover {
    color: var(--brand);
}

.container-xxl {
    max-width: 1320px;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    padding: 1rem 0 0;
}

.app-topbar .navbar {
    margin: 0 1rem;
    border: 1px solid rgba(255, 255, 255, 0.58);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-lg);
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding-right: 1.25rem;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #fff;
    background: linear-gradient(135deg, var(--brand) 0%, #0b4f63 100%);
    box-shadow: 0 14px 24px rgba(15, 118, 110, 0.28);
}

.brand-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
}

.brand-copy strong {
    font-size: 1.05rem;
    font-weight: 800;
    color: #123040;
}

.brand-copy small {
    margin-top: 0.22rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.app-toggler {
    border: 1px solid var(--line);
    border-radius: 12px;
}

.app-nav {
    gap: 0.35rem;
}

.app-nav .nav-link {
    margin: 0 0.1rem;
    padding: 0.8rem 1rem;
    border-radius: 14px;
    color: #334155;
    font-weight: 600;
    transition: all 0.2s ease;
}

.app-nav .nav-link:hover,
.app-nav .nav-link:focus {
    color: var(--brand-strong);
    background: var(--brand-soft);
}

.app-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-shell {
    padding: 2rem 1rem 3rem;
}

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

.page-header h1,
.page-header h2 {
    margin: 0;
    font-size: clamp(1.7rem, 2vw, 2.35rem);
    font-weight: 800;
    letter-spacing: -0.03em;
}

.page-header p {
    margin: 0.55rem 0 0;
    color: var(--text-muted);
    max-width: 760px;
    line-height: 1.6;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.hero-panel,
.surface-card,
.data-card,
.form-panel,
.help-card,
.stat-card {
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
}

.hero-panel {
    position: relative;
    overflow: hidden;
    padding: 2rem;
    margin-bottom: 1.75rem;
}

.hero-panel::after {
    content: "";
    position: absolute;
    inset: auto -80px -80px auto;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(217, 119, 6, 0.16) 0%, transparent 70%);
}

.hero-panel__kicker {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.8rem;
    margin-bottom: 1rem;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-size: 0.83rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hero-panel h1 {
    margin-bottom: 0.8rem;
    font-size: clamp(2rem, 2.8vw, 3rem);
    font-weight: 900;
    letter-spacing: -0.04em;
}

.hero-panel p {
    max-width: 780px;
    margin: 0;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.75;
}

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

.stat-card {
    padding: 1.2rem 1.25rem;
}

.stat-card__label {
    color: var(--text-muted);
    font-size: 0.86rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card__value {
    margin-top: 0.65rem;
    font-size: 2rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.04em;
}

.stat-card__hint {
    margin-top: 0.7rem;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.surface-card,
.data-card,
.form-panel,
.help-card {
    padding: 1.5rem;
}

.surface-card__title,
.data-card__title,
.form-panel__title,
.help-card__title {
    margin: 0 0 0.4rem;
    font-size: 1.15rem;
    font-weight: 800;
}

.surface-card__subtitle,
.data-card__subtitle,
.form-panel__subtitle,
.help-card__subtitle {
    margin: 0 0 1.2rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.stack-lg > * + * {
    margin-top: 1.5rem;
}

.form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.95fr);
    gap: 1.25rem;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.field-grid .field-span-2 {
    grid-column: 1 / -1;
}

.form-label {
    margin-bottom: 0.45rem;
    font-weight: 700;
    color: #1f2f3f;
}

.form-control,
.form-select {
    min-height: 50px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-main);
    box-shadow: none;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: rgba(15, 118, 110, 0.45);
    box-shadow: 0 0 0 0.25rem rgba(15, 118, 110, 0.12);
}

.form-check-input:checked {
    background-color: var(--brand);
    border-color: var(--brand);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.btn-app {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0.8rem 1.15rem;
    border-radius: 14px;
    font-weight: 700;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.btn-app:hover {
    transform: translateY(-1px);
}

.btn-app-primary,
.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--brand) 0%, #0b4f63 100%);
    border: 0;
    box-shadow: 0 14px 26px rgba(15, 118, 110, 0.22);
}

.btn-app-primary:hover,
.btn-primary:hover {
    color: #fff;
    background: linear-gradient(135deg, var(--brand-strong) 0%, #0a4657 100%);
}

.btn-app-secondary,
.btn-outline-secondary,
.btn-outline-primary {
    border: 1px solid var(--line);
    color: #254056;
    background: rgba(255, 255, 255, 0.74);
}

.btn-outline-secondary:hover,
.btn-outline-primary:hover,
.btn-app-secondary:hover {
    color: var(--brand-strong);
    border-color: rgba(15, 118, 110, 0.28);
    background: var(--brand-soft);
}

.btn-success {
    border: 0;
    background: linear-gradient(135deg, #15803d 0%, #166534 100%);
    box-shadow: 0 14px 26px rgba(21, 128, 61, 0.2);
}

.btn-danger {
    border: 0;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 14px 26px rgba(220, 38, 38, 0.18);
}

.copy-btn {
    min-width: 92px;
}

.table-shell {
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.7);
}

.table {
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    padding: 1rem 0.9rem;
    border-bottom-color: rgba(15, 23, 42, 0.08);
    vertical-align: middle;
}

.table > thead {
    background: rgba(15, 118, 110, 0.08);
}

.table > thead th {
    color: #234255;
    font-size: 0.84rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(246, 250, 251, 0.66);
}

.table-hover tbody tr:hover > * {
    background-color: rgba(15, 118, 110, 0.05);
}

.program-pill,
.status-pill,
.soft-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.42rem 0.7rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.program-pill {
    background: rgba(15, 118, 110, 0.12);
    color: var(--brand-strong);
}

.status-pill--success {
    background: var(--success-soft);
    color: #166534;
}

.status-pill--danger {
    background: var(--danger-soft);
    color: #b91c1c;
}

.status-pill--warning {
    background: var(--accent-soft);
    color: #b45309;
}

.muted-note,
.form-text {
    color: var(--text-muted);
    line-height: 1.55;
}

.alert {
    border: 0;
    border-radius: 18px;
    box-shadow: var(--shadow-sm);
}

.alert-info {
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.12) 0%, rgba(255, 255, 255, 0.82) 100%);
    color: #174c54;
}

.alert-soft {
    padding: 1rem 1.1rem;
    border-radius: 16px;
    background: rgba(15, 118, 110, 0.08);
    color: #1f4a55;
}

.license-table-wrap,
.customer-license-modal-body {
    overflow-x: auto;
}

.hardware-id-cell {
    min-width: 260px;
    max-width: 420px;
    word-break: break-word;
    white-space: normal;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.9rem;
}

.license-key-input,
.font-monospace {
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.9rem;
}

.customer-license-history-table {
    table-layout: fixed;
    width: 100%;
}

.program-name-cell {
    min-width: 160px;
    white-space: normal;
}

.customer-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 700;
}

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

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

.quick-link {
    display: block;
    height: 100%;
    padding: 1.25rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 18px;
    color: inherit;
    background: rgba(255, 255, 255, 0.72);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.quick-link:hover {
    color: inherit;
    transform: translateY(-2px);
    border-color: rgba(15, 118, 110, 0.22);
    box-shadow: var(--shadow-sm);
}

.quick-link strong {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 1rem;
}

.quick-link span {
    color: var(--text-muted);
    line-height: 1.6;
}

.modal-content {
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom-color: rgba(15, 23, 42, 0.08);
}

.modal-footer,
.app-footer {
    border-top-color: rgba(15, 23, 42, 0.08);
}

.app-footer {
    padding: 0 1rem 1.6rem;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    color: var(--text-muted);
    font-size: 0.92rem;
}

@media (max-width: 991.98px) {
    .app-topbar .navbar {
        margin: 0 0.75rem;
    }

    .page-shell {
        padding: 1.4rem 0.75rem 2.25rem;
    }

    .form-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767.98px) {
    html {
        font-size: 14px;
    }

    .field-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .page-actions,
    .form-actions,
    .app-header-actions {
        width: 100%;
    }

    .page-actions > *,
    .form-actions > *,
    .app-header-actions > * {
        flex: 1 1 auto;
    }

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}
