/* =====================================================================
   minesettings.css — ธีมกลางของหน้า "ตั้งค่า" ทั้งหมด (prefix st-*)
   ใช้คู่กับ <MineSettingsShell> / <MineSettingsNav> (Components/M_Components/MineSettings/)
   global (ไม่ scoped) เพราะ ChildContent ของ shell render ด้วย scope ของหน้าแม่
   โหลด static ใน App.razor (กัน FOUC ตอนสลับหน้า — เหมือน minelist.css)
   ===================================================================== */

.st-wrap {
    --st-teal: #0B7A75;
    --st-teal-2: #0f9a93;
    --st-teal-soft: #e7f5f4;
    --st-ink: #1c2530;
    --st-mute: #6b7684;
    --st-line: #e4e8ef;
    --st-bg: #f4f6f9;
    --st-warn: #b45309;
    --st-warn-soft: #fff6e8;
    --st-danger: #b42318;
    --st-danger-soft: #fdecea;
    --st-ok: #15803d;
    --st-ok-soft: #e8f6ee;
    font-family: 'IBM Plex Sans Thai', 'Sarabun', sans-serif;
    color: var(--st-ink);
    background: var(--st-bg);
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    min-height: 100%;
    box-sizing: border-box;
    padding: 0 0 48px;
}

    .st-wrap *, .st-wrap *::before, .st-wrap *::after {
        box-sizing: border-box;
    }

/* ---------- settings nav (แถบสลับหน้าตั้งค่า) ---------- */
.st-nav {
    position: sticky;
    top: 48px;
    z-index: 6;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 10px 20px 0;
    background: #fff;
    border-bottom: 1px solid var(--st-line);
    scrollbar-width: none;
    font-family: 'IBM Plex Sans Thai', 'Sarabun', sans-serif;
}

    /* หน้าที่มี topbar sticky ของตัวเอง (เช่น MineListShell — ชื่อหน่วย) ใช้แบบไม่ sticky กันซ้อนกัน */
    .st-nav.static {
        position: static;
    }

    .st-nav::-webkit-scrollbar {
        display: none;
    }

.st-nav-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 14px 11px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    font: inherit;
    font-size: 13.5px;
    color: var(--st-mute, #6b7684);
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
}

    .st-nav-item:hover {
        color: var(--st-ink, #1c2530);
    }

    .st-nav-item.active {
        color: var(--st-teal, #0B7A75);
        border-bottom-color: var(--st-teal, #0B7A75);
        font-weight: 600;
    }

    .st-nav-item svg {
        flex: 0 0 auto;
    }

/* ---------- header ---------- */
.st-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 20px 24px 6px;
}

.st-crumb {
    display: flex;
    gap: 6px;
    font-size: 12px;
    color: var(--st-mute);
}

.st-title {
    margin: 2px 0 0;
    font-size: 24px;
    font-weight: 700;
}

.st-subtitle {
    font-size: 13px;
    color: var(--st-mute);
    margin-top: 3px;
}

.st-headactions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.st-autosave {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--st-ok-soft);
    color: var(--st-ok);
    font-size: 12px;
    font-weight: 500;
}

    .st-autosave::before {
        content: "";
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: currentColor;
    }

/* ---------- body / layout ---------- */
.st-body {
    padding: 12px 24px 0;
}

.st-grid2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.st-withside {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.st-side {
    position: sticky;
    top: 110px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.st-side-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 13px;
    color: var(--st-mute);
    text-align: left;
    cursor: pointer;
}

    .st-side-link:hover {
        background: #eef1f5;
        color: var(--st-ink);
    }

    .st-side-link.active {
        background: var(--st-teal-soft);
        color: var(--st-teal);
        font-weight: 600;
    }

.st-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

/* ---------- summary chips ---------- */
.st-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.st-sumcard {
    background: #fff;
    border: 1px solid var(--st-line);
    border-radius: 12px;
    padding: 12px 14px;
}

.st-sumcard-k {
    font-size: 12px;
    color: var(--st-mute);
}

.st-sumcard-v {
    font-size: 16px;
    font-weight: 700;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ---------- card ---------- */
.st-card {
    background: #fff;
    border: 1px solid var(--st-line);
    border-radius: 14px;
    overflow: hidden;
    scroll-margin-top: 120px;
}

.st-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--st-line);
}

.st-card-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--st-teal-soft);
    color: var(--st-teal);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

    .st-card-icon.line {
        background: #e9f9ee;
        color: #06a13c;
    }

    .st-card-icon.warn {
        background: var(--st-warn-soft);
        color: var(--st-warn);
    }

    .st-card-icon.dark {
        background: #1c2530;
        color: #fff;
    }

