* {
    box-sizing: border-box;
}

:root {
    --bg-main: #f5f7fb;
    --bg-sidebar: #111827;
    --bg-panel: #ffffff;
    --bg-soft: #f8fafc;
    --line: #e5e7eb;
    --text: #111827;
    --text-soft: #64748b;
    --brand: #588fc3;
    --brand-dark: #3f79b2;
    --title-accent: #fe8e04;
    --sidebar-text: #727d94;
    --success-bg: #ecfdf3;
    --success-line: #86efac;
    --error-bg: #fef2f2;
    --error-line: #fca5a5;
}

body {
    margin: 0;
    font-family: "Plus Jakarta Sans", "Segoe UI", Arial, sans-serif;
    background: #f6f7fb;
    color: var(--text);
    text-rendering: optimizeLegibility;
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 20% 20%, #dbeafe 0%, transparent 35%),
        radial-gradient(circle at 80% 10%, #e0e7ff 0%, transparent 30%),
        linear-gradient(145deg, #eff6ff 0%, #f8fafc 100%);
}

.login-shell {
    width: min(1080px, 94vw);
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: 1.2rem;
}

.login-card {
    width: 100%;
    max-width: 520px;
    background: #ffffff;
    border: 1px solid #e5e9f2;
    border-radius: 16px;
    padding: 2.1rem;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.09);
}

.login-brand-wrap {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.85rem;
}

.login-brand {
    display: inline-block;
    background: #eef3ff;
    color: #4361cb;
    font-weight: 700;
    font-size: 0.78rem;
    border-radius: 999px;
    padding: 0.36rem 0.72rem;
}

.login-badge {
    font-size: 0.72rem;
    color: #6b7792;
    background: #f8fafc;
    border: 1px solid #e5e9f2;
    border-radius: 999px;
    padding: 0.34rem 0.65rem;
}

.login-card h1 {
    margin: 0 0 0.45rem;
    font-size: 1.72rem;
    font-family: "Plus Jakarta Sans", sans-serif;
    letter-spacing: -0.02em;
    color: #1f2937;
}

.login-card p {
    margin: 0 0 1.2rem;
    color: #667085;
}

.input-wrap {
    position: relative;
}

.input-wrap i {
    position: absolute;
    left: 0.72rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.85rem;
}

.input-wrap input {
    padding-left: 2.2rem;
}

.login-submit {
    width: 100%;
    margin-top: 0.35rem;
}

.login-note {
    margin-top: 0.85rem;
    margin-bottom: 0;
    font-size: 0.76rem;
    color: #94a3b8;
    text-align: center;
}

.login-side {
    background: linear-gradient(150deg, #101a3b 0%, #243b82 50%, #314fb0 100%);
    color: #e2e8f0;
    border-radius: 16px;
    padding: 2.2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 0 22px 45px rgba(37, 60, 128, 0.35);
}

.login-side h2 {
    margin: 0 0 0.75rem;
    font-size: 1.62rem;
    font-family: "Plus Jakarta Sans", sans-serif;
    letter-spacing: -0.02em;
    color: #f8fbff;
}

.login-side p {
    margin: 0;
    color: #d9e3ff;
    line-height: 1.6;
}

.login-feature-list {
    margin: 1.2rem 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.62rem;
}

.login-feature-list li {
    display: flex;
    align-items: center;
    gap: 0.52rem;
    font-size: 0.87rem;
    color: #e8eeff;
}

.login-feature-list i {
    color: #86efac;
}

.portal-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 240px 1fr;
    transition: grid-template-columns 0.28s ease;
}

.portal-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
}

.portal-shell.sidebar-collapsed .sidebar {
    display: none;
}

.sidebar {
    background: #ffffff;
    color: #0f172a;
    padding: 1rem 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    border-right: 1px solid #ebeef5;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.2rem 0.5rem 0.6rem;
}

