/* Theme tokens ---------------------------------------------------------- */
:root {
    --ts-ink: #17223b;
    --ts-muted: #6f7890;
    --ts-navy: #101a31;
    --ts-navy-soft: #182744;
    --ts-primary: #5b5bd6;
    --ts-primary-dark: #4646b8;
    --ts-coral: #ff7a66;
    --ts-mint: #3fc6a4;
    --ts-blue: #3f8cff;
    --ts-surface: #ffffff;
    --ts-page: #f5f7fc;
    --ts-border: #e7eaf2;
    --ts-shadow: 0 14px 38px rgba(29, 39, 67, .08);
}

/* Application shell ----------------------------------------------------- */
body {
    color: var(--ts-ink);
    background: var(--ts-page);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html, body, .wrapper { max-width: 100%; overflow-x: hidden; }
.content-wrapper, .content-wrapper > *, .container-fluid, .row > [class*="col-"] { min-width: 0; }
.welcome-card p, .page-subtitle, .auth-lead { overflow-wrap: anywhere; }

.content-wrapper {
    min-height: 100vh;
    background:
        radial-gradient(circle at 95% 0, rgba(91, 91, 214, .08), transparent 28rem),
        var(--ts-page);
}

.main-header {
    min-height: 70px;
    border-bottom: 1px solid var(--ts-border);
    box-shadow: none;
}

.main-sidebar {
    background: linear-gradient(180deg, var(--ts-navy) 0%, #0d1426 100%);
    box-shadow: 12px 0 38px rgba(13, 20, 38, .12) !important;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: 70px;
    padding: 0 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, .08) !important;
    color: #fff !important;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -.02em;
}

.brand-mark {
    display: inline-grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--ts-coral), #ffad68);
    box-shadow: 0 8px 20px rgba(255, 122, 102, .28);
}

