/* ============================================================
   Toolrig — professional corporate styling
   Clarity > decoration. Restrained palette, strong hierarchy.
   ============================================================ */
:root {
    --tr-dark: #10233b;
    --tr-dark-2: #0b1a2e;
    --tr-accent: #1f6feb;
    --tr-accent-dark: #1858c4;
    --tr-bg: #f4f6f9;
    --tr-surface: #ffffff;
    --tr-border: #e3e7ee;
    --tr-border-strong: #cfd6e0;
    --tr-text: #1c2733;
    --tr-muted: #66748a;
    --tr-success: #1a7f4b;
    --tr-success-bg: #e6f4ec;
    --tr-warning: #b9770a;
    --tr-warning-bg: #fbf1de;
    --tr-danger: #c0392b;
    --tr-danger-bg: #fbeae8;
    --tr-info: #1f6feb;
    --tr-info-bg: #e8f0fe;
    --tr-sidebar-w: 250px;
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--tr-text);
    background: var(--tr-bg);
    font-size: 15px;
}

a { color: var(--tr-accent); text-decoration: none; }
a:hover { color: var(--tr-accent-dark); text-decoration: underline; }

h1, h2, h3, h4, h5 { font-weight: 700; color: var(--tr-text); }

/* ---------------- Buttons ---------------- */
.btn { font-weight: 600; border-radius: 6px; }
.btn-primary { background: var(--tr-accent); border-color: var(--tr-accent); }
.btn-primary:hover, .btn-primary:focus { background: var(--tr-accent-dark); border-color: var(--tr-accent-dark); }
.btn-dark { background: var(--tr-dark); border-color: var(--tr-dark); }
.btn-dark:hover { background: var(--tr-dark-2); border-color: var(--tr-dark-2); }
.btn-success { background: var(--tr-success); border-color: var(--tr-success); }
.btn-outline-secondary { border-color: var(--tr-border-strong); color: var(--tr-text); }

