/*
 * Giao diện "JAF Product Studio" (layout studio + trang Quản lý Style).
 * Mobile-first; nạp sau bootstrap.min.css và app.css.
 * Breakpoint: 576 (sm) · 768 (md) · 992 (lg: hiện sidebar cố định) · 1200 (xl)
 */

:root {
    --studio-ink: #262b28;
    --studio-text: #4a5048;
    --studio-muted: #73796f;
    --studio-soft-muted: #9a9e96;
    --studio-line: #e9e9e4;
    --studio-line-soft: #efefea;
    --studio-paper: #fbfbf9;
    --studio-surface: #fff;
    --studio-surface-hover: #f7f8f5;
    --studio-green: #61785c;
    --studio-green-dark: #465b43;
    --studio-green-darker: #374934;
    --studio-green-soft: #edf1e9;
    --studio-amber: #aa805d;
    --studio-amber-soft: #f7f0e8;
    --studio-danger: #a4513c;
    --studio-danger-soft: #f8ece8;
    --studio-focus-ring: #9bb18d;
    --studio-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --studio-sidebar-width: 220px;
}

/* ---------- Nền tảng ---------- */
.studio-body {
    margin: 0;
    background: var(--studio-paper);
    color: var(--studio-ink);
    font-family: var(--studio-sans);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

.studio-body button,
.studio-body input,
.studio-body select { font: inherit; }
.studio-body button,
.studio-body a { -webkit-tap-highlight-color: transparent; }
.studio-body a { color: inherit; text-decoration: none; }
.studio-body :focus-visible { outline: 3px solid var(--studio-focus-ring); outline-offset: 2px; }
.studio-body h1, .studio-body h2, .studio-body h3 { color: var(--studio-ink); }
.studio-body [hidden] { display: none !important; }

.studio-skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 1100;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--studio-green-dark);
    color: #fff !important;
}

