/* ============================================================
   GSTR-9C module design system — scoped under .gstr9c-shell
   Ported token-for-token from the prototype (GSTR9C-Prototype-Source/
   GSTR9_UI/style.css): blue-gradient header, amber/green step chips,
   computed-bg/auto-bg table shading. Deliberately its own palette —
   the 9C prototype is a separate design from the 9 prototype's navy one.
   ============================================================ */

.gstr9c-shell {
    /* ---- brand / palette: tied to the app theme (--theme-default + Bootstrap vars) ---- */
    --c9-blue:       var(--theme-default, #1a5276);
    --c9-blue-dark:  color-mix(in srgb, var(--theme-default, #1a5276) 80%, #000);
    --c9-blue-light: color-mix(in srgb, var(--theme-default, #1a5276) 12%, var(--bs-body-bg, #fff));
    --c9-accent:     var(--theme-default, #00adff);
    --c9-green:      #1e8449;
    --c9-red:        #c0392b;
    --c9-amber:      #b9770e;
    --c9-border:     var(--bs-border-color, #cfd8dc);
    --c9-computed-bg: #fef9e7;
    --c9-auto-bg:    #eafaf1;
    /* ---- surfaces / ink: Bootstrap-tied, dark-mode-aware ---- */
    --c9-surface:    var(--bs-body-bg, #fff);
    --c9-surface-2:  color-mix(in srgb, var(--bs-body-color, #1a252f) 5%, var(--bs-body-bg, #f4f6f7));
    --c9-grey:       var(--c9-surface-2);
    --c9-ink:        var(--bs-body-color, #1a252f);
    --c9-ink-2:      color-mix(in srgb, var(--bs-body-color, #1a252f) 70%, var(--bs-secondary-color, #6c757d));
    --c9-ink-3:      var(--bs-secondary-color, #5d6d7e);
}

/* ---- app dark mode integration (body.dark-only) ---- */
body.dark-only .gstr9c-shell {
    --c9-blue:       color-mix(in srgb, var(--theme-default, #5b9bd5) 90%, #fff);
    --c9-blue-dark:  var(--theme-default, #4a7bc4);
    --c9-blue-light: color-mix(in srgb, var(--theme-default, #5b9bd5) 18%, #0d1420);
    --c9-green:      #52c08a;
    --c9-red:        #f0837a;
    --c9-amber:      #e0a34a;
    --c9-computed-bg: #2a2415;
    --c9-auto-bg:    #142a1e;
}

/* ---- topbar (blue gradient) + status box ---- */
.gstr9c-shell .c9-topbar {
    background: linear-gradient(135deg, var(--c9-blue-dark), var(--c9-blue));
    color: #fff;
    padding: 12px 16px;
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
    border-radius: 8px 8px 0 0;
}
.gstr9c-shell .c9-topbar h1 { font-size: 16px; font-weight: 600; flex: 1 1 auto; margin: 0; }
.gstr9c-shell .c9-topbar .sub { font-size: 11px; opacity: .85; display: block; font-weight: 400; }
.gstr9c-shell .c9-status-box {
    display: flex; flex-direction: column; justify-content: center; gap: 2px;
    border: 1px solid rgba(255,255,255,.35); border-radius: 6px;
    padding: 4px 12px; font-size: 11px; background: rgba(255,255,255,.12);
}
.gstr9c-shell .c9-status-box div { display: flex; gap: 8px; }
.gstr9c-shell .c9-status-box span { color: rgba(255,255,255,.7); min-width: 62px; }
.gstr9c-shell .c9-status-box b { color: #ffd5d5; }
.gstr9c-shell .c9-status-box b.ok { color: #a9f5c8; }
.gstr9c-shell .c9-btn {
    border: none; border-radius: 6px; padding: 7px 13px; font-size: 12.5px; font-weight: 600;
    cursor: pointer; background: var(--c9-accent); color: #fff; transition: filter .15s;
}
.gstr9c-shell .c9-btn:hover { filter: brightness(1.1); }
.gstr9c-shell .c9-btn.ghost { background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.4); }
.gstr9c-shell .c9-btn.green { background: var(--c9-green); }
.gstr9c-shell .c9-btn.red { background: var(--c9-red); }

/* ---- step workflow bar ---- */
.gstr9c-shell .c9-stepbar {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch;
    padding: 8px 14px; background: var(--c9-surface); border-bottom: 2px solid var(--c9-border);
}
.gstr9c-shell .c9-stepbtn {
    border: 1px solid var(--c9-border); border-radius: 6px; background: var(--c9-surface);
    padding: 5px 12px; cursor: pointer; text-align: center;
    transition: background .15s; min-width: 130px; font-size: 12px; color: var(--c9-ink);
}
.gstr9c-shell .c9-stepbtn:hover { background: var(--c9-blue-light); }
.gstr9c-shell .c9-stepbtn b { display: block; color: var(--c9-blue-dark); font-size: 12px; }
.gstr9c-shell .c9-stepbtn small { display: block; color: var(--c9-amber); font-size: 10px; font-weight: 700; }
.gstr9c-shell .c9-stepbtn small.done { color: var(--c9-green); }
.gstr9c-shell .c9-stepbtn.help { background: var(--c9-computed-bg); border-color: var(--c9-amber); }

/* ---- taxpayer strip (Pt. I) ---- */
.gstr9c-shell .tp-strip {
    background: var(--c9-surface); border: 1px solid var(--c9-border); border-radius: var(--radius, 8px);
    padding: 10px 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px;
}
.gstr9c-shell .tp-strip label { font-size: 11px; font-weight: 700; color: var(--c9-ink-2); display: block; text-transform: uppercase; }
.gstr9c-shell .tp-strip input, .gstr9c-shell .tp-strip select {
    width: 100%; border: 1px solid var(--c9-border); border-radius: 4px; padding: 6px 8px; font-size: 13px;
    background: var(--c9-surface-2); color: var(--c9-ink);
}

/* ---- part title + table card ---- */
.gstr9c-shell .part-title { background: var(--c9-blue); color: #fff; padding: 10px 14px; border-radius: 8px 8px 0 0; font-size: 15px; font-weight: 700; }
.gstr9c-shell .tbl-card { background: var(--c9-surface); border: 1px solid var(--c9-border); border-top: none; padding: 12px 14px 18px; margin-bottom: 18px; }
.gstr9c-shell .tbl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 8px; }
.gstr9c-shell .tbl-no { background: var(--c9-blue-dark); color: #fff; font-weight: 700; font-size: 13px; padding: 3px 10px; border-radius: 4px; }
.gstr9c-shell .tbl-title { font-weight: 600; font-size: 14px; color: var(--c9-blue-dark); flex: 1; }
.gstr9c-shell .tbl-badge { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.gstr9c-shell .tbl-badge.optional { background: var(--c9-computed-bg); color: var(--c9-amber); }
.gstr9c-shell .tbl-badge.newfy { background: var(--c9-auto-bg); color: var(--c9-green); }
.gstr9c-shell .help-icon {
    width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--c9-accent);
    background: var(--c9-surface); color: var(--c9-accent); font-weight: 800; font-size: 13px; line-height: 1; cursor: pointer; flex: 0 0 auto;
}
.gstr9c-shell .help-icon:hover { background: var(--c9-accent); color: #fff; }
.gstr9c-shell .gstr9c-table-card { margin-bottom: 0; border-radius: 0 0 var(--radius, 8px) var(--radius, 8px); }

/* ---- computation & validation ---- */
.gstr9c-shell .comp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; padding: 14px; }
.gstr9c-shell .comp-card { border: 1px solid var(--c9-border); border-left: 5px solid var(--c9-blue); border-radius: 6px; padding: 12px; background: var(--c9-surface); }
.gstr9c-shell .comp-card h4 { font-size: 12px; color: var(--c9-ink-3); text-transform: uppercase; margin-bottom: 6px; }
.gstr9c-shell .comp-card .val { font-size: 20px; font-weight: 700; font-family: Consolas, monospace; color: var(--c9-blue-dark); }
.gstr9c-shell .comp-card .val.pos { color: var(--c9-red); }
.gstr9c-shell .comp-card .val.ok { color: var(--c9-green); }
.gstr9c-shell .comp-card small { color: var(--c9-ink-3); }

.gstr9c-shell .vld-list { padding: 10px 14px 16px; }
.gstr9c-shell .vld-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 6px; margin-bottom: 6px; font-size: 13px; cursor: pointer; }
.gstr9c-shell .vld-item.err { background: #fdecea; color: var(--c9-red); }
.gstr9c-shell .vld-item.warn { background: #fef5e7; color: var(--c9-amber); }
.gstr9c-shell .vld-item.ok { background: #eafaf1; color: var(--c9-green); }
.gstr9c-shell .vld-item .tag { font-weight: 800; min-width: 52px; }

/* ---- bottom toolbar ---- */
.gstr9c-shell .gstr9c-bottombar { background: var(--c9-surface); border-top: 2px solid var(--c9-border); box-shadow: 0 -2px 10px rgba(0,0,0,.08); position: sticky; bottom: 0; z-index: 20; }
.gstr9c-shell .c9-btn.ghost2 { background: var(--c9-blue-light); color: var(--c9-blue-dark); font-size: 15px; padding: 6px 14px; }

/* ---- pill card (Basic/landing part cards) ---- */
.gstr9c-shell .card { border: 1px solid var(--c9-border); border-radius: 8px; box-shadow: 0 1px 2px rgba(20,32,54,.06); }

/* ============================================================
   Mobile responsive layer — native app feel
   Applies below 768 px. Scoped under .gstr9c-shell so it never
   leaks into other modules.
   ============================================================ */
@media (max-width: 768px) {

    /* sticky module topbar so save/validate stay reachable while scrolling
       tall reconciliation tables */
    .gstr9c-shell .sticky-head {
        position: sticky;
        top: 0;
        z-index: 20;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    }

    /* topbar: compress padding and let h1 take its own line */
    .gstr9c-shell .c9-topbar {
        padding: 8px 10px;
        gap: 6px;
        border-radius: 0;
    }
    .gstr9c-shell .c9-topbar h1 {
        font-size: 14px;
        flex-basis: 100%;
    }

    /* status box: spread fields in a row rather than column */
    .gstr9c-shell .c9-status-box {
        flex-basis: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px 16px;
        padding: 4px 8px;
    }
    .gstr9c-shell .c9-status-box div {
        flex: 1 1 auto;
    }

    /* every action button in the topbar: ≥44px touch target */
    .gstr9c-shell .c9-btn {
        min-height: 44px;
        font-size: 12px;
        padding: 6px 12px;
    }

    /* step bar: scrolls horizontally rather than wrapping into messy rows */
    .gstr9c-shell .c9-stepbar {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding: 6px 10px;
        -webkit-overflow-scrolling: touch;
    }
    .gstr9c-shell .c9-stepbtn {
        flex: 0 0 auto;
        min-width: 110px;
        min-height: 44px;
        font-size: 11px;
        padding: 4px 10px;
    }

    /* part title + description: compact, no border-radius collision */
    .gstr9c-shell .part-title {
        font-size: 13px;
        padding: 8px 10px;
        border-radius: 6px 6px 0 0;
    }
    .gstr9c-shell .part-desc {
        font-size: 12px;
        padding: 4px 10px;
        margin-bottom: 10px !important;
    }

    /* table card: tighter chrome */
    .gstr9c-shell .tbl-card {
        padding: 8px 8px 12px;
        margin-bottom: 12px;
    }
    .gstr9c-shell .tbl-head {
        gap: 6px;
        flex-wrap: wrap;
    }
    .gstr9c-shell .tbl-title {
        font-size: 13px;
        flex-basis: 100%;
    }

    /* SmartGrid host: horizontal scroll so wide reconciliation tables
       stay navigable on a phone without pushing the page width */
    .gstr9c-shell .grid-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .gstr9c-shell .grid-wrap .d-flex {
        min-width: 480px;
    }

    /* taxpayer strip: fields already auto-fit to 1 col on narrow viewports;
       give inputs a comfortable touch height */
    .gstr9c-shell .tp-strip {
        padding: 8px 10px;
        gap: 8px;
    }
    .gstr9c-shell .tp-strip input,
    .gstr9c-shell .tp-strip select {
        min-height: 40px;
        font-size: 14px;
    }

    /* bottombar: 44px touch targets, consistent wrapping */
    .gstr9c-shell .gstr9c-bottombar {
        gap: 0.35rem;
        padding: 0.5rem 0.5rem 0.6rem;
    }
    .gstr9c-shell .gstr9c-bottombar .c9-btn {
        min-height: 44px;
        font-size: 11.5px;
        padding: 5px 10px;
    }
}

/* very narrow phones: tighten one more notch */
@media (max-width: 380px) {
    .gstr9c-shell .c9-topbar h1 {
        font-size: 13px;
    }
    .gstr9c-shell .c9-stepbtn {
        min-width: 95px;
        font-size: 10.5px;
    }
    .gstr9c-shell .c9-btn {
        font-size: 11px;
        padding: 5px 9px;
    }
}