.st-card-titles {
    flex: 1 1 auto;
    min-width: 0;
}

.st-card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.st-card-desc {
    font-size: 12.5px;
    color: var(--st-mute);
    margin-top: 1px;
}

.st-card-body {
    padding: 4px 18px;
}

.st-card-foot {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    padding: 12px 18px;
    border-top: 1px solid var(--st-line);
    background: #fbfcfd;
}

/* ---------- rows ---------- */
.st-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 0;
    border-top: 1px solid #f1f3f6;
}

    .st-row:first-child {
        border-top: 0;
    }

    .st-row.top {
        align-items: flex-start;
    }

    .st-row.stack {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .st-row.sub {
        padding-left: 14px;
    }

    .st-row.disabled {
        opacity: .55;
    }

.st-row-text {
    min-width: 0;
    flex: 1 1 auto;
}

.st-row-label {
    font-size: 14px;
    font-weight: 500;
}

.st-row-hint {
    font-size: 12.5px;
    color: var(--st-mute);
    margin-top: 2px;
}

.st-row-control {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

    /* ช่องกรอกกว้างตามจอ (สูงสุด ~58% ของการ์ด / 720px) — หน้าเต็มความกว้างไม่เหลือที่ว่างขวา */
    .st-row-control.grow {
        flex: 0 1 min(720px, 58%);
        min-width: 0;
        justify-content: stretch;
    }

        .st-row-control.grow > * {
            flex: 1 1 auto;
            min-width: 0;
        }

.st-tag {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 7px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background: #eef1f5;
    color: var(--st-mute);
    margin-left: 6px;
    vertical-align: middle;
}

    .st-tag.ok {
        background: var(--st-ok-soft);
        color: var(--st-ok);
    }

    .st-tag.off {
        background: #f1f3f6;
        color: #8a94a3;
    }

    .st-tag.warn {
        background: var(--st-warn-soft);
        color: var(--st-warn);
    }

    .st-tag.danger {
        background: var(--st-danger-soft);
        color: var(--st-danger);
    }

    .st-tag.info {
        background: #eef0fb;
        color: #4f46e5;
    }

/* ---------- inputs ---------- */
.st-input, .st-select, .st-textarea {
    height: 36px;
    width: 100%;
    border: 1px solid var(--st-line);
    border-radius: 9px;
    padding: 0 11px;
    font: inherit;
    font-size: 13.5px;
    color: var(--st-ink);
    background: #fff;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.st-textarea {
    height: auto;
    min-height: 80px;
    padding: 9px 11px;
    resize: vertical;
    line-height: 1.5;
}

    .st-input:focus, .st-select:focus, .st-textarea:focus {
        border-color: var(--st-teal);
        box-shadow: 0 0 0 3px rgba(11, 122, 117, .12);
    }

    .st-input:disabled, .st-select:disabled {
        background: #f6f7f9;
        color: var(--st-mute);
    }

.st-input.mono {
    font-family: 'IBM Plex Mono', Consolas, monospace;
    font-size: 12.5px;
}

.st-input.num {
    width: 72px;
    text-align: center;
    padding: 0 6px;
}

.st-select.num {
    width: 76px;
}

.st-unit {
    font-size: 13px;
    color: var(--st-mute);
}

.st-secret {
    position: relative;
    display: flex;
    width: 100%;
}

    .st-secret .st-input {
        padding-right: 58px;
    }

.st-secret-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    height: 28px;
    padding: 0 8px;
    border: 0;
    border-radius: 6px;
    background: #f1f3f6;
    color: var(--st-mute);
    font: inherit;
    font-size: 11.5px;
    cursor: pointer;
}

    .st-secret-btn:hover {
        color: var(--st-teal);
    }

/* segmented radio */
.st-seg {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    background: #f1f3f6;
    border-radius: 10px;
    padding: 3px;
}

    .st-seg button {
        border: 0;
        background: transparent;
        padding: 7px 12px;
        border-radius: 8px;
        font: inherit;
        font-size: 12.5px;
        color: var(--st-mute);
        cursor: pointer;
    }

        .st-seg button.active {
            background: #fff;
            color: var(--st-teal);
            font-weight: 600;
            box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
        }

/* ---------- buttons ---------- */
.st-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border-radius: 9px;
    border: 1px solid var(--st-line);
    background: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--st-ink);
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
}

    .st-btn:hover:not(:disabled) {
        border-color: #c9d3de;
    }

    .st-btn:disabled {
        opacity: .5;
        cursor: not-allowed;
    }

