/* ── Kiloway PPT Studio — global design system ─────────────────────────── */
:root {
    --brand-950: #04242D;
    --brand-900: #062B36;
    --brand-800: #0B3A4A;
    --brand-700: #124C5E;
    --brand-600: #0C7E92;
    --brand-500: #00A9C2;
    --brand-300: #7FDCEB;
    --brand-100: #E7F7FA;
    --surface: #FFFFFF;
    --surface-soft: #F5FAFB;
    --canvas: #F4F8F9;
    --text: #172A31;
    --text-soft: #4E6470;
    --muted: #74858C;
    --border: #E1EBEE;
    --border-strong: #CFDEE3;
    --success: #1F8A5B;
    --danger: #C0394B;
    --warning: #A76A12;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 4px 16px rgba(6, 43, 54, .05);
    --shadow-md: 0 18px 45px rgba(6, 43, 54, .07);
    --shadow-lg: 0 30px 80px rgba(6, 43, 54, .12);
    --font-ui: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "Segoe UI", sans-serif;
    --font-display: "SimSun", "Songti SC", "Noto Serif SC", serif;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--text);
    font-family: var(--font-ui);
    background:
        radial-gradient(900px 480px at 8% -8%, rgba(0, 169, 194, .10), transparent 60%),
        radial-gradient(760px 430px at 96% 4%, rgba(11, 58, 74, .07), transparent 62%),
        var(--canvas);
    -webkit-font-smoothing: antialiased;
}

main { flex: 1; }

::selection { background: rgba(0, 169, 194, .22); }

/* ── App shell ─────────────────────────────────────────────────────────── */
.app-navbar {
    background: rgba(6, 43, 54, .96);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(127, 220, 235, .12);
    padding: .58rem 0;
    position: sticky;
    top: 0;
    z-index: 1040;
}

.navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: .8rem;
    letter-spacing: -.02em;
    margin-right: 2rem;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(127, 220, 235, .18);
    border-radius: 10px;
    padding: .35rem .55rem;
}

.brand-mark img { height: 22px; width: auto; display: block; }

.brand-text {
    color: #fff;
    font-size: .98rem;
    font-weight: 700;
    letter-spacing: .02em;
}

.app-navbar .nav-link {
    color: rgba(255, 255, 255, .68);
    font-size: .82rem;
    font-weight: 500;
    padding: .42rem .7rem !important;
    border-radius: 999px;
    transition: background .18s ease, color .18s ease;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus,
.app-navbar .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, .08);
}

.app-navbar .nav-link.active {
    background: rgba(0, 169, 194, .18);
    box-shadow: inset 0 0 0 1px rgba(127, 220, 235, .18);
}

.app-navbar .navbar-toggler { border-color: rgba(255, 255, 255, .2); }
.app-navbar .navbar-toggler-icon { filter: invert(1); opacity: .8; }

.nav-divider {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, .16);
    margin: 0 .4rem;
}

.nav-cta {
    display: inline-flex;
    align-items: center;
    margin-left: .55rem;
    padding: .46rem .85rem;
    border-radius: 999px;
    color: var(--brand-950);
    background: linear-gradient(135deg, #8EE8F3, var(--brand-500));
    font-size: .8rem;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(0, 169, 194, .28);
    transition: transform .18s ease, box-shadow .18s ease;
}

.nav-cta:hover {
    color: var(--brand-950);
    transform: translateY(-1px);
    box-shadow: 0 9px 24px rgba(0, 169, 194, .4);
}

.app-footer {
    margin-top: 2.4rem;
    padding: 1rem 0;
    border-top: 1px solid rgba(11, 58, 74, .07);
    background: rgba(255, 255, 255, .55);
    color: var(--muted);
    font-size: .78rem;
}

/* ── Typography & page shell ───────────────────────────────────────────── */
.page-shell { padding-top: 1.8rem; padding-bottom: 2.4rem; }

.page-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin-bottom: .55rem;
    color: var(--brand-600);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.page-title {
    margin: 0;
    color: var(--brand-900);
    font-size: clamp(1.5rem, 2.3vw, 1.95rem);
    font-weight: 700;
    letter-spacing: -.03em;
}

.display-title {
    margin: 0;
    color: var(--brand-900);
    font-family: var(--font-display);
    font-size: clamp(1.9rem, 3.4vw, 2.85rem);
    font-weight: 700;
    letter-spacing: -.03em;
    line-height: 1.2;
}

.page-subtitle {
    margin: .5rem 0 0;
    max-width: 720px;
    color: var(--text-soft);
    font-size: .9rem;
    line-height: 1.65;
}

.section-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .75rem;
    color: var(--brand-800);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .06em;
}