.app-shell { min-height: 100vh; }
.main-column { min-width: 0; }
/* Bố cục tập trung: không sidebar, breadcrumb ở giữa thanh trên */
.topbar-back-link { display: inline-flex; min-height: 40px; align-items: center; gap: 6px; padding-right: 8px; color: #4f554d; font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.topbar-back-link:hover { color: var(--studio-green-dark); }
.app-shell-focused .breadcrumb-trail { display: none; }

/* ---------- Topbar ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: 62px;
    padding: 0 16px;
    border-bottom: 1px solid #ecece7;
    background: rgba(255, 255, 255, .9);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.topbar-start { min-width: 0; display: flex; align-items: center; gap: 8px; }
.topbar-icon-button {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--studio-text);
    cursor: pointer;
}
.topbar-icon-button:hover { background: var(--studio-surface-hover); }
.breadcrumb-trail { min-width: 0; display: flex; align-items: center; gap: 8px; color: var(--studio-soft-muted); font-size: 13px; white-space: nowrap; }
.breadcrumb-trail > * { flex: 0 0 auto; }
.breadcrumb-trail svg { color: #b9bdb7; }
.breadcrumb-trail a:hover { color: var(--studio-green-dark); }
.breadcrumb-trail strong { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; color: #424741; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.workspace-pill { display: none; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid #ecece7; border-radius: 7px; color: var(--studio-muted); font-size: 12px; }
.workspace-pill span { width: 7px; height: 7px; border-radius: 50%; background: #76936c; box-shadow: 0 0 0 3px #edf2e9; }
.language-switch { display: flex; align-items: center; gap: 2px; margin: 0; padding: 3px; border: 1px solid var(--studio-line); border-radius: 8px; background: #fafaf8; }
.language-switch button { min-width: 40px; height: 36px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: #7c8179; cursor: pointer; font-size: 12px; font-weight: 700; }
.language-switch button:hover { color: var(--studio-green-dark); }
.language-switch button.selected { background: #fff; color: #3c4939; box-shadow: 0 1px 4px #27321a14; }
.topbar-avatar { width: 34px; height: 34px; display: none; place-items: center; border-radius: 50%; background: #e9dfd1; color: #74614b; font-size: 11px; font-weight: 700; }

/* ---------- Sidebar (offcanvas trên mobile, cố định từ lg) ---------- */
.sidebar { --bs-offcanvas-width: 280px; }
.sidebar-inner {
    width: 100%;
    height: 100%;
    padding: 18px 14px 14px;
    overflow-y: auto;
    background: var(--studio-surface);
    display: flex;
    flex-direction: column;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 0 22px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px; border-radius: 10px; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px 10px 10px 3px; background: var(--studio-green-dark); color: #fff; font-size: 20px; font-weight: 600; }
.brand-copy { display: flex; flex-direction: column; gap: 1px; }
.brand-copy strong { font-size: 16px; letter-spacing: .35px; }
.brand-copy small { color: var(--studio-soft-muted); font-size: 10px; letter-spacing: 1.25px; }
.sidebar-label { padding: 0 10px; color: var(--studio-soft-muted); font-size: 11px; font-weight: 700; letter-spacing: 1.1px; text-transform: uppercase; }
.teams-label { margin-top: 24px; }
.primary-nav,
.team-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.studio-nav-item,
.team-nav-item {
    min-height: 44px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 7px;
    color: var(--studio-muted);
    font-size: 14px;
    transition: background .15s, color .15s;
}
.studio-nav-item:hover,
.team-nav-item:hover { background: var(--studio-surface-hover); color: var(--studio-green-dark); }
.studio-nav-item.active,
.team-nav-item.active { background: var(--studio-green-soft); color: #485d43; font-weight: 600; }
.nav-count { min-width: 24px; margin-left: auto; padding: 3px 6px; border-radius: 5px; background: #fff; color: #73806d; text-align: center; font-size: 12px; }
.team-nav-item { min-height: 42px; font-size: 13px; }
.team-dot { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; background: #f0f1ec; color: #74806c; }
.team-chevron { margin-left: auto; color: #b5b8b1; }
.sidebar-bottom { min-height: 56px; display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 12px 6px 0; border-top: 1px solid #ededea; }
.user-avatar { width: 32px; height: 32px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: #e9dfd1; color: #74614b; font-size: 11px; font-weight: 700; }
.user-copy { display: flex; flex-direction: column; gap: 2px; }
.user-copy strong { color: #454b44; font-size: 13px; font-weight: 600; }
.user-copy span { color: var(--studio-soft-muted); font-size: 11px; }

/* Bảng màu icon phòng ban (dùng chung sidebar, tổng quan, trang chi tiết) */
.team-dot-1, .department-icon-1 { background: #f2eee7; color: #8a7b62; }
.team-dot-2, .department-icon-2 { background: #edf0f0; color: #687c7d; }
.team-dot-3, .department-icon-3 { background: #f4eeeb; color: #9b7564; }
.team-dot-4, .department-icon-4 { background: #edf1e9; color: #6b8263; }
.team-dot-5, .department-icon-5 { background: #f0eee9; color: #87785f; }
.team-dot-6, .department-icon-6 { background: #eef0ec; color: #718074; }

/* ---------- Nội dung trang ---------- */
.page-content { width: min(100%, 1440px); margin: 0 auto; padding: 28px 16px 0; outline: 0; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 28px; }
.eyebrow { display: flex; align-items: center; gap: 8px; color: #6e7766; font-size: 11px; font-weight: 700; line-height: 1.4; letter-spacing: 1.5px; text-transform: uppercase; }
.eyebrow-line { display: inline-block; width: 17px; height: 1px; flex: 0 0 auto; background: #87947f; }
.page-heading h1 { margin: 9px 0 6px; font-size: clamp(30px, 7vw, 40px); font-weight: 500; letter-spacing: -1.6px; line-height: 1.15; overflow-wrap: anywhere; }
.title-period { color: #89997e; }
.page-heading p { margin: 0; color: var(--studio-muted); font-size: 14px; line-height: 1.6; }

.button {
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background .15s, border-color .15s, color .15s, transform .15s;
}
.button:active { transform: translateY(1px); }
.button:disabled { opacity: .65; cursor: progress; }
.button-primary { background: var(--studio-green-dark); color: #fff; }
.button-primary:hover { background: var(--studio-green-darker); color: #fff; }
.button-secondary { border-color: #e2e3dd; background: #fff; color: #4f554d; }
.button-secondary:hover { background: #f6f6f3; }
.button-danger { background: var(--studio-danger); color: #fff; }
.button-danger:hover { background: #8a412f; color: #fff; }
.button-danger-soft { border-color: #f0dcd5; background: var(--studio-danger-soft); color: var(--studio-danger); }
.button-danger-soft:hover { border-color: #e6c4b9; background: #f4e1db; }
.page-heading > .add-button { display: none; }
.add-button-mobile { min-width: 44px; padding: 0 12px; }
.add-button-mobile svg { flex-shrink: 0; }

.text-link { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 0; border: 0; background: transparent; color: #5d6d56; font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.text-link:hover { color: #364734; }

/* ---------- Tổng quan ---------- */
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.section-heading h2 { margin: 0 0 4px; font-size: 18px; font-weight: 600; letter-spacing: -.4px; }
.section-heading p { margin: 0; color: var(--studio-muted); font-size: 13px; }
.department-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.department-card {
    min-height: 78px;
    padding: 12px 10px;
    border: 1px solid #ecece7;
    border-radius: 10px;
    background: #fff;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    grid-template-rows: 1fr 1fr;
    align-items: center;
    column-gap: 10px;
    transition: border-color .15s, transform .15s, box-shadow .15s;
}
.department-card:hover { border-color: #d6ddcf; transform: translateY(-1px); }
.department-card.active { border-color: #a8b79c; box-shadow: 0 0 0 3px var(--studio-green-soft); }
.department-icon { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; grid-row: 1 / 3; border-radius: 9px; background: #f0f1ec; color: #74806c; }
.department-card > strong { align-self: end; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
.department-status { align-self: start; display: flex; align-items: center; gap: 6px; margin-top: 3px; overflow: hidden; color: var(--studio-muted); font-size: 12px; white-space: nowrap; }
.status-dot { width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: #d2d2c9; }
.status-dot-active { background: #d3a476; box-shadow: 0 0 0 3px var(--studio-amber-soft); }

.metrics-grid { display: grid; grid-template-columns: 1fr; gap: 9px; margin: 18px 0 36px; }
.metric-card { min-height: 80px; padding: 14px; border: 1px solid #ecece7; border-radius: 10px; background: #fff; display: flex; align-items: center; gap: 12px; }
.metric-icon { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; }
.metric-icon-lilac { background: #f0eef4; color: #79708f; }
.metric-icon-peach { background: #f5efeb; color: #a07965; }
.metric-icon-green { background: var(--studio-green-soft); color: #68805f; }
.metric-card > div { display: flex; flex: 1; flex-direction: column; gap: 5px; }
.metric-card > div span { color: var(--studio-muted); font-size: 13px; }
.metric-card > div strong { font-size: 22px; font-weight: 600; line-height: 1; }
.metric-note { max-width: 110px; color: var(--studio-soft-muted); font-size: 12px; text-align: right; }

/* ---------- Thư viện style ---------- */
.styles-section { padding-top: 24px; border-top: 1px solid var(--studio-line); scroll-margin-top: 76px; }
.styles-heading { display: flex; flex-direction: column; align-items: stretch; gap: 14px; }
.styles-title-row { display: flex; align-items: center; gap: 10px; margin-top: 7px; }
.styles-title-row h2 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.6px; }
.styles-total { min-width: 28px; padding: 4px 7px; border-radius: 6px; background: #efefe9; color: #6d7369; text-align: center; font-size: 12px; font-weight: 600; }
.style-controls { display: flex; align-items: center; gap: 8px; }
.search-field { flex: 1; min-width: 0; height: 44px; padding: 0 6px 0 4px; border: 1px solid #e3e4de; border-radius: 8px; background: #fff; display: flex; align-items: center; gap: 4px; color: #8d928a; }
.search-field:focus-within { border-color: #b8c3b0; box-shadow: 0 0 0 3px #e9eee5; }
.search-field-icon { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; margin: 0; cursor: text; }
.search-field input { width: 100%; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: transparent; color: var(--studio-ink); font-size: 14px; }
.search-field input::placeholder { color: #9fa39c; }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-field kbd { display: none; min-width: 22px; margin-right: 4px; padding: 2px 6px; border: 1px solid #e6e6e2; border-radius: 4px; background: transparent; color: #8f938c; text-align: center; font-size: 12px; box-shadow: none; }
.clear-search { width: 36px; height: 36px; flex: 0 0 auto; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #6e736b; display: grid; place-items: center; cursor: pointer; }
.clear-search:hover { background: #f4f4f1; }

.results-caption { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 16px 0 12px; color: var(--studio-muted); font-size: 13px; }
.results-caption strong { color: #4b5149; font-weight: 600; }
.filter-chip { min-height: 32px; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid #d6ddcf; border-radius: 999px; background: var(--studio-green-soft); color: #485d43; font-size: 12px; font-weight: 600; cursor: pointer; }
.filter-chip:hover { background: #e2e9dc; }

.style-card-grid-container { transition: opacity .15s; }
.style-card-grid-container.is-loading { opacity: .55; pointer-events: none; }
.style-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.style-card { position: relative; overflow: hidden; border: 1px solid #e9e9e3; border-radius: 10px; background: #fff; transition: box-shadow .18s, transform .18s, border-color .18s; }
.style-card:hover { transform: translateY(-2px); border-color: #dcdfd6; box-shadow: 0 8px 22px #30391f0c; }
.style-card:focus-within { border-color: #a8b79c; }
.card-image-wrap { position: relative; overflow: hidden; }
.product-art { position: relative; height: 190px; overflow: hidden; }
.product-art svg { width: 100%; height: 100%; }
.art-label { position: absolute; right: 12px; bottom: 10px; color: #5d5e52; opacity: .6; font-size: 10px; letter-spacing: 1.2px; }
.image-index { position: absolute; top: 11px; left: 12px; padding: 5px 8px; border: 1px solid #ffffffad; border-radius: 5px; background: #ffffffb8; color: #4f534a; font-size: 12px; font-weight: 600; backdrop-filter: blur(8px); }
.image-index span { padding: 0 2px; color: #a6a89f; }
.card-arrow { position: absolute; top: 9px; right: 9px; width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid #ffffffad; border-radius: 50%; background: #ffffffb8; color: #596253; transition: background .15s, color .15s; }
.card-arrow:hover,
.style-card:hover .card-arrow { background: var(--studio-green-dark); color: #fff; }
.style-card-body { padding: 14px; }
.style-card-link:focus-visible { outline: none; }
.style-card-link:focus-visible::after { border-radius: 10px; outline: 2px solid var(--studio-focus-ring); outline-offset: -2px; }
.card-customer-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.customer-name { overflow: hidden; color: #3e443d; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 700; }
.round-pill { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 5px; padding: 4px 8px; border: 1px solid #e6e7e1; border-radius: 6px; color: var(--studio-muted); font-size: 12px; }
.style-number { margin-top: 6px; color: #858a82; font-size: 12px; letter-spacing: .4px; }
.style-card-body h3 { min-height: 20px; margin: 6px 0 0; overflow: hidden; color: #353b35; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 500; }
.card-divider { height: 1px; margin: 13px 0 10px; background: var(--studio-line-soft); }
.card-progress-heading { display: flex; justify-content: space-between; color: var(--studio-muted); font-size: 12px; }
.card-progress-heading span:last-child { color: #5d645a; font-weight: 600; }
.progress-track { display: flex; gap: 4px; margin-top: 8px; }
.progress-segment { height: 4px; flex: 1; border-radius: 2px; background: #ecece8; }
.segment-done { background: #718568; }
.segment-progress { background: #d3a476; }
/* Nằm trên stretched-link để vẫn xem được tooltip từng phòng ban */
.card-departments { position: relative; z-index: 2; display: flex; justify-content: space-between; gap: 4px; margin: 11px 0 0; padding: 0; list-style: none; }
.mini-department { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px; }
.mini-done { background: #edf2e9; color: #677e5f; }
.mini-progress { background: var(--studio-amber-soft); color: var(--studio-amber); }
.mini-waiting { background: #f4f4f1; color: #a9aca5; }

.empty-state { min-height: 240px; padding: 40px 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px dashed #dedfd8; border-radius: 10px; text-align: center; }
.empty-icon { width: 48px; height: 48px; border-radius: 50%; background: #f0f1ec; color: #818a78; display: grid; place-items: center; }
.empty-state h3 { margin: 15px 0 6px; font-size: 18px; font-weight: 600; }
.empty-state p { max-width: 320px; margin: 0; color: var(--studio-muted); font-size: 13px; line-height: 1.6; }
.empty-state .text-link { margin-top: 10px; }

.studio-pagination { margin-top: 24px; }
.studio-pagination nav { display: flex; justify-content: center; }
.studio-pagination nav > div { gap: 8px; }
.studio-pagination .pagination {
    --bs-pagination-color: var(--studio-green-dark);
    --bs-pagination-hover-color: var(--studio-green-darker);
    --bs-pagination-hover-bg: var(--studio-surface-hover);
    --bs-pagination-focus-color: var(--studio-green-darker);
    --bs-pagination-focus-bg: var(--studio-surface-hover);
    --bs-pagination-focus-box-shadow: 0 0 0 3px #e3eadc;
    --bs-pagination-active-bg: var(--studio-green-dark);
    --bs-pagination-active-border-color: var(--studio-green-dark);
    --bs-pagination-border-color: var(--studio-line);
    --bs-pagination-font-size: 14px;
    margin-bottom: 0;
}
.studio-pagination .page-link { display: flex; align-items: center; justify-content: center; min-width: 44px; }
.studio-pagination p.small { color: var(--studio-muted); }

.page-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 36px; padding: 16px 0 24px; border-top: 1px solid #ebebe6; color: var(--studio-soft-muted); font-size: 11px; letter-spacing: .8px; }
.footer-star { padding-left: 4px; color: #87977c; font-size: 13px; }

/* ---------- Modal (dựa trên Bootstrap modal) ---------- */
.modal-backdrop.show { --bs-backdrop-bg: #252a25; --bs-backdrop-opacity: .6; }
.style-modal-dialog { max-width: 480px; }
.style-modal { padding: 22px; border: 1px solid var(--studio-line); border-radius: 14px; background: #fff; box-shadow: 0 24px 80px #12170f35; color: var(--studio-ink); font-family: var(--studio-sans); }
.modal-topline { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: var(--studio-green-soft); color: var(--studio-green); }
.modal-icon-danger { background: var(--studio-danger-soft); color: var(--studio-danger); }
.modal-close { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid #ededeb; border-radius: 9px; background: #fff; color: #6f746c; cursor: pointer; }
.modal-close:hover { background: #f7f7f4; }
.style-modal-title { margin: 8px 0 6px; font-size: 26px; font-weight: 600; letter-spacing: -.9px; }
.modal-description { margin: 0 0 18px; color: var(--studio-muted); font-size: 14px; line-height: 1.6; }
.style-editor-form { display: flex; flex-direction: column; gap: 14px; }
.studio-field { position: relative; display: flex; min-width: 0; flex-direction: column; gap: 6px; }
.studio-field > label { margin: 0; color: #4f554d; font-size: 13px; font-weight: 600; }
.studio-field input,
.studio-field select {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid #e0e1db;
    border-radius: 8px;
    outline: 0;
    background: #fff;
    color: #333a33;
    font-size: 16px; /* >= 16px để iOS không tự phóng to khi focus */
    font-weight: 400;
}
.studio-field input::placeholder { color: #a5a8a1; }
.studio-field input:focus,
.studio-field select:focus { border-color: #a8b79c; box-shadow: 0 0 0 3px var(--studio-green-soft); }
.studio-field .is-invalid { border-color: #c27a64; }
.studio-field .is-invalid:focus { box-shadow: 0 0 0 3px #f6e3dd; }
.studio-field .invalid-feedback { margin-top: 0; color: var(--studio-danger); font-size: 13px; }
.studio-field-hint { color: var(--studio-soft-muted); font-size: 12px; }
.studio-field .is-invalid ~ .studio-field-hint { display: none; }
.style-code-input { text-transform: uppercase; letter-spacing: .4px; }
.style-code-input::placeholder { text-transform: none; letter-spacing: 0; }
/* Nhóm thông tin sản xuất (PO, mùa vụ, vải, nhà máy) */
.studio-fieldset { display: flex; min-width: 0; flex-direction: column; gap: 14px; margin: 0; padding: 14px 0 0; border: 0; border-top: 1px solid var(--studio-line-soft); }
.studio-fieldset-legend { float: left; width: 100%; margin: 0; padding: 0; color: var(--studio-ink); font-size: 13px; font-weight: 700; }
.studio-select-wrap { position: relative; display: flex; flex-direction: column; gap: 6px; }
.studio-field select { padding-right: 36px; appearance: none; cursor: pointer; }
.select-chevron { position: absolute; top: 14px; right: 12px; color: #80867d; pointer-events: none; }
.studio-field-row { display: grid; grid-template-columns: 1fr; gap: 14px; }
.required { margin-left: 3px; color: #b46b55; }
.optional-label { margin-left: 5px; color: var(--studio-soft-muted); font-weight: 400; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 6px; padding-top: 16px; border-top: 1px solid var(--studio-line-soft); }

/* ---------- Trang chi tiết ---------- */
.back-link { margin: -8px 0 12px; }
.style-detail-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
/* Con của khối tóm tắt tham gia trực tiếp vào lưới (tiêu đề trải ngang, thẻ thông tin bên trái) */
.style-detail-summary-container { display: contents; }
.detail-heading { flex-wrap: wrap; margin-bottom: 8px; }
.detail-heading > div:first-child { min-width: 0; }
.detail-actions { display: flex; gap: 8px; }
.detail-card { overflow: hidden; border: 1px solid #e9e9e3; border-radius: 12px; background: #fff; }
.detail-artwork { height: 220px; }
.detail-card-body { padding: 18px; }
.detail-card-title { margin: 0 0 12px; font-size: 17px; font-weight: 600; letter-spacing: -.3px; }
.detail-attributes { display: grid; gap: 0; margin: 0; }
.detail-attributes > div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-top: 1px solid var(--studio-line-soft); }
.detail-attributes > div:first-child { border-top: 0; padding-top: 0; }
.detail-attributes dt { color: var(--studio-muted); font-size: 13px; font-weight: 400; }
.detail-attributes dd { margin: 0; color: var(--studio-ink); font-size: 14px; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.detail-attributes dd.detail-value-empty { color: var(--studio-soft-muted); font-weight: 400; }
.detail-style-code { letter-spacing: .4px; }

.detail-progress-card { padding: 18px; }
.detail-progress-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; }
.detail-progress-header p { max-width: 520px; margin: -6px 0 0; color: var(--studio-muted); font-size: 13px; line-height: 1.55; }
.progress-summary-pill { padding: 6px 10px; border-radius: 999px; background: var(--studio-green-soft); color: #485d43; font-size: 13px; font-weight: 600; white-space: nowrap; }
.progress-track-large { margin: 16px 0 6px; }
.progress-track-large .progress-segment { height: 6px; border-radius: 3px; }
.department-step-list { margin: 0; padding: 0; list-style: none; }
.department-step { display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; gap: 10px 12px; padding: 14px 0; border-top: 1px solid var(--studio-line-soft); }
.department-step:first-child { border-top: 0; }
.department-step .department-icon { grid-row: auto; width: 38px; height: 38px; }
.department-step-copy { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.department-step-number { color: var(--studio-soft-muted); font-size: 12px; letter-spacing: .3px; }
.department-step-copy strong { font-size: 15px; font-weight: 600; }
.department-step-done .department-step-copy strong::after { content: " ✓"; color: #677e5f; }
.status-picker { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; padding: 3px; border: 1px solid var(--studio-line); border-radius: 9px; background: #fafaf8; }
.status-picker.is-saving { opacity: .6; }
.status-picker-option { min-height: 40px; padding: 0 8px; border: 0; border-radius: 7px; background: transparent; color: #6a7067; font-size: 13px; font-weight: 600; cursor: pointer; transition: background .15s, color .15s; }
.status-picker-option:hover { background: #fff; color: var(--studio-ink); }
.status-picker-option.selected { box-shadow: 0 1px 4px #27321a14; cursor: default; }
.status-picker-waiting.selected { background: #fff; color: #5f645c; }
.status-picker-progress.selected { background: var(--studio-amber-soft); color: #8d6443; }
.status-picker-done.selected { background: var(--studio-green-soft); color: #485d43; }
.status-picker-option.is-blocked { color: #b7bab3; cursor: not-allowed; }
.status-picker-option.is-blocked:hover { background: transparent; color: #b7bab3; }

/* ---------- Breakpoint ---------- */
@media (min-width: 576px) {
    .topbar { padding: 0 24px; }
    .topbar-avatar { display: grid; }
    .page-content { padding: 36px 24px 0; }
    .page-heading { margin-bottom: 34px; }
    .department-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
    .metrics-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 18px 0 42px; }
    .metric-card { flex-wrap: wrap; }
    .metric-note { max-width: none; flex-basis: 100%; text-align: left; }
    .styles-heading { flex-direction: row; align-items: flex-end; justify-content: space-between; }
    .style-controls { flex: 0 1 380px; }
    .search-field kbd { display: block; }
    .style-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
    .product-art { height: clamp(170px, 26vw, 220px); }
    .studio-field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .department-step { grid-template-columns: 38px minmax(0, 1fr) minmax(300px, auto); }
    .status-picker { grid-column: auto; }
}

@media (min-width: 768px) {
    .workspace-pill { display: inline-flex; }
    .page-heading > .add-button { display: inline-flex; }
    .add-button-mobile { display: none; }
    .style-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .product-art { height: clamp(170px, 20vw, 220px); }
}

@media (min-width: 992px) {
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 40;
        width: var(--studio-sidebar-width);
        border-right: 1px solid var(--studio-line);
    }
    .sidebar-inner { padding: 22px 14px 14px; }
    .main-column { min-height: 100vh; margin-left: var(--studio-sidebar-width); }
    .app-shell-focused .main-column { margin-left: 0; }
    .topbar { padding: 0 32px; }
    .page-content { padding: 40px 32px 0; }
    .department-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
    .department-card { min-height: 92px; padding: 12px 10px; grid-template-columns: 1fr; grid-template-rows: auto auto auto; row-gap: 6px; }
    .department-card .department-icon { grid-row: auto; }
    .department-card > strong { align-self: auto; }
    .department-status { align-self: auto; margin-top: 0; }
    .metric-card { flex-wrap: nowrap; }
    .metric-note { max-width: 110px; flex-basis: auto; text-align: right; }
    .style-detail-layout { grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); align-items: start; gap: 20px; }
    .detail-heading { grid-column: 1 / -1; }
    .detail-info-card { position: sticky; top: 82px; }
}

@media (min-width: 1200px) {
    :root { --studio-sidebar-width: 240px; }
    .sidebar-inner { padding-right: 16px; padding-left: 16px; }
    .topbar { padding: 0 48px; }
    .page-content { padding: 46px 48px 0; }
    .page-heading h1 { font-size: 42px; }
    .department-grid { gap: 12px; }
    .department-card { padding: 13px 12px; }
    .style-grid { gap: 18px; }
    .product-art { height: 205px; }
    .style-card-body { padding: 15px; }
    .style-detail-layout { grid-template-columns: 360px minmax(0, 1fr); gap: 24px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