.brand-badge {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    background: linear-gradient(160deg, #5d87ff, #4570ea);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
}

.sidebar h2 {
    margin: 0;
    font-size: 1.35rem;
    color: #0f172a;
    font-family: "Plus Jakarta Sans", sans-serif;
}

.muted {
    color: var(--sidebar-text);
    margin-top: 0.15rem;
    font-size: 0.78rem;
}

.menu-title {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #9aa5b8;
    margin: 0.5rem 0.55rem 0.25rem;
}

.menu-list {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    margin-top: 0;
}

.menu-group {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.submenu {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    margin-left: 1rem;
    padding-left: 0.35rem;
    border-left: 1px dashed #d9e1ec;
}

.submenu a {
    font-size: 0.78rem;
    color: #6c7a91;
    padding-top: 0.46rem;
    padding-bottom: 0.46rem;
}

.submenu a.active {
    background: #f4f7ff;
    color: #3d63d2;
    border-color: #dce6ff;
}

.sidebar a {
    color: #5a6a85;
    text-decoration: none;
    padding: 0.62rem 0.72rem;
    border-radius: 7px;
    border: 1px solid transparent;
    transition: 0.2s ease;
    font-size: 0.82rem;
    font-weight: 500;
    position: relative;
    padding-left: 0.72rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.sidebar a.active,
.sidebar a:hover {
    background: #ecf2ff;
    color: #3556b8;
    border-color: #d9e5ff;
}

.menu-group.active > a {
    background: #ecf2ff;
    color: #3556b8;
    border-color: #d9e5ff;
}

.sidebar a.active {
    color: #3556b8;
}

.menu-ic {
    width: 16px;
    text-align: center;
    display: inline-block;
    font-size: 0.76rem;
}

.menu-ic i {
    font-size: 0.82rem;
}

.menu-count {
    margin-left: auto;
    min-width: 22px;
    height: 20px;
    border-radius: 999px;
    background: #e9eefc;
    color: #4b63c7;
    font-size: 0.72rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.4rem;
}

.sidebar a.active .menu-count,
.sidebar a:hover .menu-count {
    background: rgba(93, 135, 255, 0.2);
    color: #2f4fbe;
}

.logout-link {
    margin-top: auto;
    background: #f8fafc;
    border-color: #e5e7eb !important;
    color: #475569 !important;
}

.content {
    padding: 0;
}

.modal-open {
    overflow: hidden;
}

.app-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1.5rem;
}

.app-modal.show {
    display: flex;
}

.app-modal-dialog {
    width: min(1300px, 96vw);
    height: min(900px, 94vh);
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.3);
    position: relative;
    overflow: hidden;
    border: 1px solid #eef2f7;
}

@media (max-width: 1024px) {
    .app-modal-dialog {
        width: min(96vw, 1300px);
    }
}

.app-modal-close {
    position: absolute;
    right: 0.75rem;
    top: 0.75rem;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #334155;
    z-index: 2;
    cursor: pointer;
}

.se-rate-history-dialog {
    width: min(720px, 94vw);
    height: auto;
    max-height: min(560px, 86vh);
    overflow: auto;
    padding: 1rem 1.25rem 1.25rem;
}

.se-print-choice-dialog {
    width: min(420px, 94vw);
    height: auto;
    max-height: none;
    overflow: visible;
    padding: 1.25rem 1.35rem 1.35rem;
}

.se-print-choice-title {
    margin: 0 2.25rem 0.35rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #0f172a;
}

.se-print-choice-hint {
    margin: 0 0 1.15rem;
    font-size: 0.88rem;
    line-height: 1.45;
}

.se-print-choice-actions {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.se-print-choice-actions .btn-primary,
.se-print-choice-actions .btn-secondary {
    width: 100%;
    justify-content: center;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.se-rate-history-title {
    margin: 0 2.25rem 0.35rem;
    padding: 0 0.25rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: #0f172a;
    text-align: center;
}

.se-rate-history-subtitle {
    margin: 0 2.25rem 1rem;
    padding: 0 0.25rem;
    font-size: 0.85rem;
    line-height: 1.45;
    color: #64748b;
    text-align: center;
}

.se-rate-history-table-wrap {
    text-align: left;
}

.se-rate-history-table {
    font-size: 0.82rem;
}

.se-rate-history-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 10rem;
    margin: 0.25rem 0 0;
    padding: 2rem 1.5rem;
    border-radius: 12px;
    border: 1px solid #e8eef5;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.se-rate-history-empty[hidden] {
    display: none !important;
}

.se-rate-history-empty-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 24rem;
    width: 100%;
    margin: 0 auto;
    text-align: center;
}

.se-rate-history-empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    margin: 0 0 0.85rem;
    border-radius: 50%;
    background: #e2e8f0;
    color: #64748b;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.se-rate-history-empty-heading {
    margin: 0 0 0.4rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #334155;
    letter-spacing: 0.01em;
    width: 100%;
}

