:root {
    --bg: #f5f7f8;
    --surface: #ffffff;
    --surface-soft: #f8fafb;
    --text: #172326;
    --muted: #6c7a7e;
    --line: #e3e9eb;
    --primary: #0f766e;
    --primary-dark: #0a5d57;
    --primary-soft: #e8f5f3;
    --accent: #d99b32;
    --danger: #b42318;
    --shadow: 0 10px 30px rgba(23, 35, 38, 0.06);
    --radius: 18px;
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: Tahoma, Arial, sans-serif;
    line-height: 1.65;
}

button, input, select { font: inherit; }
a { color: inherit; text-decoration: none; }

.app-shell { min-height: 100vh; display: flex; }

.sidebar {
    width: 270px;
    min-height: 100vh;
    padding: 24px 18px;
    background: #102c2b;
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 100;
}

.brand, .login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand { padding: 2px 8px 26px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand strong, .login-brand strong { display: block; font-size: 1.05rem; }
.brand span, .login-brand span { display: block; font-size: .76rem; color: rgba(255,255,255,.65); }

.brand-mark {
    width: 45px;
    height: 45px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, #23a99e, #0f766e);
    color: #fff !important;
    font-weight: 800;
    letter-spacing: .5px;
    box-shadow: 0 8px 20px rgba(15,118,110,.28);
}
.brand-mark.large { width: 58px; height: 58px; border-radius: 18px; font-size: 1.2rem; }

.nav-menu { display: grid; gap: 8px; margin-top: 24px; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 10px 13px;
    border-radius: 12px;
    color: rgba(255,255,255,.72);
    transition: .2s ease;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-link.active { color: #fff; background: rgba(35,169,158,.2); box-shadow: inset -3px 0 #4fd1c5; }
.nav-icon { width: 24px; text-align: center; font-size: 1.25rem; }

.sidebar-footer { margin-top: auto; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.1); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; }
.user-chip strong { display: block; font-size: .9rem; }
.user-chip small { color: rgba(255,255,255,.55); }
.avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.12); }
.logout-button { width: 100%; margin-top: 10px; padding: 10px; border: 1px solid rgba(255,255,255,.12); color: rgba(255,255,255,.8); background: transparent; border-radius: 10px; cursor: pointer; }
.logout-button:hover { background: rgba(255,255,255,.08); color: #fff; }

.main-content { width: calc(100% - 270px); margin-right: 270px; min-height: 100vh; }
.topbar {
    min-height: 92px;
    padding: 20px 34px;
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255,255,255,.92);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
}
.topbar h1 { margin: 0; font-size: 1.35rem; }
.topbar p { margin: 2px 0 0; color: var(--muted); font-size: .85rem; }
.topbar-date { margin-right: auto; color: var(--muted); font-size: .84rem; }
.menu-button { display: none; border: 0; background: var(--surface-soft); width: 42px; height: 42px; border-radius: 11px; cursor: pointer; font-size: 1.2rem; }
.content-container { padding: 28px 34px 48px; max-width: 1700px; margin: 0 auto; }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card + .card, .details-grid + .card, .product-hero + .details-grid { margin-top: 22px; }
.card-header { min-height: 78px; padding: 20px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.card-header h2, .card-header h3 { margin: 0; font-size: 1.03rem; }
.card-header p { margin: 3px 0 0; color: var(--muted); font-size: .82rem; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 22px; }
.stat-card { min-height: 140px; padding: 23px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; align-items: center; gap: 18px; }
.stat-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-size: 1.5rem; font-weight: 700; }
.stat-card span { display: block; color: var(--muted); font-size: .82rem; }
.stat-card strong { display: block; font-size: 1.7rem; line-height: 1.35; }
.stat-card small { color: #95a0a3; }

.primary-button, .secondary-button, .table-action, .text-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: .18s ease;
}
.primary-button { min-height: 44px; padding: 9px 18px; color: #fff; background: var(--primary); border: 1px solid var(--primary); }
.primary-button:hover { background: var(--primary-dark); transform: translateY(-1px); }
.secondary-button { min-height: 40px; padding: 8px 14px; color: var(--primary); background: var(--primary-soft); border: 1px solid #cce9e5; font-size: .84rem; }
.secondary-button:hover { background: #dcf1ee; }
.text-button { min-height: 42px; padding: 8px 10px; color: var(--muted); }
.text-button:hover { color: var(--danger); }
.full-width { width: 100%; }

.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 900px; }
.data-table th { padding: 13px 16px; text-align: right; background: #fafcfc; color: #617075; font-size: .76rem; font-weight: 700; white-space: nowrap; border-bottom: 1px solid var(--line); }
.data-table td { padding: 15px 16px; border-bottom: 1px solid #edf1f2; vertical-align: middle; font-size: .84rem; }
.data-table tbody tr:hover { background: #fbfdfd; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.muted-cell { color: var(--muted); max-width: 280px; }
.ltr-cell { direction: ltr; unicode-bidi: embed; text-align: right; white-space: nowrap; }
.id-badge { display: inline-flex; padding: 4px 8px; border-radius: 8px; color: #526165; background: #f0f3f4; font-family: Consolas, monospace; font-size: .76rem; }
.table-action { min-height: 34px; padding: 6px 12px; color: var(--primary); background: var(--primary-soft); font-size: .78rem; }
.table-action:hover { background: var(--primary); color: #fff; }

.filter-card { margin-bottom: 18px; overflow: visible; }
.filter-form { padding: 18px; display: grid; grid-template-columns: minmax(260px, 1.8fr) minmax(180px, .8fr) minmax(170px, .7fr) 110px auto auto; gap: 11px; align-items: center; }
.search-box { position: relative; }
.search-box input { width: 100%; padding-right: 42px; }
.search-icon { position: absolute; top: 50%; right: 15px; transform: translateY(-50%); color: var(--muted); font-size: 1.2rem; pointer-events: none; }
input, select { width: 100%; min-height: 44px; padding: 9px 12px; color: var(--text); background: #fff; border: 1px solid #d8e0e2; border-radius: 10px; outline: none; }
input:focus, select:focus { border-color: #4baca4; box-shadow: 0 0 0 3px rgba(15,118,110,.09); }
.products-header { min-height: 74px; }
.result-badge { display: inline-flex; padding: 7px 11px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: .78rem; font-weight: 700; white-space: nowrap; }
.product-name-cell { min-width: 240px; }
.product-name-cell strong { display: block; max-width: 330px; }
.product-name-cell small { display: block; max-width: 330px; margin-top: 3px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-stack { direction: ltr; text-align: left; font-family: Consolas, monospace; font-size: .73rem; white-space: nowrap; }
.code-stack span { display: block; }
.code-stack b { color: var(--muted); font-weight: 500; }
.price-cell { white-space: nowrap; }
.image-count { width: 30px; height: 30px; border-radius: 9px; display: inline-grid; place-items: center; background: #f0f3f4; color: #536266; font-weight: 700; }

.pagination-wrap { min-height: 76px; padding: 15px 22px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 15px; color: var(--muted); font-size: .82rem; }
.pagination { display: flex; align-items: center; gap: 5px; direction: ltr; }
.page-link { min-width: 36px; height: 36px; padding: 0 8px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: #566469; }
.page-link:hover { border-color: #8bcac4; color: var(--primary); }
.page-link.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-link.disabled { opacity: .38; pointer-events: none; }

.empty-state { padding: 70px 24px; text-align: center; }
.empty-state.compact { padding: 54px 24px; }
.empty-state h2, .empty-state h3 { margin: 12px 0 4px; }
.empty-state p { margin: 0 0 20px; color: var(--muted); }
.empty-icon { width: 58px; height: 58px; margin: 0 auto; display: grid; place-items: center; border-radius: 18px; background: var(--primary-soft); color: var(--primary); font-size: 1.6rem; }

.details-toolbar { margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.back-link { color: var(--primary); font-weight: 700; font-size: .88rem; }
.product-hero { padding: 28px; display: flex; justify-content: space-between; align-items: stretch; gap: 26px; background: linear-gradient(120deg, #fff 0%, #f4fbfa 100%); }
.product-hero-main { min-width: 0; padding: 6px 0; }
.product-kicker { color: var(--primary); font-family: Consolas, monospace; font-size: .75rem; font-weight: 700; letter-spacing: .5px; }
.product-hero h2 { margin: 8px 0 5px; font-size: 1.55rem; line-height: 1.5; }
.product-hero p { margin: 0; color: var(--muted); max-width: 850px; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.hero-tags span { padding: 6px 10px; border-radius: 9px; background: #fff; border: 1px solid #dce8e7; color: #4f6063; font-size: .78rem; }
.price-panel { width: 230px; min-width: 230px; padding: 20px; border-radius: 15px; background: #102c2b; color: #fff; display: flex; flex-direction: column; justify-content: center; }
.price-panel span { color: rgba(255,255,255,.65); font-size: .75rem; }
.price-panel strong { margin-top: 3px; font-size: 1.65rem; }
.price-panel small { color: rgba(255,255,255,.65); }
.price-panel hr { width: 100%; margin: 14px 0; border: 0; border-top: 1px solid rgba(255,255,255,.13); }
.price-panel b { margin-top: 3px; font-size: .9rem; }

.details-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 22px; margin-top: 22px; }
.detail-section { padding: 24px; }
.detail-section .card-header { margin: -24px -24px 22px; }
.section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 21px; }
.section-title.no-margin { margin: 0; }
.section-title span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--primary-soft); color: var(--primary); font-family: Consolas, monospace; font-size: .72rem; font-weight: 700; }
.section-title h3 { margin: 0; font-size: 1rem; }
.info-grid { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.info-grid.one-column { grid-template-columns: 1fr; }
.info-grid > div { min-height: 86px; padding: 14px 16px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; }
.info-grid dt { margin-bottom: 5px; color: var(--muted); font-size: .75rem; }
.info-grid dd { margin: 0; word-break: break-word; font-size: .87rem; }

.image-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.image-card { margin: 0; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.image-card img, .image-placeholder { width: 100%; aspect-ratio: 4/3; border-radius: 10px; background: #f4f7f7; object-fit: contain; }
.image-placeholder { display: grid; place-items: center; color: var(--muted); }
.image-card figcaption { padding: 10px 3px 2px; }
.image-card strong, .image-card small { display: block; }
.image-card strong { font-size: .82rem; }
.image-card small { margin-top: 2px; color: var(--muted); font-size: .7rem; direction: ltr; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.accordion-list { display: grid; gap: 10px; }
.detail-accordion { border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.detail-accordion summary { padding: 15px 17px; cursor: pointer; font-weight: 700; font-size: .87rem; background: #fbfcfc; }
.detail-accordion[open] summary { color: var(--primary); border-bottom: 1px solid var(--line); }
.rich-text { padding: 18px; color: #445256; white-space: pre-line; line-height: 1.9; font-size: .88rem; }
.full-text { max-height: 520px; overflow: auto; direction: rtl; }
.inline-link { color: var(--primary); font-weight: 700; }
.status-badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; background: #edf7f2; color: #237a52; font-size: .74rem; }

.login-page { min-height: 100vh; background: #eef4f3; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.08fr .92fr; }
.login-intro { padding: 54px clamp(40px, 7vw, 110px); color: #fff; background: radial-gradient(circle at 20% 20%, rgba(58,196,183,.26), transparent 35%), linear-gradient(145deg, #0b2928, #0f4a46); display: flex; flex-direction: column; }
.login-brand span { color: rgba(255,255,255,.65); }
.intro-copy { margin: auto 0; max-width: 630px; }
.eyebrow { display: inline-block; margin-bottom: 12px; color: #67d6cc; font-size: .72rem; font-family: Consolas, monospace; letter-spacing: 2px; }
.intro-copy h1 { margin: 0 0 16px; font-size: clamp(2rem, 4vw, 3.65rem); line-height: 1.45; }
.intro-copy p { margin: 0; color: rgba(255,255,255,.7); font-size: 1rem; line-height: 2; }
.intro-features { display: flex; flex-wrap: wrap; gap: 10px; }
.intro-features span { padding: 8px 12px; border: 1px solid rgba(255,255,255,.13); border-radius: 999px; color: rgba(255,255,255,.72); font-size: .76rem; }
.login-card-wrap { padding: 32px; display: grid; place-items: center; }
.login-card { width: min(440px, 100%); padding: 38px; background: #fff; border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 25px 70px rgba(13,51,49,.12); }
.login-card-header { margin-bottom: 26px; }
.login-card-header h2 { margin: 0; font-size: 1.4rem; }
.login-card-header p { margin: 5px 0 0; color: var(--muted); font-size: .84rem; }
.mobile-logo { display: none; width: 48px; height: 48px; margin-bottom: 18px; border-radius: 14px; place-items: center; color: #fff; background: var(--primary); font-weight: 800; }
.login-form { display: grid; gap: 16px; }
.form-field > span:first-child { display: block; margin-bottom: 6px; color: #415054; font-size: .82rem; font-weight: 700; }
.password-wrap { position: relative; }
.password-wrap input { padding-left: 68px; }
.password-toggle { position: absolute; left: 6px; top: 6px; bottom: 6px; padding: 0 10px; border: 0; border-radius: 7px; color: var(--primary); background: var(--primary-soft); cursor: pointer; font-size: .72rem; }
.checkbox-field { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .8rem; }
.checkbox-field input { width: 17px; min-height: 17px; accent-color: var(--primary); }
.field-error { display: block; margin-top: 4px; color: var(--danger); font-size: .72rem; }
.validation-summary { padding: 10px 12px; color: var(--danger); background: #fff2f0; border: 1px solid #ffd4ce; border-radius: 9px; font-size: .78rem; }
.validation-summary:empty { display: none; }
.validation-summary ul { margin: 0; padding-right: 18px; }
.login-hint { margin: 20px 0 0; padding-top: 17px; border-top: 1px solid var(--line); color: #97a1a4; text-align: center; font-size: .72rem; }
.sidebar-overlay { display: none; }

@media (max-width: 1250px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-form { grid-template-columns: 1fr 1fr 1fr 110px; }
    .filter-form .search-box { grid-column: span 2; }
    .details-grid { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
    .sidebar { transform: translateX(105%); transition: transform .22s ease; box-shadow: -20px 0 50px rgba(0,0,0,.18); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(7,20,20,.45); }
    .sidebar-overlay.show { display: block; }
    .main-content { width: 100%; margin-right: 0; }
    .menu-button { display: block; }
    .login-shell { grid-template-columns: 1fr; }
    .login-intro { display: none; }
    .mobile-logo { display: grid; }
}

@media (max-width: 680px) {
    .topbar { min-height: 78px; padding: 14px 16px; }
    .topbar h1 { font-size: 1.08rem; }
    .topbar p, .topbar-date { display: none; }
    .content-container { padding: 18px 12px 36px; }
    .stats-grid { grid-template-columns: 1fr; gap: 12px; }
    .stat-card { min-height: 112px; padding: 18px; }
    .card-header { padding: 17px; align-items: flex-start; }
    .card-header .secondary-button { display: none; }
    .filter-form { grid-template-columns: 1fr; padding: 14px; }
    .filter-form .search-box { grid-column: auto; }
    .filter-form .primary-button { width: 100%; }
    .pagination-wrap { flex-direction: column; }
    .details-toolbar { align-items: flex-start; }
    .details-toolbar .secondary-button { font-size: 0; width: 42px; min-width: 42px; }
    .details-toolbar .secondary-button::after { content: '↗'; font-size: 1rem; }
    .product-hero { padding: 20px; flex-direction: column; }
    .product-hero h2 { font-size: 1.2rem; }
    .price-panel { width: 100%; min-width: 0; }
    .detail-section { padding: 17px; }
    .detail-section .card-header { margin: -17px -17px 18px; }
    .info-grid { grid-template-columns: 1fr; }
    .login-card-wrap { padding: 18px; }
    .login-card { padding: 28px 22px; }
}