.sidebar { padding: .9rem .8rem; }
.nav-sidebar .nav-header { padding: 1.35rem .75rem .5rem; color: #75809a; font-size: .69rem; letter-spacing: .14em; }
.nav-sidebar .nav-link { margin-bottom: .35rem; padding: .72rem .8rem; border-radius: 11px; color: #aeb7cb; }
.nav-sidebar .nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-sidebar .nav-link.active { background: linear-gradient(135deg, var(--ts-primary), #7777e8); color: #fff; box-shadow: 0 8px 18px rgba(91, 91, 214, .25); }
.nav-sidebar .nav-icon { font-size: .95rem !important; }

.content-header { padding: 2rem 1.25rem .9rem; }
.content-header h1 { margin: 0; font-size: 1.7rem; font-weight: 800; letter-spacing: -.035em; }
.page-kicker { margin-bottom: .35rem; color: var(--ts-primary); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.page-subtitle { margin: .35rem 0 0; color: var(--ts-muted); font-size: .94rem; }

.user-menu-link { display: flex !important; align-items: center; gap: .7rem; }
.user-avatar { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; background: #ececfc; color: var(--ts-primary); font-weight: 800; }
.user-copy { line-height: 1.15; }
.user-copy strong { display: block; color: var(--ts-ink); font-size: .88rem; }
.user-copy small { color: var(--ts-muted); font-size: .72rem; text-transform: capitalize; }

/* Cards, forms, tables -------------------------------------------------- */
.card {
    border: 1px solid var(--ts-border);
    border-radius: 16px;
    box-shadow: var(--ts-shadow);
    overflow: hidden;
}

.card-header { padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--ts-border); background: var(--ts-surface); }
.card-title { font-size: 1rem; font-weight: 750; }
.card-body { padding: 1.35rem; }

.metric-card { position: relative; min-height: 148px; padding: 1.25rem; overflow: hidden; background: var(--ts-surface); }
.metric-card::after { position: absolute; right: -24px; bottom: -34px; width: 112px; height: 112px; border-radius: 50%; background: var(--metric-tint, #eee); content: ""; }
.metric-icon { display: grid; width: 42px; height: 42px; margin-bottom: 1.2rem; place-items: center; border-radius: 12px; background: var(--metric-tint, #eee); color: var(--metric-color, var(--ts-primary)); }
.metric-value { margin: 0; font-size: 1.7rem; font-weight: 800; letter-spacing: -.04em; }
.metric-label { margin: .25rem 0 0; color: var(--ts-muted); font-size: .82rem; }

.welcome-card { position: relative; min-height: 220px; padding: 1.7rem; overflow: hidden; border: 0; background: linear-gradient(130deg, #171f3b, #394079 70%, #5b5bd6); color: #fff; }
.welcome-card::before, .welcome-card::after { position: absolute; border: 1px solid rgba(255, 255, 255, .12); border-radius: 50%; content: ""; }
.welcome-card::before { top: -85px; right: -40px; width: 260px; height: 260px; }
.welcome-card::after { right: 80px; bottom: -120px; width: 220px; height: 220px; }
.welcome-card p { max-width: 510px; color: rgba(255, 255, 255, .72); }
.welcome-card .btn { position: relative; z-index: 1; border: 0; color: var(--ts-ink); font-weight: 700; }

.form-control { min-height: 44px; border: 1px solid #dfe3ed; border-radius: 10px; color: var(--ts-ink); }
.form-control:focus { border-color: var(--ts-primary); box-shadow: 0 0 0 .18rem rgba(91, 91, 214, .13); }
.btn { border-radius: 10px; font-weight: 700; }
.btn-primary { border-color: var(--ts-primary); background: var(--ts-primary); }
.btn-primary:hover, .btn-primary:focus { border-color: var(--ts-primary-dark); background: var(--ts-primary-dark); }
.btn-soft { border: 1px solid #e1e2f8; background: #f0f0ff; color: var(--ts-primary); }

.table { margin-bottom: 0; }
.table thead th { border: 0; background: #f8f9fc; color: #7b8499; font-size: .72rem; font-weight: 800; letter-spacing: .045em; text-transform: uppercase; }
.table td, .table th { padding: .9rem 1rem; border-color: #eff1f6; vertical-align: middle; }
.table td { color: #424b61; font-size: .88rem; }
.status-pill { display: inline-flex; align-items: center; gap: .35rem; padding: .34rem .62rem; border-radius: 999px; background: #eef0f5; color: #626b7d; font-size: .72rem; font-weight: 750; text-transform: capitalize; }
.status-pill::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }
.status-completed, .status-approved { background: #e4f8f1; color: #218b70; }
.status-processing, .status-pending, .status-sending { background: #e9f1ff; color: #3974cf; }
.status-failed, .status-cancelled, .status-rejected { background: #ffebe8; color: #cb594a; }
.status-partial { background: #fff3db; color: #a76d00; }
.service-help { color: var(--ts-muted); font-size: .83rem; }

/* Wallet components ----------------------------------------------------- */
.wallet-balance-card {
    border: 0;
    background: linear-gradient(145deg, #171f3b, #343c72 68%, #5b5bd6);
    color: #fff;
}

.wallet-balance-card::after {
    position: absolute;
    right: -75px;
    bottom: -95px;
    width: 230px;
    height: 230px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 50%;
    box-shadow: 0 0 0 55px rgba(255, 255, 255, .03);
    content: "";
}

.wallet-card-top { display: flex; position: relative; z-index: 1; align-items: center; justify-content: space-between; color: rgba(255, 255, 255, .62); font-size: .72rem; font-weight: 800; letter-spacing: .11em; }
.wallet-card-top i { color: #ffad9f; font-size: 1.2rem; }
.wallet-balance { position: relative; z-index: 1; margin: 2.1rem 0 1.5rem; font-size: clamp(2rem, 4vw, 2.7rem); font-weight: 850; letter-spacing: -.045em; }
.wallet-rate { position: relative; z-index: 1; color: rgba(255, 255, 255, .86); font-size: .84rem; font-weight: 650; }
.wallet-rate-date { position: relative; z-index: 1; margin-top: .35rem; color: rgba(255, 255, 255, .5); font-size: .72rem; }

/* Service catalog grouping --------------------------------------------- */
.platform-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
.platform-chip { display: flex; align-items: center; justify-content: space-between; padding: .85rem 1rem; border: 1px solid var(--ts-border); border-radius: 12px; background: #fff; color: var(--ts-muted); box-shadow: 0 6px 20px rgba(29, 39, 67, .04); font-size: .8rem; font-weight: 700; transition: .18s ease; }
.platform-chip:hover { border-color: #cfcff3; color: var(--ts-primary); transform: translateY(-1px); }
.platform-chip.active { border-color: var(--ts-primary); background: var(--ts-primary); color: #fff; box-shadow: 0 8px 20px rgba(91, 91, 214, .2); }
.platform-chip strong { font-size: .76rem; }
.platform-badge { display: inline-flex; padding: .32rem .58rem; border-radius: 999px; background: #eeeeff; color: var(--ts-primary); font-size: .7rem; font-weight: 800; }
.service-inline-editor { display: grid; min-width: 175px; gap: .45rem; }
.service-admin-table td:nth-child(3) { min-width: 260px; }
.service-admin-table td:nth-child(4), .service-admin-table td:nth-child(5) { min-width: 145px; }

.platform-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); gap: .65rem; }
.platform-option { position: relative; }
.platform-option input { position: absolute; opacity: 0; pointer-events: none; }
.platform-option label { display: flex; min-height: 54px; margin: 0; align-items: center; justify-content: center; padding: .65rem .8rem; border: 1px solid var(--ts-border); border-radius: 11px; background: #fff; color: var(--ts-muted); cursor: pointer; font-size: .8rem; font-weight: 750; text-align: center; transition: .18s ease; }
.platform-option label:hover { border-color: #cfcff3; color: var(--ts-primary); }
.platform-option input:checked + label { border-color: var(--ts-primary); background: #eeeeff; color: var(--ts-primary); box-shadow: 0 0 0 2px rgba(91, 91, 214, .09); }
.platform-option small { margin-left: .35rem; color: inherit; opacity: .72; }

/* Shared application footer -------------------------------------------- */
.app-footer { padding: 0; border-top: 1px solid var(--ts-border); background: #fff; color: var(--ts-muted); }
.footer-main { display: flex; min-height: 88px; align-items: center; gap: 2rem; padding: 1.25rem 1.5rem; }
.footer-brand { display: flex; min-width: 210px; align-items: center; gap: .7rem; color: var(--ts-ink); }
.footer-brand > span:last-child { display: flex; flex-direction: column; line-height: 1.15; }
.footer-brand small { margin-top: .2rem; color: var(--ts-muted); font-size: .68rem; font-weight: 500; }
.footer-mark { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border-radius: 10px; background: linear-gradient(135deg, var(--ts-coral), #ffad68); color: #fff; }
.footer-links { display: flex; flex: 1; flex-wrap: wrap; justify-content: center; gap: .45rem 1.3rem; }
.footer-links a { color: var(--ts-muted); font-size: .78rem; font-weight: 700; }
.footer-links a:hover { color: var(--ts-primary); }
.footer-status { display: flex; min-width: 130px; align-items: center; justify-content: flex-end; color: #4d596f; font-size: .75rem; font-weight: 650; }
.status-dot { width: 7px; height: 7px; margin-right: .45rem; border-radius: 50%; background: var(--ts-mint); box-shadow: 0 0 0 4px rgba(63, 198, 164, .13); }
.footer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1.5rem; border-top: 1px solid #f0f2f7; background: #fafbfe; font-size: .68rem; }
.footer-bottom > div { display: flex; flex-wrap: wrap; gap: .3rem .8rem; }
.footer-credit a { color: var(--ts-primary); font-weight: 700; }
.footer-credit a:hover { color: var(--ts-primary-dark); }

/* Compact footer shared by customer registration and both login portals. */
.auth-footer { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid var(--ts-border); color: #9aa2b4; font-size: .7rem; }
.auth-footer-dot { color: #c4c9d5; }

/* Authentication pages ------------------------------------------------- */
.auth-page { min-height: 100vh; background: #f4f6fb; }
.auth-shell { display: grid; min-height: 100vh; grid-template-columns: minmax(360px, .95fr) minmax(480px, 1.25fr); }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 3rem clamp(1.5rem, 5vw, 5rem); background: #fff; }
.auth-card { width: 100%; max-width: 430px; }
.auth-brand { display: inline-flex; align-items: center; gap: .7rem; margin-bottom: 3.5rem; color: var(--ts-ink); font-size: 1.15rem; font-weight: 850; }
.auth-title { margin-bottom: .65rem; font-size: clamp(2rem, 4vw, 2.65rem); font-weight: 850; letter-spacing: -.055em; }
.auth-lead { margin-bottom: 2rem; color: var(--ts-muted); }
.auth-label { margin-bottom: .45rem; color: #424b61; font-size: .78rem; font-weight: 750; }
.auth-input { position: relative; }
.auth-input i { position: absolute; top: 50%; left: 15px; color: #9aa2b4; transform: translateY(-50%); }
.auth-input .form-control { height: 50px; padding-left: 42px; }
.auth-submit { min-height: 50px; box-shadow: 0 10px 22px rgba(91, 91, 214, .2); }
.auth-switch { margin-top: 1.7rem; color: var(--ts-muted); font-size: .88rem; }
.auth-switch a { color: var(--ts-primary); font-weight: 750; }
.auth-visual { position: relative; display: flex; align-items: flex-end; padding: clamp(2rem, 6vw, 5rem); overflow: hidden; background: linear-gradient(145deg, #121b33 5%, #2d3768 65%, #5b5bd6); color: #fff; }
.auth-visual::before { position: absolute; top: 8%; right: -10%; width: 440px; height: 440px; border: 1px solid rgba(255, 255, 255, .12); border-radius: 50%; box-shadow: 0 0 0 80px rgba(255, 255, 255, .03), 0 0 0 160px rgba(255, 255, 255, .025); content: ""; }
.auth-visual-copy { position: relative; z-index: 1; max-width: 610px; }
.auth-eyebrow { margin-bottom: 1rem; color: #ffb3a7; font-size: .75rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.auth-visual h2 { font-size: clamp(2.1rem, 4vw, 4rem); font-weight: 850; line-height: 1.04; letter-spacing: -.055em; }
.auth-visual p { max-width: 520px; margin-top: 1.25rem; color: rgba(255, 255, 255, .68); font-size: 1rem; }
.trust-row { display: flex; gap: 1.5rem; margin-top: 2.5rem; }
.trust-item { display: flex; align-items: center; gap: .5rem; color: rgba(255, 255, 255, .78); font-size: .78rem; }
.trust-item i { color: #76dfc4; }

/* Responsive refinements ---------------------------------------------- */
@media (max-width: 991.98px) {
    .auth-shell { grid-template-columns: minmax(0, 1fr); }
    .auth-visual { display: none; }
    .auth-panel, .auth-card { min-width: 0; }
    .auth-panel { min-height: 100vh; }
    .content-header { padding-top: 1.35rem; }
    .footer-main { flex-wrap: wrap; gap: 1rem 1.5rem; }
    .footer-brand { flex: 1 1 220px; }
    .footer-links { order: 3; flex: 1 0 100%; justify-content: flex-start; }
    .footer-status { min-width: auto; }
}

@media (max-width: 767.98px) {
    .content-header, .content { padding-right: .75rem; padding-left: .75rem; }
    .card { border-radius: 13px; }
    .card-body { padding: 1.05rem; }
    .metric-card { min-height: 132px; }
    .metric-value { font-size: 1.45rem; }
    .welcome-card { padding: 1.35rem; }
    .table-responsive > .table { min-width: 760px; }
    .service-admin-table { min-width: 1180px !important; }
    .platform-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .footer-main { padding: 1.1rem; }
    .footer-bottom { padding: .75rem 1.1rem; }
}

@media (max-width: 575.98px) {
    .user-copy { display: none; }
    .content-header h1 { font-size: 1.45rem; }
    .welcome-card { min-height: 250px; }
    .auth-brand { margin-bottom: 2.25rem; }
    .auth-panel { align-items: flex-start; padding: 2rem 1.15rem; }
    .auth-title { font-size: 2rem; }
    .auth-lead { margin-bottom: 1.5rem; }
    .platform-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .platform-option label { min-height: 50px; padding: .55rem .45rem; font-size: .74rem; }
    .footer-main { display: block; }
    .footer-links { margin-top: 1.1rem; justify-content: flex-start; }
    .footer-status { margin-top: 1.1rem; justify-content: flex-start; }
    .footer-bottom { display: block; line-height: 1.7; }
    .footer-bottom > span { display: block; margin-top: .2rem; }
    .footer-bottom > div { display: block; }
    .footer-bottom > div span { display: block; }
}

@media (max-width: 359.98px) {
    .platform-summary, .platform-picker { grid-template-columns: 1fr; }
    .navbar-nav .nav-link { padding-right: .55rem; padding-left: .55rem; }
}