.st-btn-sm {
    height: 30px;
    padding: 0 11px;
    font-size: 12.5px;
}

.st-btn-primary {
    background: var(--st-teal);
    border-color: var(--st-teal);
    color: #fff;
}

    .st-btn-primary:hover:not(:disabled) {
        background: var(--st-teal-2);
        border-color: var(--st-teal-2);
    }

.st-btn-danger {
    color: var(--st-danger);
}

    .st-btn-danger:hover:not(:disabled) {
        border-color: #f1b7b1;
        background: var(--st-danger-soft);
    }

.st-btn-ghost {
    border-color: transparent;
    background: transparent;
    color: var(--st-teal);
}

.st-linkbtn {
    border: 0;
    background: transparent;
    color: var(--st-teal);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 4px;
}

    .st-linkbtn:hover {
        text-decoration: underline;
    }

/* ---------- notices ---------- */
.st-note {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 12px;
    margin: 10px 0;
    border-radius: 10px;
    background: #f4f8fb;
    border: 1px solid #e1e9f1;
    font-size: 12.5px;
    color: #4a5868;
    line-height: 1.55;
}

    .st-note.warn {
        background: var(--st-warn-soft);
        border-color: #f6d9a8;
        color: #7a4800;
    }

    .st-note.ok {
        background: var(--st-ok-soft);
        border-color: #c6e7d5;
        color: #1f6b47;
    }

    .st-note ul {
        margin: 0;
        padding-left: 18px;
    }

.st-note-icon {
    flex: 0 0 auto;
    font-size: 14px;
    line-height: 1.4;
}

.st-banner {
    margin: 12px 24px 0;
}

/* ---------- list rows (บัญชีรับเงิน / แบบฟอร์ม ฯลฯ) ---------- */
.st-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 0;
}

.st-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid var(--st-line);
    border-radius: 12px;
    background: #fff;
}

    .st-item.active {
        border-color: var(--st-teal);
        box-shadow: 0 0 0 3px rgba(11, 122, 117, .10);
    }

    .st-item.muted {
        background: #fafbfc;
    }

.st-item-main {
    flex: 1 1 auto;
    min-width: 0;
}

.st-item-title {
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.st-item-sub {
    font-size: 12.5px;
    color: var(--st-mute);
    margin-top: 2px;
}

.st-item-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
}

.st-empty {
    padding: 28px 12px;
    text-align: center;
    color: var(--st-mute);
    font-size: 13px;
    border: 1px dashed var(--st-line);
    border-radius: 12px;
}

/* ---------- progress ---------- */
.st-prog {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 0;
    border-top: 1px solid #f1f3f6;
}

    .st-prog:first-child {
        border-top: 0;
    }

.st-prog-label {
    flex: 0 0 190px;
    font-size: 13.5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.st-prog-bar {
    flex: 1 1 auto;
    height: 8px;
    border-radius: 8px;
    background: #eef1f5;
    overflow: hidden;
}

    .st-prog-bar span {
        display: block;
        height: 100%;
        border-radius: 8px;
        transition: width .3s ease;
    }

.st-prog-pct {
    flex: 0 0 44px;
    text-align: right;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 600;
}

.st-prog-count {
    flex: 0 0 120px;
    text-align: right;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11.5px;
    color: var(--st-mute);
}

/* pill toggle (บังคับ sync รอบถัดไป) */
.st-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.st-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--st-line);
    background: #fff;
    font: inherit;
    font-size: 12.5px;
    color: var(--st-ink);
    cursor: pointer;
}

    .st-pill::before {
        content: "";
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #cbd5e1;
    }

    .st-pill.on {
        border-color: var(--st-teal);
        background: var(--st-teal-soft);
        color: var(--st-teal);
        font-weight: 600;
    }

        .st-pill.on::before {
            background: var(--st-teal);
        }