.section-label::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border), transparent);
}

/* ── Cards, buttons, forms ─────────────────────────────────────────────── */
.card {
    border: 1px solid rgba(11, 58, 74, .07);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, .94);
    box-shadow: var(--shadow-md);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: .8rem 1rem;
}

.card-title { color: var(--brand-900); font-weight: 700; letter-spacing: -.02em; }
.card-body { padding: 1.15rem; }

.btn {
    border-radius: 999px;
    font-weight: 600;
    padding: .52rem .95rem;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.btn-sm { padding: .36rem .72rem; font-size: .78rem; }
.btn-lg { padding: .68rem 1.25rem; font-size: .92rem; }

.btn-primary {
    border: none;
    color: #fff;
    background: linear-gradient(135deg, var(--brand-800), var(--brand-600));
    box-shadow: 0 10px 24px rgba(11, 58, 74, .22);
}

.btn-primary:hover,
.btn-primary:focus {
    color: #fff;
    background: linear-gradient(135deg, var(--brand-900), var(--brand-700));
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(11, 58, 74, .28);
}

.btn-outline-secondary {
    color: var(--brand-800);
    border-color: var(--border-strong);
    background: rgba(255, 255, 255, .65);
}
.btn-outline-secondary:hover {
    color: var(--brand-900);
    border-color: var(--brand-500);
    background: var(--brand-100);
}
.btn-outline-primary { color: var(--brand-700); border-color: var(--brand-300); }
.btn-outline-primary:hover { background: var(--brand-100); color: var(--brand-900); border-color: var(--brand-500); }

.btn-success {
    border: none;
    background: linear-gradient(135deg, #1F8A5B, #34AE78);
    box-shadow: 0 10px 24px rgba(31, 138, 91, .2);
}

.btn i { line-height: 1; }
.form-label { color: var(--brand-800); font-weight: 700; font-size: .82rem; }

.form-control,
.form-select {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #FBFDFD;
    color: var(--text);
    padding: .58rem .78rem;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.form-control::placeholder { color: #9AA9AF; }
.form-control:focus,
.form-select:focus {
    border-color: var(--brand-500);
    background: #fff;
    box-shadow: 0 0 0 .22rem rgba(0, 169, 194, .12);
}

textarea.form-control-lg {
    font-size: .94rem;
    line-height: 1.6;
    border-radius: var(--radius-md);
    padding: .8rem .9rem;
    min-height: 108px;
}
textarea.form-control-lg:focus { border-color: var(--brand-500); box-shadow: 0 0 0 .22rem rgba(0, 169, 194, .12); }
.form-text { color: var(--muted); font-size: .78rem; }
.form-check-input:checked { background-color: var(--brand-600); border-color: var(--brand-600); }

/* ── Badges, alerts, utilities ─────────────────────────────────────────── */
.badge { font-weight: 600; letter-spacing: .02em; }
.badge.bg-secondary { background: #E8EFF2 !important; color: var(--text-soft) !important; }
.badge.bg-info { background: var(--brand-100) !important; color: var(--brand-700) !important; }
.badge.rounded-pill { padding: .38em .7em; }

.alert {
    border: none;
    border-radius: var(--radius-md);
    padding: .8rem .95rem;
    box-shadow: var(--shadow-sm);
}
.alert-danger { background: #FFF3F4; color: #A72C3D; }
.alert-warning { background: #FFFAEC; color: #8B5E12; }
.alert-info { background: var(--brand-100); color: var(--brand-800); }
.alert-success { background: #EDF9F2; color: #1B704A; }
.text-muted { color: var(--muted) !important; }

/* ── Home hero ─────────────────────────────────────────────────────────── */
.hero-shell { padding-top: 1.9rem; padding-bottom: 2.4rem; }

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(300px, .92fr);
    gap: 1.6rem;
    align-items: start;
}

.hero-copy { padding-top: .2rem; }

.hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .34rem .7rem;
    border: 1px solid rgba(0, 169, 194, .22);
    border-radius: 999px;
    background: rgba(231, 247, 250, .75);
    color: var(--brand-700);
    font-size: .72rem;
    font-weight: 700;
}

.hero-pills { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .9rem; }

.hero-pill {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .3rem .6rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .72);
    border: 1px solid var(--border);
    color: var(--text-soft);
    font-size: .72rem;
    font-weight: 600;
}
.hero-pill i { color: var(--brand-600); }

.prompt-card { position: relative; overflow: hidden; }
.prompt-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, var(--brand-500), rgba(127, 220, 235, .2));
}
.prompt-card h2 { font-size: .96rem; font-weight: 800; color: var(--brand-900); }

.chip-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.chip {
    border: 1px solid var(--border);
    background: #F8FCFD;
    color: var(--text-soft);
    border-radius: 999px;
    padding: .28rem .6rem;
    font-size: .7rem;
    cursor: pointer;
    transition: all .16s ease;
}
.chip:hover { border-color: var(--brand-300); color: var(--brand-700); background: var(--brand-100); }

.workflow-card { background: linear-gradient(180deg, #0B3A4A, #082C38); color: #fff; }
.workflow-card .card-body { padding: 1.2rem; }
.workflow-card h3 { font-size: .96rem; font-weight: 700; margin-bottom: .8rem; }
.workflow-step { display: flex; gap: .75rem; padding: .62rem 0; border-top: 1px solid rgba(255, 255, 255, .1); }
.workflow-step:first-of-type { border-top: 0; padding-top: 0; }
.workflow-num {
    width: 26px; height: 26px; flex: 0 0 26px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: rgba(127, 220, 235, .14);
    border: 1px solid rgba(127, 220, 235, .3);
    color: #B9F1F8;
    font-size: .68rem; font-weight: 800;
}
.workflow-step strong { display: block; font-size: .82rem; color: #EAFBFD; }
.workflow-step span { display: block; margin-top: .14rem; color: rgba(234, 251, 253, .62); font-size: .72rem; line-height: 1.5; }
.workflow-note {
    margin-top: .8rem; padding: .6rem .7rem;
    border-radius: var(--radius-sm);
    background: rgba(127, 220, 235, .08);
    color: rgba(234, 251, 253, .72);
    font-size: .7rem; line-height: 1.55;
}

.guide-list { display: grid; gap: .55rem; margin: 0; padding: 0; list-style: none; }
.guide-list li { display: flex; gap: .6rem; color: var(--text-soft); font-size: .8rem; line-height: 1.55; }
.guide-list i { color: var(--brand-500); margin-top: .1rem; }

/* ── Progress timeline (shared) ────────────────────────────────────────── */
.progress-step {
    display: flex;
    align-items: center;
    padding: .55rem 0;
    border-bottom: 1px solid #EFF4F5;
    transition: all .25s ease;
}
.progress-step:last-child { border-bottom: none; }
.step-icon {
    width: 26px; height: 26px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    margin-right: .65rem;
    flex-shrink: 0;
    font-size: 13px;
    transition: all .25s ease;
}
.step-text { font-size: .82rem; color: var(--muted); flex: 1; }
.step-running .step-icon { background: var(--brand-100); color: var(--brand-600); }
.step-running .step-text { color: var(--brand-800); font-weight: 700; }
.step-done .step-icon { background: #E9F8F0; color: var(--success); }
.step-done .step-text { color: var(--success); }
.step-error .step-icon { background: #FFF0F2; color: var(--danger); }
.step-error .step-text { color: var(--danger); }
.step-waiting { color: #B7C5CA; }
.step-hidden { color: #D8E2E6; }
.step-spinner { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

#loadingSpinner { border-radius: var(--radius-lg); background: var(--surface-soft); }

/* ── Chapter editor ────────────────────────────────────────────────────── */
.chapter-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: .75rem .9rem .8rem;
    margin-bottom: .55rem;
    background: #FBFDFD;
    transition: border-color .18s ease, background .18s ease;
}
.chapter-card:hover { border-color: var(--brand-300); background: #fff; }
.chapter-card .chapter-title { font-weight: 700; font-size: .86rem; color: var(--brand-800); margin-bottom: .4rem; }
.chapter-card textarea { font-size: .82rem; background: #fff; }

.input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (max-width: 768px) { .input-grid { grid-template-columns: 1fr; } }

/* ── Admin lists & tabs ────────────────────────────────────────────────── */
.list-group-item {
    border-color: var(--border);
    padding: .8rem 1rem;
    background: #fff;
}
.list-group-item:hover { background: #FBFDFD; }
.list-group-item code { color: var(--brand-600); background: var(--brand-100); padding: .12rem .35rem; border-radius: 5px; }

.nav-tabs { border-bottom-color: var(--border); }
.nav-tabs .nav-link {
    color: var(--text-soft);
    border: none;
    border-bottom: 2px solid transparent;
    font-weight: 700;
    font-size: .86rem;
}
.nav-tabs .nav-link.active {
    color: var(--brand-700);
    background: transparent;
    border-bottom-color: var(--brand-500);
}

/* ── Tables (history/admin) ────────────────────────────────────────────── */
.report-table { margin-bottom: 0; }
.report-table thead th {
    background: var(--surface-soft);
    color: var(--text-soft);
    font-size: .73rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    padding: .65rem .7rem;
    white-space: nowrap;
}
.report-table td { border-color: #EFF4F5; padding: .58rem .7rem; }
.report-table tbody tr:hover { background: #F7FCFD; }
.report-table .btn {
    width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0; border-radius: 10px; box-shadow: none;
}
.report-table .btn-success { background: #EDF9F2; color: #1B704A; }
.report-table .btn-success:hover { background: #DDF3E7; color: #145C3C; }
.report-table .btn-primary { background: var(--brand-100); color: var(--brand-700); }
.report-table .btn-primary:hover { background: #D6F1F6; color: var(--brand-800); }
.report-table .btn-outline-danger { border-color: #F0D6DA; color: #B34453; background: #FFF8F9; }
.report-table .btn-outline-danger:hover { background: #FDECEF; color: #982C3D; }

/* ── Scrollbars ────────────────────────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: #C7D7DC transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #C7D7DC; border-radius: 999px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ── Embed mode (iframe inside RFID intelligence system) ───────────────── */
html.ppt-embed header,
html.ppt-embed footer {
    display: none !important;
}

html.ppt-embed main {
    min-height: 100vh;
}

html.ppt-embed .hero-shell {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

html.ppt-embed .page-shell {
    padding-top: 1rem;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
    .hero-grid { grid-template-columns: 1fr; }
    .hero-shell { padding-top: 1.5rem; }
    .navbar-brand { margin-right: 1rem; }
    .nav-cta { margin: .4rem 0 0 .6rem; width: fit-content; }
}

@media (max-width: 575.98px) {
    .container, .container-xxl { padding-left: .9rem; padding-right: .9rem; }
    .card-body { padding: .95rem; }
    .step-text { font-size: .78rem; }
    .brand-text { display: none; }
}