.se-rate-history-empty-text {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.5;
    color: #64748b;
    width: 100%;
}

.se-actions-col {
    width: 1%;
    white-space: nowrap;
}

.se-line-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    flex-wrap: nowrap;
}

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

.app-modal-frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: #ffffff;
}

.delete-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}

.delete-modal.show {
    display: flex;
}

.delete-modal-dialog {
    width: min(480px, 96vw);
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e7edf6;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
    padding: 1rem;
}

.delete-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.delete-modal-head h3 {
    margin: 0;
    font-size: 1.05rem;
    color: #1f2937;
}

.delete-modal-close {
    border: 1px solid #e2e8f0;
    background: #fff;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
}

.delete-modal-text {
    margin: 0.35rem 0 0.7rem;
    color: #64748b;
    font-size: 0.88rem;
}

.delete-modal-list {
    margin: 0;
    padding: 0;
    list-style: none;
    border: 1px solid #e8edf6;
    border-radius: 10px;
    overflow: hidden;
}

.delete-modal-list li {
    padding: 0.56rem 0.7rem;
    border-bottom: 1px solid #eef2f7;
    font-size: 0.86rem;
}

.delete-modal-list li:last-child {
    border-bottom: 0;
}

.delete-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

.danger-btn {
    background: linear-gradient(160deg, #dc2626, #b91c1c) !important;
}

.modal-embedded-page {
    background: #ffffff;
}

.modal-embedded-main {
    padding: 1.25rem;
    background: #ffffff;
    min-height: 100vh;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
    padding: 0.7rem 1.25rem;
    border-bottom: 1px solid #ebeef5;
    background: #fff;
}

.topbar-left { display: flex; align-items: center; gap: 0.55rem; }
.topbar-search {
    background: #f4f6fb;
    border: 1px solid #e9edf5;
    border-radius: 7px;
    min-width: 220px;
    color: #8a97aa;
    font-size: 0.82rem;
    padding: 0.47rem 0.72rem;
}
.topbar-icon {
    border: 1px solid #e9edf5;
    background: #fff;
    width: 32px;
    height: 32px;
    border-radius: 7px;
    font-size: 0.85rem;
    color: #6b778c;
    cursor: pointer;
}

.topbar-icon.sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.portal-shell.sidebar-collapsed .topbar-icon.sidebar-toggle {
    background: #ecf2ff;
    border-color: #d9e5ff;
    color: #3556b8;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.topbar-btn {
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
}

.topbar-user {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 0.42rem 0.75rem;
    font-size: 0.82rem;
    color: #334155;
}

.content-card {
    background: var(--bg-panel);
    border: 0;
    border-radius: 0;
    padding: 1.25rem;
    box-shadow: none;
}

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

.header-row h1 {
    margin: 0;
    font-size: 1.55rem;
    font-family: "Plus Jakarta Sans", sans-serif;
    color: #2a3547;
    letter-spacing: -0.01em;
}

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

.hero-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.hero-card {
    border-radius: 8px;
    padding: 1.2rem;
    background: #ecf2ff;
    border: 1px solid #dbe7ff;
}

.hero-card h3 {
    margin: 0 0 0.45rem;
    color: #235b8f;
}

.hero-card p {
    margin: 0 0 0.8rem;
    color: #475569;
}

.overview-card {
    border-radius: 8px;
    border: 1px solid #e8edf6;
    background: #fff;
    padding: 1rem;
}

.modernize-grid { grid-template-columns: 2.2fr 1fr; }
.mini-kpi-wrap { display: grid; gap: 1rem; }
.mini-kpi {
    background: #fff;
    border: 1px solid #ebeef5;
    border-radius: 8px;
    padding: 1rem;
}
.mini-kpi h4 { margin: 0; font-size: 1.35rem; color: #2a3547; }
.mini-kpi p { margin: 0.2rem 0 0; color: #7d8a9d; font-size: 0.78rem; }

.modern-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
    gap: 1rem;
}

.modern-grid-half {
    grid-template-columns: 1fr 1fr;
}

.donut-card { text-align: center; }
.donut-mock {
    width: 150px;
    height: 150px;
    margin: 0.2rem auto 0.5rem;
    border-radius: 999px;
    background: conic-gradient(#5d87ff 0 62%, #eaf0ff 0 100%);
    display: grid;
    place-items: center;
    position: relative;
}
.donut-mock::after {
    content: "";
    width: 104px;
    height: 104px;
    border-radius: 999px;
    background: #fff;
    position: absolute;
}
.donut-mock span { position: relative; z-index: 2; font-weight: 700; color: #2a3547; }
.donut-legend { display: flex; justify-content: space-between; font-size: 0.74rem; color: #5a6a85; }

.overview-card h3 {
    margin: 0;
    color: var(--title-accent);
}

.sales-chart-card {
    position: relative;
    min-height: 420px;
    padding: 1rem 1.1rem 0.9rem;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.sales-chart-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.8rem;
    margin-bottom: 0.75rem;
}

.sales-chart-total {
    text-align: right;
    background: #eff4ff;
    border: 1px solid #dbe7ff;
    border-radius: 10px;
    padding: 0.45rem 0.6rem;
    min-width: 155px;
}

.sales-chart-total span {
    display: block;
    color: #64748b;
    font-size: 0.73rem;
    font-weight: 600;
}

.sales-chart-total strong {
    color: #2f4fbe;
    font-size: 0.96rem;
    letter-spacing: 0.01em;
}

.dashboard-line-chart {
    width: 100% !important;
    height: 300px !important;
    max-height: 300px;
}

.dashboard-charts-row {
    margin-bottom: 0.25rem;
}

.sales-chart-total--split {
    min-width: 178px;
}

.sales-chart-split-lines {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    align-items: flex-end;
    margin-top: 0.15rem;
}

.sales-chart-split-lines .est-line {
    color: #b45309;
    font-size: 0.82rem;
}

.sales-chart-split-lines .sale-line {
    color: #2f4fbe;
    font-size: 0.82rem;
}

.overview-card p {
    margin: 0.4rem 0 0.8rem;
    color: #64748b;
}

.bar-graph {
    display: flex;
    align-items: end;
    gap: 0.5rem;
    height: 110px;
    padding: 0.5rem 0.3rem 0.1rem;
}

.bar-graph span {
    width: 18px;
    border-radius: 6px 6px 0 0;
    background: linear-gradient(180deg, #3b82f6, #1d4ed8);
}

.stat-card,
.action-card {
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    border-radius: 14px;
    border: 1px solid var(--line);
    padding: 1rem;
}

.stat-card.blue {
    background: linear-gradient(140deg, #588fc3 0%, #3f79b2 100%);
    color: #fff;
    border-color: #1d4ed8;
}

.stat-card.blue a {
    color: #dbeafe;
}

.stat-card.white {
    background: #fff;
}

.stat-card p {
    font-size: 2rem;
    margin: 0.4rem 0;
    font-weight: 700;
}

.stat-card h3 {
    margin-top: 0.2rem;
    font-family: "Plus Jakarta Sans", sans-serif;
}

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

.action-card {
    text-decoration: none;
    color: inherit;
    transition: 0.2s ease;
    border-radius: 8px;
}

.action-card:hover {
    transform: translateY(-2px);
    border-color: #c7d2fe;
}

.grouped-form section {
    background: #ffffff;
    border: 1px solid #edf2f8;
    border-radius: 12px;
    padding: 1.1rem;
    margin-bottom: 0.95rem;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.wizard-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1rem;
    align-items: start;
}

.wizard-left {
    background: #ffffff;
    border: 1px solid #edf2f8;
    border-radius: 12px;
    padding: 1rem;
}

.wizard-left-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #51607a;
    margin-bottom: 0.7rem;
}

.wizard-right {
    background: #ffffff;
    border: 1px solid #edf2f8;
    border-radius: 12px;
    padding: 1.1rem;
}

.grouped-form section h2 {
    margin: 0 0 0.9rem;
    font-size: 0.95rem;
    color: #2a3547;
    letter-spacing: 0.01em;
    text-transform: none;
    font-family: "Plus Jakarta Sans", sans-serif;
}

.stepper {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.3rem;
    margin-bottom: 0.55rem;
    position: relative;
    padding-top: 0;
}

.stepper-vertical {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding-top: 0;
}

.stepper-item {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0.3rem 0.4rem 0.15rem;
    text-align: center;
    cursor: pointer;
    width: 100%;
    position: relative;
    z-index: 2;
}

.stepper-vertical .stepper-item {
    display: flex;
    align-items: center;
    text-align: left;
    gap: 0.6rem;
    padding: 0.2rem 0;
}

.stepper-item span {
    display: flex;
    margin: 0 auto;
    width: 26px;
    height: 26px;
    align-items: center;
    justify-content: center;
    font-size: 0.74rem;
    font-weight: 700;
    color: #7b8796;
    background: #edf1f5;
    border: 1px solid #d8e0e8;
    border-radius: 999px;
    transition: 0.2s ease;
}

.stepper-item p {
    margin: 0.32rem 0 0;
    font-size: 0.74rem;
    color: #8592a3;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stepper-vertical .stepper-item p {
    margin: 0;
}

.stepper-item.active {
    background: transparent;
}

.stepper-item.done {
    background: transparent;
}

.stepper-item.active span,
.stepper-item.done span {
    background: #6c5dd3;
    color: #fff;
    border-color: #6c5dd3;
}

.stepper-item.active p,
.stepper-item.done p {
    color: #2d3748;
}

.step-progress {
    width: 75%;
    height: 2px;
    background: #edf1f5;
    border-radius: 2px;
    margin: 0;
    overflow: hidden;
    position: absolute;
    top: 13px;
    left: 12.5%;
    z-index: 1;
}

.step-progress-vertical {
    width: 2px;
    height: calc(100% - 30px);
    left: 13px;
    top: 20px;
    margin: 0;
}

.step-progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #6c5dd3, #8a7bf0);
    border-radius: 2px;
    transition: width 0.25s ease;
}

.step-progress-bar-vertical {
    width: 100%;
    height: 0;
    transition: height 0.25s ease;
}

.wizard-meta {
    text-align: right;
    color: #8a97a8;
    font-size: 0.8rem;
    margin: 0 0 0.8rem;
}

.wizard-left .wizard-meta {
    text-align: left;
    margin-top: 0.8rem;
    margin-bottom: 0;
}

.step-section h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.step-section {
    display: none;
}

.step-section.active {
    display: block;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    height: 24px;
    padding: 0 0.5rem;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

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

.field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #344054;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

input,
select {
    width: 100%;
    border: 1px solid #d9e1ee;
    border-radius: 10px;
    padding: 0.62rem 0.78rem;
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    font-family: inherit;
    font-size: 0.87rem;
    color: #253044;
    min-height: 42px;
    box-shadow: inset 0 1px 1px rgba(16, 24, 40, 0.02);
}

input::placeholder {
    color: #98a2b3;
}

input:focus,
select:focus {
    outline: none;
    border-color: #7aa6d6;
    box-shadow: 0 0 0 4px rgba(88, 143, 195, 0.14);
    background: #ffffff;
}

.btn-primary,
.btn-secondary,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    text-decoration: none;
    border-radius: 10px;
    padding: 0.64rem 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s ease;
}

.btn-primary,
button {
    background: linear-gradient(160deg, var(--brand), var(--brand-dark));
    color: #fff;
}

.btn-primary:hover,
button:hover {
    filter: brightness(0.97);
}

.btn-secondary {
    background: #ffffff;
    color: #334155;
    border: 1px solid #d4dbe6;
}

.btn-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.sales-estimation-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem 1rem;
}

.sales-items-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.sales-items-head h2 {
    margin: 0;
}

.sales-items-table th,
.sales-items-table td {
    white-space: nowrap;
    padding: 0.55rem;
}

.sales-items-table input,
.sales-items-table select {
    min-width: 90px;
    min-height: 36px;
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
}

.sales-items-table .item-product-name {
    min-width: 220px;
}

.sales-total-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem 1rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
}

.wizard-actions {
    gap: 0.5rem;
}

.table-wrap {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow-x: auto;
}

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

.table-wrap { border-radius: 8px; border-color: #ebeef5; }
th { font-size: 0.75rem; }

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

.list-toolbar-left,
.list-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.list-search {
    min-width: 220px;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: nowrap;
}

.list-search input {
    min-width: 180px;
}

.list-chip {
    background: #fff;
    border: 1px solid #e5eaf3;
    color: #5a6a85;
    border-radius: 6px;
    font-size: 0.76rem;
    font-weight: 600;
    padding: 0.44rem 0.62rem;
}

th,
td {
    text-align: left;
    padding: 0.85rem;
    border-bottom: 1px solid #edf2f7;
    font-size: 0.9rem;
}

th {
    background: #f7fbff;
    color: #2f74b5;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.sort-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: inherit;
    text-decoration: none;
}

.sort-arrows {
    display: inline-flex;
    flex-direction: column;
    line-height: 1;
    gap: 1px;
}

.sort-arrows i {
    font-size: 0.56rem;
    color: #a7b3c6;
}

.sort-arrows i.active {
    color: #4f6ed7;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 0.75rem;
    padding: 0.2rem 0.55rem;
    font-weight: 600;
}

.status-pill.active {
    background: #dcfce7;
    color: #166534;
}

.status-pill.inactive {
    background: #fee2e2;
    color: #991b1b;
}

.table-link {
    color: var(--brand);
    text-decoration: none;
    font-weight: 600;
}

tbody tr:hover {
    background: #f5faff;
}

.table-wrap table td:first-child {
    font-weight: 600;
    color: #2a3547;
}

.action-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.inline-form {
    display: inline-flex;
}

.table-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid #dfe6f2;
    color: #4f5d75;
    background: #fff;
    text-decoration: none;
    cursor: pointer;
}

button.table-icon {
    padding: 0;
    font: inherit;
    line-height: 1;
}

.table-icon:hover {
    border-color: #c8d6ef;
    color: #2d3f5f;
}

.table-icon.danger {
    color: #be123c;
    border-color: #fecdd3;
    background: #fff1f2;
}

.table-icon--action {
    color: #2f4fbe;
    border-color: #c7d7f7;
    background: #f0f5ff;
}

.table-icon--action:hover {
    color: #1e3a8a;
    border-color: #93b4f4;
}

.conversion-from-estimation-banner {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    font-size: 0.9rem;
    color: #1e3a5f;
    line-height: 1.45;
}

.conversion-from-estimation-banner strong {
    display: block;
    margin-bottom: 0.25rem;
}

.product-thumb {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid #e5eaf3;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.product-thumb.placeholder {
    color: #94a3b8;
    font-size: 0.92rem;
}

.dropzone-upload {
    border: 1.5px dashed #c9d7ee;
    border-radius: 10px;
    background: #f8fbff;
    padding: 0.9rem;
    text-align: center;
    cursor: pointer;
    transition: 0.2s ease;
    position: relative;
}

.dropzone-upload:hover,
.dropzone-upload.drag-over {
    border-color: #6b8ff5;
    background: #eef4ff;
}

.dropzone-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.dropzone-content i {
    font-size: 1.2rem;
    color: #6b8ff5;
    margin-bottom: 0.3rem;
}

.dropzone-content p {
    margin: 0;
    color: #344054;
    font-size: 0.86rem;
}

.dropzone-content small {
    color: #667085;
    font-size: 0.76rem;
}

.dropzone-file-name {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.78rem;
    color: #1d4ed8;
    font-weight: 600;
    word-break: break-all;
}

.product-preview-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.pagination-wrap {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
}

.alert {
    border-radius: 12px;
    padding: 0.8rem 0.95rem;
    margin-bottom: 1rem;
}

.alert.success {
    background: var(--success-bg);
    border: 1px solid var(--success-line);
}

.alert.error {
    background: var(--error-bg);
    border: 1px solid var(--error-line);
}

.alert ul {
    margin: 0;
    padding-left: 1.2rem;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    justify-content: flex-end;
    list-style: none;
    margin: 0;
    padding: 0;
}

.pagination .page-item {
    list-style: none;
}

.pagination .page-item.disabled:not(:first-child):not(:last-child) .page-link {
    display: none;
}

.pagination .page-item .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    min-width: 34px;
    min-height: 34px;
    border-radius: 8px;
    border: 1px solid #d7deea;
    color: #334155;
    padding: 0.38rem 0.65rem;
    text-decoration: none;
    background: #fff;
}

.pagination .page-item:first-child .page-link,
.pagination .page-item:last-child .page-link {
    min-width: 38px;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.pagination .page-link svg {
    width: 14px;
    height: 14px;
    display: block;
}

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

@media (max-width: 1024px) {
    .portal-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-bottom: 1px solid #edf1f5;
    }
}

@media (max-width: 900px) {
    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-side {
        min-height: 180px;
    }

    .hero-grid,
    .modern-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }

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

    .step-progress {
        width: 50%;
        left: 25%;
    }

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

    .sales-estimation-grid,
    .sales-total-grid {
        grid-template-columns: 1fr 1fr;
    }

    .list-search {
        width: 100%;
        flex-wrap: wrap;
    }
}

@media (max-width: 640px) {
    .sales-estimation-grid,
    .sales-total-grid {
        grid-template-columns: 1fr;
    }
}

/* Sales return — against estimation picker */
.sr-sales-return-dialog {
    display: flex;
    flex-direction: column;
}

.sr-sales-return-dialog .sr-modal-panel {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem 3rem 0.5rem 1rem;
    gap: 0.75rem;
}

.sr-modal-panel h3 {
    margin: 0;
    font-size: 1rem;
    color: #1e293b;
}

.sr-modal-section {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 0;
}

.sr-modal-section:first-of-type {
    flex: 0 0 38%;
}

.sr-modal-section:last-of-type {
    flex: 1 1 auto;
}

.sr-modal-search {
    width: 100%;
    max-width: 320px;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 0.9rem;
}

.sr-modal-scroll {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    max-height: 220px;
}

.sr-modal-section:last-of-type .sr-modal-scroll {
    max-height: min(360px, 42vh);
}

.sr-modal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.sr-modal-table th,
.sr-modal-table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: middle;
}