/* big stat */
.st-bigstat {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 28px;
    font-weight: 600;
    color: var(--st-teal);
    letter-spacing: 1px;
}

/* ---------- field table (การสมัครสมาชิก) ---------- */
.st-ftable {
    width: 100%;
    border-collapse: collapse;
    margin: 6px 0;
}

    .st-ftable th {
        font-size: 12px;
        font-weight: 600;
        color: var(--st-mute);
        text-align: center;
        padding: 10px 8px;
        border-bottom: 1px solid var(--st-line);
    }

        .st-ftable th:first-child {
            text-align: left;
        }

    .st-ftable td {
        padding: 12px 8px;
        border-bottom: 1px solid #f1f3f6;
        text-align: center;
        font-size: 14px;
    }

        .st-ftable td:first-child {
            text-align: left;
        }

    .st-ftable tr:last-child td {
        border-bottom: 0;
    }

.st-dash {
    color: #b8c1cc;
}

/* ---------- toast ---------- */
.st-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 60;
    display: flex;
    gap: 8px;
    align-items: center;
    max-width: calc(100vw - 48px);
    background: #1c2530;
    color: #fff;
    padding: 10px 16px;
    border-radius: 10px;
    font-family: 'IBM Plex Sans Thai', sans-serif;
    font-size: 13.5px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}

    .st-toast .ico {
        color: #5eead4;
        font-weight: 700;
    }

    .st-toast.err .ico {
        color: #fca5a5;
    }

/* ---------- modal ---------- */
.st-overlay {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(15, 23, 32, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.st-modal {
    width: min(440px, 100%);
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    font-family: 'IBM Plex Sans Thai', sans-serif;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}

.st-modal-head {
    padding: 16px 18px 6px;
    font-size: 16px;
    font-weight: 700;
}

.st-modal-body {
    padding: 6px 18px 14px;
    font-size: 13.5px;
    color: #4a5868;
}

.st-modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px;
    background: #fbfcfd;
    border-top: 1px solid var(--st-line);
}

/* ---------- rich editor card + แถบบันทึก (หมวด "ปรับแต่งเว็บไซต์") ---------- */
/* .st-card.open = ไม่ตัด overflow เพื่อให้ position:sticky ภายในการ์ด (แถบบันทึก / toolbar ของ editor) ทำงาน */
.st-card.open {
    overflow: visible;
}

.st-editor {
    background: #fff;
    min-width: 0;
}

.st-savebar {
    position: sticky;
    bottom: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 18px;
    background: #fbfcfd;
    border-top: 1px solid var(--st-line);
    border-radius: 0 0 14px 14px;
}

.st-savebar-hint {
    font-size: 12.5px;
    color: var(--st-mute);
}

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
    .st-grid2, .st-withside {
        grid-template-columns: minmax(0, 1fr);
    }

    .st-side {
        position: static;
        flex-direction: row;
        overflow-x: auto;
        gap: 4px;
    }

    .st-side-link {
        white-space: nowrap;
    }
}

/* Tablet */
@media (max-width: 1000px) {
    .st-head, .st-body {
        padding-left: 16px;
        padding-right: 16px;
    }

    .st-banner {
        margin-left: 16px;
        margin-right: 16px;
    }

    .st-row-control.grow {
        flex-basis: 60%;
    }
}

/* header ของ BackEndMainLayout สูง 50px ที่ ≤768 (ShowZone padding-top: 50px) */
@media (max-width: 768px) {
    .st-nav {
        top: 50px;
    }
}

/* Mobile */
@media (max-width: 640px) {
    .st-nav {
        padding: 6px 10px 0;
    }

    .st-head, .st-body {
        padding-left: 12px;
        padding-right: 12px;
    }

    .st-banner {
        margin-left: 12px;
        margin-right: 12px;
    }

    .st-card-body {
        padding: 4px 14px;
    }

    .st-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .st-row-control, .st-row-control.grow {
        justify-content: flex-start;
        flex: 1 1 auto;
    }

    .st-item {
        flex-wrap: wrap;
    }

    .st-item-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .st-prog {
        flex-wrap: wrap;
    }

    .st-prog-label {
        flex: 1 1 100%;
    }

    .st-prog-count {
        flex: 0 0 auto;
    }

    .st-toast {
        left: 12px;
        right: 12px;
    }
}
