:root {
    --navy: #12264a;
    --navy-2: #1b3563;
    --orange: #e97919;
    --ink: #172642;
    --muted: #718098;
    --line: #dce4ee;
    --surface: #ffffff;
    --canvas: #f3f6fa;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--canvas);
    font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--canvas); font-size: 16px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { display: flex; min-height: 100vh; }

.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; display: flex; width: 286px; flex-direction: column; color: #fff; background: var(--navy); border-right: 1px solid rgba(255,255,255,.1); }
.brand-row { display: flex; height: 92px; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand-card { display: inline-flex; align-items: center; height: 51px; padding: 8px 12px; background: #fff; border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.brand-card img { display: block; width: 180px; height: 32px; object-fit: contain; }
.icon-button { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: #fff; }
.sidebar-close { display: none; color: #fff; background: transparent; border-color: rgba(255,255,255,.18); font-size: 25px; }
.main-nav { flex: 1; overflow-y: auto; padding: 24px 16px; }
.nav-label { margin: 0 0 12px; padding: 0 12px; color: rgba(191,219,254,.65); font-size: 12px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.nav-item { display: flex; width: 100%; align-items: center; gap: 12px; margin: 2px 0; padding: 12px; color: rgba(239,246,255,.82); text-align: left; background: transparent; border: 0; border-radius: 12px; font-size: 15px; font-weight: 650; transition: .18s ease; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav-item.active { color: var(--navy); background: #fff; box-shadow: 0 8px 20px rgba(4,13,31,.2); }
.nav-icon { display: grid; flex: 0 0 22px; height: 22px; place-items: center; font-size: 13px; font-weight: 900; border: 1px solid currentColor; border-radius: 6px; }
.nav-item.active .nav-icon { color: var(--orange); }
.nav-count { margin-left: auto; padding: 2px 8px; color: #fff; background: var(--orange); border-radius: 999px; font-size: 12px; font-weight: 800; }
.demo-panel { margin: 16px; padding: 16px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.11); border-radius: 16px; }
.demo-panel strong { display: flex; align-items: center; gap: 7px; font-size: 14px; }
.demo-panel strong span { color: #f39a4c; }
.demo-panel p { margin: 8px 0 0; color: rgba(219,234,254,.72); font-size: 12px; line-height: 1.65; }
.menu-overlay { display: none; }

.main-area { min-width: 0; flex: 1; margin-left: 286px; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; height: 76px; align-items: center; gap: 16px; padding: 0 28px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.menu-button { display: none; }
.breadcrumb { color: var(--muted); font-size: 14px; }
.breadcrumb span { padding: 0 8px; }
.breadcrumb strong { color: var(--ink); }
.demo-badge { padding: 4px 9px; color: #b95708; background: #fff3e8; border: 1px solid #ffd7b3; border-radius: 7px; font-size: 12px; font-weight: 800; }
.user-summary { display: flex; align-items: center; gap: 12px; margin-left: auto; text-align: right; }
.user-summary strong, .user-summary small { display: block; }
.user-summary strong { font-size: 14px; }
.user-summary small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.avatar { display: grid; width: 42px; height: 42px; place-items: center; color: #fff; background: var(--navy); border-radius: 50%; font-size: 13px; font-weight: 800; }
.logout-link { color: #6c7a8f; font-size: 12px; font-weight: 700; text-decoration: none; }
.logout-link:hover { color: #b95708; }

.content { max-width: 1580px; margin: 0 auto; padding: 28px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-heading p { margin: 0 0 6px; color: #e26d11; font-size: 14px; font-weight: 700; }
.page-heading h1 { margin: 0; font-size: clamp(25px, 2.2vw, 34px); line-height: 1.17; letter-spacing: -.035em; }
.heading-actions, .detail-actions { display: flex; gap: 9px; }
.button { min-height: 43px; padding: 10px 15px; border: 1px solid transparent; border-radius: 10px; font-weight: 750; transition: .16s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--orange); }
.button.primary:hover { background: #ce6311; }
.button.secondary { color: var(--ink); background: #fff; border-color: #cfd9e5; }
.button.dark { color: #fff; background: var(--navy); }
.button-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

.settings-page { min-height: 100vh; padding: 32px 18px; background: #eef3f9; }
.settings-shell { width: min(900px,100%); margin: 0 auto; }
.settings-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.settings-header img { width: 210px; padding: 9px 12px; background: #fff; border-radius: 12px; }
.settings-card { padding: 24px; background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 15px 45px rgba(18,38,74,.08); }
.settings-card + .settings-card { margin-top: 18px; }
.settings-card h1, .settings-card h2 { margin-top: 0; }
.settings-card p { color: var(--muted); line-height: 1.6; }
.settings-form { display: grid; gap: 16px; }
.settings-form label { display: grid; gap: 7px; font-size: 13px; font-weight: 750; }
.settings-form input[type='text'], .settings-form input[type='file'], .settings-form select { width: 100%; min-height: 46px; padding: 10px 12px; background: #f8fafc; border: 1px solid #c9d5e3; border-radius: 10px; }
.settings-table { width: 100%; border-collapse: collapse; }
.settings-table th, .settings-table td { padding: 13px 10px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.settings-table th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.success-box { padding: 13px 15px; color: #23623d; background: #eaf8ef; border: 1px solid #bfe8cf; border-radius: 10px; }

.metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; margin-bottom: 22px; }
.metric-card { display: flex; align-items: flex-start; justify-content: space-between; padding: 20px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 25px rgba(19,39,75,.045); }
.metric-card span, .metric-card strong, .metric-card small { display: block; }
.metric-card span { color: var(--muted); font-size: 14px; font-weight: 650; }
.metric-card strong { margin-top: 7px; font-size: 28px; letter-spacing: -.03em; }
.metric-card small { margin-top: 3px; color: #8591a2; font-size: 12px; font-weight: 600; }
.metric-card small.warning { color: #c05a0c; }
.metric-card b { display: grid; width: 44px; height: 44px; place-items: center; color: #29466f; background: #edf2f8; border-radius: 12px; }
.metric-card b.orange { color: #e26d11; background: #fff0e2; }
.metric-card b.yellow { color: #b66b00; background: #fff4dc; }

.workspace { display: grid; grid-template-columns: minmax(0,1fr) 370px; gap: 20px; align-items: start; }
.article-panel, .detail-panel { overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 17px; box-shadow: 0 12px 35px rgba(19,39,75,.06); }
.panel-header { display: flex; align-items: center; gap: 20px; padding: 20px; border-bottom: 1px solid #e4eaf1; }
.panel-header h2 { margin: 0; font-size: 20px; }
.panel-header p { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.search-field { position: relative; width: min(100%,360px); margin-left: auto; }
.search-field span { position: absolute; left: 13px; top: 50%; color: #7b8798; transform: translateY(-50%); font-size: 22px; }
.search-field input { width: 100%; height: 44px; padding: 0 14px 0 39px; color: var(--ink); background: #f8fafc; border: 1px solid #ccd7e4; border-radius: 10px; outline: none; }
.search-field input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(233,121,25,.13); }
.table-wrap { overflow-x: auto; }
.article-table { width: 100%; border-collapse: collapse; min-width: 850px; }
.article-table th { padding: 13px 12px; color: #6f7d90; background: #f8fafc; font-size: 12px; font-weight: 800; text-align: left; text-transform: uppercase; letter-spacing: .045em; }
.article-table th:first-child, .article-table td:first-child { padding-left: 20px; }
.article-table td { padding: 14px 12px; border-top: 1px solid #e7ecf2; vertical-align: middle; font-size: 14px; }
.article-row { cursor: pointer; outline: none; transition: background .14s ease; }
.article-row:hover, .article-row:focus, .article-row.selected { background: #f5f8fd; }
.article-name { display: flex; align-items: center; gap: 12px; min-width: 330px; }
.article-name img { width: 58px; height: 58px; object-fit: cover; border-radius: 12px; }
.article-name strong, .article-name small, .article-table td > strong, .article-table td > small { display: block; }
.article-name strong { font-size: 15px; }
.article-name small, .article-table td > small { margin-top: 5px; color: #77859a; font-size: 11px; font-weight: 600; }
.channel-list { display: flex; max-width: 190px; flex-wrap: wrap; gap: 4px; }
.channel-list span { padding: 5px 7px; color: #4c5e76; background: #edf2f8; border-radius: 5px; font-size: 10px; font-weight: 800; }
.channel-list small { color: #8793a5; }
.status { display: inline-flex; padding: 4px 8px; border: 1px solid; border-radius: 999px; font-size: 11px; font-weight: 800; }
.status.active { color: #237747; background: #eaf8ef; border-color: #bfe8cf; }
.status.review { color: #ad590e; background: #fff4e4; border-color: #ffd7a8; }
.row-arrow { color: #9aa6b6; font-size: 25px !important; }
.empty-state { padding: 50px 20px; color: var(--muted); text-align: center; }

.detail-image { position: relative; height: 225px; background: #e9eef4; }
.detail-image img { width: 100%; height: 100%; object-fit: cover; }
.detail-image .status { position: absolute; top: 16px; left: 16px; }
.detail-content { padding: 20px; }
.detail-content .family { margin: 0; color: #e26d11; font-size: 11px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.detail-content h2 { margin: 8px 0; font-size: 21px; line-height: 1.22; }
.detail-content code { color: #66758b; font-size: 13px; }
.stock-grid { display: grid; grid-template-columns: repeat(3,1fr); margin: 20px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; }
.stock-grid div { padding: 11px 6px; text-align: center; }
.stock-grid div + div { border-left: 1px solid var(--line); }
.stock-grid strong, .stock-grid small { display: block; }
.stock-grid strong { font-size: 18px; }
.stock-grid small { margin-top: 2px; color: #7a879a; font-size: 10px; font-weight: 700; }
.pick-note { padding: 14px; color: #74421b; background: #fff7ef; border-radius: 12px; font-size: 13px; line-height: 1.55; }
.pick-note strong, .pick-note span { display: block; }
.pick-note strong { color: #a64e0a; }
.detail-list { margin: 18px 0; font-size: 13px; }
.detail-list div { display: flex; justify-content: space-between; gap: 18px; padding: 6px 0; }
.detail-list dt { color: #77859a; }
.detail-list dd { margin: 0; font-weight: 800; text-align: right; }
.detail-actions .button { flex: 1; font-size: 13px; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: min(360px,calc(100vw - 32px)); padding: 13px 16px; color: #fff; background: var(--navy); border-radius: 11px; box-shadow: 0 18px 50px rgba(7,21,44,.25); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }

.login-page { min-height: 100vh; background: #eef3f9; }
.login-shell { display: grid; min-height: 100vh; grid-template-columns: minmax(360px,.9fr) minmax(460px,1.1fr); }
.login-brand { display: flex; flex-direction: column; justify-content: center; padding: clamp(34px,7vw,100px); color: #fff; background: linear-gradient(145deg,#0e2040,#1b3869); }
.login-logo { align-self: flex-start; margin-bottom: 34px; padding: 10px 14px; background: #fff; border-radius: 13px; }
.login-logo img { display: block; width: min(260px,65vw); height: auto; }
.login-brand .demo-badge { align-self: flex-start; }
.login-brand h1 { max-width: 610px; margin: 24px 0 16px; font-size: clamp(34px,4.2vw,62px); line-height: 1.02; letter-spacing: -.045em; }
.login-brand > p { max-width: 580px; margin: 0; color: #d9e5f6; font-size: 17px; line-height: 1.65; }
.login-brand ul { display: grid; gap: 12px; margin: 30px 0 0; padding: 0; list-style: none; color: #d9e5f6; }
.login-brand li::before { content: '✓'; display: inline-grid; width: 25px; height: 25px; margin-right: 10px; place-items: center; color: #fff; background: var(--orange); border-radius: 50%; font-size: 12px; font-weight: 900; }
.login-card { align-self: center; width: min(500px,calc(100% - 40px)); margin: 40px auto; padding: clamp(26px,4vw,46px); background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 25px 75px rgba(18,38,74,.13); }
.eyebrow { margin: 0 0 7px; color: #d96610; font-size: 12px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.login-card h2 { margin: 0; font-size: 32px; letter-spacing: -.035em; }
.login-hint { margin: 8px 0 0; color: var(--muted); }
.login-alert { margin-top: 20px; padding: 13px 15px; color: #724414; background: #fff6e7; border: 1px solid #ffdca8; border-radius: 10px; font-size: 13px; line-height: 1.5; }
.login-alert.error { color: #8c2424; background: #fff0f0; border-color: #ffc8c8; }
.login-form { display: grid; gap: 17px; margin-top: 24px; }
.login-form > label:not(.trust-option) { display: grid; gap: 7px; color: #33435b; font-size: 13px; font-weight: 750; }
.login-form input[type='text'], .login-form input[type='email'], .login-form input[type='password'] { width: 100%; height: 47px; padding: 0 13px; color: var(--ink); background: #f8fafc; border: 1px solid #c9d5e3; border-radius: 10px; outline: 0; }
.login-form input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(233,121,25,.13); }
.trust-option { display: flex; align-items: flex-start; gap: 11px; padding: 13px; background: #f5f8fc; border-radius: 11px; cursor: pointer; }
.trust-option input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--orange); }
.trust-option strong, .trust-option small { display: block; }
.trust-option strong { font-size: 13px; }
.trust-option small { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.login-submit { width: 100%; min-height: 48px; }
.login-submit:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.security-note { margin: 18px 0 0; color: #7b8798; font-size: 11px; line-height: 1.55; }

@media (max-width: 1250px) {
    .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .workspace { grid-template-columns: 1fr; }
    .detail-panel { display: grid; grid-template-columns: 320px 1fr; }
    .detail-image { height: 100%; min-height: 350px; }
}

@media (max-width: 900px) {
    .sidebar { transform: translateX(-102%); box-shadow: 0 25px 70px rgba(0,0,0,.3); transition: transform .2s ease; }
    body.menu-open .sidebar { transform: translateX(0); }
    .sidebar-close, .menu-button { display: grid; }
    .menu-overlay { position: fixed; inset: 0; z-index: 40; width: 100%; height: 100%; padding: 0; background: rgba(7,21,44,.55); border: 0; }
    body.menu-open .menu-overlay { display: block; }
    .main-area { margin-left: 0; }
    .topbar { padding: 0 18px; }
    .login-shell { grid-template-columns: 1fr; }
    .login-brand { min-height: 360px; padding: 38px 28px; }
    .login-brand h1 { max-width: 700px; font-size: 38px; }
    .login-card { margin: -42px auto 35px; position: relative; }
}

@media (max-width: 680px) {
    .content { padding: 18px 14px 32px; }
    .breadcrumb, .user-summary > div { display: none; }
    .logout-link { display: none; }
    .page-heading { align-items: stretch; flex-direction: column; }
    .heading-actions .button { flex: 1; }
    .metrics { grid-template-columns: 1fr; }
    .metric-card { padding: 17px; }
    .panel-header { align-items: stretch; flex-direction: column; }
    .search-field { margin-left: 0; }
    .table-wrap { overflow: visible; }
    .article-table, .article-table tbody { display: block; min-width: 0; }
    .article-table thead { display: none; }
    .article-row { display: grid; grid-template-columns: 1fr auto; padding: 14px; border-top: 1px solid #e7ecf2; }
    .article-table td { display: none; padding: 0; border: 0; }
    .article-table td:first-child, .article-table td:nth-child(5) { display: block; padding: 0; }
    .article-table td:nth-child(5) { align-self: center; }
    .article-name { min-width: 0; }
    .article-name img { width: 64px; height: 64px; }
    .article-name strong { line-height: 1.3; }
    .detail-panel { display: block; }
    .detail-image { height: 230px; min-height: 0; }
    .detail-actions { flex-direction: column; }
}

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