.sr-modal-table th {
    background: #f1f5f9;
    font-weight: 600;
    color: #334155;
    position: sticky;
    top: 0;
    z-index: 1;
}

.sr-modal-table tr.sr-pick-row {
    cursor: pointer;
}

.sr-modal-table tr.sr-pick-row:hover {
    background: #f8fafc;
}

.sr-modal-table tr.sr-pick-row.is-selected {
    background: #e0e7ff;
}

.sr-modal-table input[type="number"] {
    width: 4.5rem;
    padding: 0.25rem 0.35rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}

.sr-modal-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Full-width footer bar; first button pulls the group to the right (works even if justify-content is overridden) */
.sr-sales-return-dialog > .sr-modal-actions.sr-modal-actions--footer {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    align-self: stretch;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 0.85rem 3rem 1rem 1rem;
    border-top: 1px solid var(--line);
    background: #f8fafc;
    justify-content: flex-end;
    text-align: right;
}

.sr-sales-return-dialog > .sr-modal-actions.sr-modal-actions--footer > button:first-of-type {
    margin-left: auto;
}

.sr-readonly-cell {
    background: #f8fafc;
}

.sr-sl-cell {
    width: 2.5rem;
    text-align: center;
    color: var(--text-soft);
    font-size: 0.85rem;
}