/* ---------------- Cards / surfaces ---------------- */
.tr-card {
    background: var(--tr-surface);
    border: 1px solid var(--tr-border);
    border-radius: 8px;
}
.tr-card + .tr-card { margin-top: 1rem; }
.tr-card-header {
    padding: .9rem 1.15rem;
    border-bottom: 1px solid var(--tr-border);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.tr-card-body { padding: 1.15rem; }

/* ---------------- Stat cards ---------------- */
.stat-card {
    background: var(--tr-surface);
    border: 1px solid var(--tr-border);
    border-radius: 8px;
    padding: 1.1rem 1.2rem;
    height: 100%;
}
.stat-card .stat-label { color: var(--tr-muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 800; margin-top: .35rem; color: var(--tr-dark); }
.stat-card .stat-meta { font-size: .82rem; color: var(--tr-muted); margin-top: .25rem; }

/* ---------------- Status badges ---------------- */
.tr-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    padding: .28rem .6rem;
    border-radius: 999px;
    border: 1px solid transparent;
    white-space: nowrap;
}
.tr-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tr-badge-success { color: var(--tr-success); background: var(--tr-success-bg); }
.tr-badge-warning { color: var(--tr-warning); background: var(--tr-warning-bg); }
.tr-badge-danger { color: var(--tr-danger); background: var(--tr-danger-bg); }
.tr-badge-info { color: var(--tr-info); background: var(--tr-info-bg); }
.tr-badge-muted { color: var(--tr-muted); background: #eef1f5; }

/* ---------------- App shell (portal layout) ---------------- */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
    width: var(--tr-sidebar-w);
    background: var(--tr-dark);
    color: #cdd6e4;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform .2s ease;
}
.app-sidebar .brand {
    padding: 1.15rem 1.25rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: #fff;
    font-size: 1.15rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.app-nav { padding: .75rem 0; overflow-y: auto; flex: 1; }
.app-nav .nav-section {
    padding: .85rem 1.25rem .3rem;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #6f7f95;
    font-weight: 700;
}
.app-nav a {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem 1.25rem;
    color: #cdd6e4;
    font-size: .9rem;
    font-weight: 500;
    border-left: 3px solid transparent;
}
.app-nav a:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.app-nav a.active { background: rgba(31,111,235,.16); color: #fff; border-left-color: var(--tr-accent); }
.app-sidebar .sidebar-foot { padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,.08); }

.app-main { flex: 1; margin-left: var(--tr-sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.app-topbar {
    background: var(--tr-surface);
    border-bottom: 1px solid var(--tr-border);
    padding: .7rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1030;
}
.app-topbar .page-title { font-size: 1.05rem; font-weight: 700; margin: 0; }
.app-content { padding: 1.5rem; flex: 1; }

.topbar-actions { display: flex; align-items: center; gap: 1rem; }
.notif-bell { position: relative; color: var(--tr-muted); }
.notif-bell .dot { position: absolute; top: -2px; right: -4px; background: var(--tr-danger); color: #fff; font-size: .6rem; border-radius: 999px; padding: 0 .3rem; font-weight: 700; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1.25rem; flex-wrap: wrap; gap: 1rem; }
.page-head h1 { font-size: 1.4rem; margin: 0; }
.page-head .sub { color: var(--tr-muted); font-size: .9rem; margin-top: .25rem; }
.breadcrumb { font-size: .82rem; margin-bottom: .35rem; }

/* ---------------- Tables ---------------- */
.tr-table { width: 100%; background: var(--tr-surface); border-collapse: collapse; }
.tr-table thead th {
    background: #f8fafc;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--tr-muted);
    font-weight: 700;
    padding: .7rem .9rem;
    border-bottom: 1px solid var(--tr-border);
    text-align: left;
}
.tr-table tbody td { padding: .8rem .9rem; border-bottom: 1px solid var(--tr-border); vertical-align: middle; }
.tr-table tbody tr:hover { background: #fafbfd; }
.tr-table .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; color: var(--tr-muted); }
.table-wrap { overflow-x: auto; border: 1px solid var(--tr-border); border-radius: 8px; }

/* ---------------- Empty states ---------------- */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--tr-muted); }
.empty-state h3 { font-size: 1.05rem; color: var(--tr-text); margin-bottom: .4rem; }
.empty-state p { max-width: 420px; margin: 0 auto 1.25rem; font-size: .92rem; }

/* ---------------- Forms ---------------- */
.form-label { font-size: .85rem; font-weight: 600; color: #34404d; }
.form-section { border-bottom: 1px solid var(--tr-border); padding-bottom: 1.25rem; margin-bottom: 1.25rem; }
.form-section:last-child { border-bottom: 0; }
.form-section h5 { font-size: .95rem; margin-bottom: 1rem; }
.req::after { content: " *"; color: var(--tr-danger); }

/* ---------------- Public marketplace ---------------- */
.public-nav { background: var(--tr-surface); border-bottom: 1px solid var(--tr-border); }
.public-nav .brand-mark { font-weight: 800; letter-spacing: 2px; color: var(--tr-dark); font-size: 1.25rem; }
.hero {
    background: linear-gradient(160deg, var(--tr-dark) 0%, var(--tr-dark-2) 100%);
    color: #fff;
    padding: 4rem 0 5rem;
}
.hero h1 { color: #fff; font-size: 2.4rem; font-weight: 800; line-height: 1.15; }
.hero p { color: rgba(255,255,255,.75); font-size: 1.05rem; }
.search-panel { background: #fff; border-radius: 10px; padding: 1.25rem; box-shadow: 0 12px 40px rgba(0,0,0,.25); margin-top: -3.25rem; position: relative; }

.equip-card { background: #fff; border: 1px solid var(--tr-border); border-radius: 8px; overflow: hidden; height: 100%; display: flex; flex-direction: column; transition: box-shadow .15s ease, border-color .15s ease; }
.equip-card:hover { box-shadow: 0 6px 20px rgba(16,35,59,.1); border-color: var(--tr-border-strong); }
.equip-card .thumb { aspect-ratio: 4/3; background: #eef1f5 center/cover no-repeat; display: flex; align-items: center; justify-content: center; color: #aeb8c6; }
.equip-card .body { padding: .9rem 1rem 1rem; display: flex; flex-direction: column; flex: 1; }
.equip-card .title { font-weight: 700; font-size: 1rem; margin-bottom: .35rem; }
.equip-card .price { font-weight: 800; color: var(--tr-dark); font-size: 1.05rem; }
.verified { color: var(--tr-success); font-weight: 700; font-size: .8rem; display: inline-flex; align-items: center; gap: .25rem; }
.meta-row { color: var(--tr-muted); font-size: .85rem; }

.spec-table td { padding: .5rem .25rem; border-bottom: 1px solid var(--tr-border); font-size: .9rem; }
.spec-table td:first-child { color: var(--tr-muted); width: 45%; }

.gallery-main { aspect-ratio: 16/10; background: #eef1f5 center/cover no-repeat; border-radius: 8px; }
.gallery-thumb { width: 72px; height: 56px; background: #eef1f5 center/cover no-repeat; border-radius: 6px; cursor: pointer; border: 2px solid transparent; }
.gallery-thumb.active { border-color: var(--tr-accent); }

/* Price breakdown */
.price-line { display: flex; justify-content: space-between; padding: .4rem 0; font-size: .92rem; }
.price-line.total { border-top: 1px solid var(--tr-border); margin-top: .35rem; padding-top: .7rem; font-weight: 800; font-size: 1.05rem; }
.price-line .muted { color: var(--tr-muted); }

/* ---------------- Auth screens ---------------- */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, var(--tr-dark) 0%, var(--tr-dark-2) 100%); padding: 2rem 1rem; }
.auth-wrap { width: 100%; max-width: 460px; }
.auth-card { background: #fff; border-radius: 10px; padding: 2.25rem; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.auth-brand { text-align: center; margin-bottom: 1.5rem; }
.brand-mark { font-weight: 800; letter-spacing: 2px; font-size: 1.5rem; color: var(--tr-dark); text-decoration: none; }
.auth-sub { color: var(--tr-muted); font-size: .9rem; margin: .4rem 0 0; }
.auth-title { font-size: 1.35rem; font-weight: 700; margin-bottom: 1.25rem; }
.auth-footer { text-align: center; color: rgba(255,255,255,.6); font-size: .8rem; margin-top: 1.25rem; }

/* ---------------- Sidebar toggle (mobile) ---------------- */
.sidebar-backdrop { display: none; }
.menu-toggle { display: none; background: none; border: 0; font-size: 1.4rem; color: var(--tr-text); }

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.open { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .menu-toggle { display: inline-block; }
    .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1035; }
    .hero h1 { font-size: 1.9rem; }
}

/* ============================================================
   Marketing pages (How It Works / For Owners / About)
   Premium, image-rich layout on top of the corporate system.
   ============================================================ */
.page-hero {
    position: relative;
    color: #fff;
    background: linear-gradient(160deg, var(--tr-dark) 0%, var(--tr-dark-2) 100%);
    overflow: hidden;
}
.page-hero .page-hero-media {
    position: absolute; inset: 0;
    background-size: cover; background-position: center;
    opacity: .28;
}
.page-hero .page-hero-media::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, rgba(11,26,46,.9) 0%, rgba(11,26,46,.55) 60%, rgba(11,26,46,.35) 100%);
}
.page-hero .container { position: relative; z-index: 2; }
.page-hero .eyebrow {
    display: inline-block; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
    font-weight: 700; color: #7fb0ff; background: rgba(31,111,235,.16);
    padding: .35rem .75rem; border-radius: 999px; margin-bottom: 1rem;
}
.page-hero h1 { color: #fff; font-size: 2.6rem; font-weight: 800; line-height: 1.1; letter-spacing: -.5px; }
.page-hero .lead-text { color: rgba(255,255,255,.82); font-size: 1.1rem; max-width: 640px; }
.page-hero .hero-actions { margin-top: 1.75rem; display: flex; gap: .75rem; flex-wrap: wrap; }

/* Stat band */
.stat-band { background: var(--tr-surface); border-top: 1px solid var(--tr-border); border-bottom: 1px solid var(--tr-border); }
.stat-band .stat-num { font-size: 2rem; font-weight: 800; color: var(--tr-dark); line-height: 1; }
.stat-band .stat-cap { color: var(--tr-muted); font-size: .85rem; margin-top: .35rem; }

/* Section heading */
.section-head { max-width: 680px; margin: 0 auto 2.5rem; text-align: center; }
.section-head .eyebrow { display: inline-block; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--tr-accent); margin-bottom: .5rem; }
.section-head h2 { font-size: 1.9rem; font-weight: 800; letter-spacing: -.4px; }
.section-head p { color: var(--tr-muted); font-size: 1.02rem; }

/* Media frame */
.media-frame { border-radius: 14px; overflow: hidden; box-shadow: 0 20px 50px rgba(16,35,59,.14); border: 1px solid var(--tr-border); }
.media-frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
.media-frame.tall { aspect-ratio: 4/5; }
.media-frame.wide { aspect-ratio: 16/10; }

/* Alternating feature rows */
.feature-row { align-items: center; }
.feature-row .feat-icon {
    width: 44px; height: 44px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--tr-info-bg); color: var(--tr-accent); font-size: 1.25rem; margin-bottom: 1rem;
}
.feature-row h3 { font-size: 1.35rem; font-weight: 800; }
.feature-row .feat-list { list-style: none; padding: 0; margin: 1rem 0 0; }
.feature-row .feat-list li { display: flex; gap: .6rem; padding: .35rem 0; color: var(--tr-text); }
.feature-row .feat-list li i { color: var(--tr-success); margin-top: .15rem; }

/* Step timeline */
.step-grid .step-card { position: relative; height: 100%; }
.step-grid .step-num {
    width: 46px; height: 46px; border-radius: 50%; background: var(--tr-dark); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.05rem; margin-bottom: 1rem;
}
.step-grid .step-card h3 { font-size: 1.05rem; font-weight: 700; }

/* Value cards */
.value-card { height: 100%; }
.value-card .v-icon { font-size: 1.6rem; color: var(--tr-accent); margin-bottom: .6rem; }

/* CTA band */
.cta-band {
    background: linear-gradient(120deg, var(--tr-accent) 0%, var(--tr-accent-dark) 100%);
    color: #fff; border-radius: 16px;
}
.cta-band h2 { color: #fff; font-weight: 800; }
.cta-band p { color: rgba(255,255,255,.85); }
.cta-band .btn-light { font-weight: 700; }

@media (max-width: 767.98px) {
    .page-hero h1 { font-size: 1.9rem; }
    .section-head h2 { font-size: 1.5rem; }
}

/* Homepage category tiles */
.cat-tile { transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease; }
.cat-tile:hover { box-shadow: 0 10px 26px rgba(16,35,59,.12); border-color: var(--tr-border-strong); transform: translateY(-2px); }
.cat-tile .cat-ico {
    width: 44px; height: 44px; flex: 0 0 44px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--tr-info-bg); color: var(--tr-accent); font-size: 1.2rem;
}

/* ============================================================
   Global layout safety — prevent horizontal (left/right) scroll
   ============================================================ */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Media should never force the page wider than the viewport. */
img, svg, video, iframe { max-width: 100%; }

/* Full-width marketing sections and the carousel must stay within the viewport. */
.page-hero,
.hero,
.hero-carousel,
.stat-band,
.cta-band,
section { max-width: 100%; }

.carousel,
.carousel-inner,
.carousel-item { max-width: 100%; overflow: hidden; }

/* ============================================================
   Comfortable horizontal padding (breathing room on all screens)
   ============================================================ */
/* Public + marketing containers get a little more side padding on phones. */
@media (max-width: 575.98px) {
    .container, .container-sm, .container-md, .container-lg, .container-xl {
        padding-left: 1.15rem;
        padding-right: 1.15rem;
    }
    .app-content { padding: 1.15rem; }
    .page-hero h1, .hero-carousel .hero-slide h1 { font-size: 1.6rem; }
    .cta-band { padding: 1.5rem !important; }
    .search-panel { margin-top: -1.5rem; }
}

/* Popup + hero content never exceeds the screen. */
.tr-popup, .tr-popup-body { max-width: 100%; }
