:root {
    --primary: #08735f;
    --primary-dark: #075b4d;
    --primary-soft: #e7f5f1;
    --ink: #17201e;
    --muted: #66736f;
    --line: #dde6e3;
    --surface: #ffffff;
    --canvas: #f4f7f6;
    --danger: #c43d4b;
    --warning: #ae6a18;
    --sidebar: #082e29;
    --shadow: 0 8px 26px rgba(20, 49, 43, .07);
    --radius: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100dvh; background: var(--canvas); color: var(--ink); font: 14px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: var(--primary); }
button, a, input, select, textarea { touch-action: manipulation; }
button, [role="button"], .btn, .nav-link { cursor: pointer; }
button:disabled, .btn:disabled { cursor: not-allowed; opacity: .55; }
:focus-visible { outline: 3px solid rgba(8, 115, 95, .3); outline-offset: 2px; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 2000; background: #fff; color: var(--ink); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); }
.skip-link:focus { top: 12px; }

.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 1040; width: 268px; padding: 22px 16px 16px; display: flex; flex-direction: column; overflow-y: auto; background: var(--sidebar); color: #fff; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; padding: 0 10px 22px; letter-spacing: .02em; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: #0f8b73; font-size: 24px; transform: skew(-6deg); }
.brand strong { display: block; font-size: 19px; line-height: 1; letter-spacing: .04em; }
.brand small { display: block; margin-top: 5px; color: #7ce0c8; font-size: 9px; letter-spacing: .26em; }
.nav-label { margin: 18px 12px 7px; color: #7fa19a; font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.sidebar-nav { flex: 1; }
.sidebar .nav-link { min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 9px 13px; margin-bottom: 3px; border-radius: 10px; color: #b8cfca; text-decoration: none; font-weight: 600; transition: background-color .2s, color .2s; }
.sidebar .nav-link i { font-size: 18px; }
.sidebar .nav-link:hover { color: #fff; background: rgba(255,255,255,.07); }
.sidebar .nav-link.active { color: #fff; background: var(--primary); box-shadow: inset 3px 0 0 #76ddc4; }
.support-card { padding: 14px; margin-bottom: 12px; border: 1px solid rgba(255,255,255,.1); border-radius: 13px; background: rgba(255,255,255,.05); }
.support-card strong, .support-card small { display: block; }
.support-card small { margin-top: 4px; color: #9ab7b1; line-height: 1.4; }
.support-icon { display: inline-grid; place-items: center; width: 30px; height: 30px; margin-bottom: 10px; border-radius: 9px; background: rgba(80, 211, 179, .16); color: #70d8c0; }
.logout-link { color: #ffb9bd !important; }
.sidebar-backdrop { display: none; }

.app-shell { min-height: 100dvh; margin-left: 268px; }
.topbar { height: 84px; position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 32px; background: rgba(255,255,255,.95); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.topbar h1 { margin: 1px 0 0; font-size: 21px; line-height: 1.2; font-weight: 750; }
.eyebrow { color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.topbar-actions, .admin-profile { display: flex; align-items: center; gap: 11px; }
.top-search { width: min(300px, 28vw); position: relative; }
.top-search i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.top-search input { width: 100%; height: 42px; padding: 0 14px 0 38px; border: 1px solid var(--line); border-radius: 11px; background: #f7faf9; color: var(--ink); }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; color: #fff; background: var(--primary); font-weight: 800; }
.admin-copy strong, .admin-copy small { display: block; }
.admin-copy small { color: var(--muted); font-size: 12px; }
.icon-button { min-width: 44px; min-height: 44px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); text-decoration: none; font-size: 18px; transition: background .2s, border-color .2s; }
.icon-button:hover { background: var(--primary-soft); border-color: #acd8ce; color: var(--primary); }
.sidebar-toggle { display: none; }
.main-content { max-width: 1600px; margin: 0 auto; padding: 28px 32px 44px; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-heading h2 { margin: 0 0 4px; font-size: 24px; font-weight: 750; }
.page-heading p { margin: 0; color: var(--muted); }
.panel, .stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.panel-header h2, .panel-header h3 { margin: 0; font-size: 16px; font-weight: 750; }
.panel-body { padding: 22px; }
.stat-card { position: relative; overflow: hidden; padding: 22px; min-height: 132px; }
.stat-card::after { content: ""; position: absolute; width: 100px; height: 100px; right: -35px; bottom: -45px; border-radius: 50%; background: var(--primary-soft); }
.stat-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary); font-size: 20px; }
.stat-card strong { display: block; margin-top: 13px; font: 750 28px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.stat-card small { display: block; margin-top: 5px; color: var(--muted); }
.quick-action { min-height: 88px; padding: 16px; display: flex; align-items: center; gap: 14px; color: var(--ink); text-decoration: none; }
.quick-action i { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 12px; background: var(--primary-soft); color: var(--primary); font-size: 20px; }
.quick-action strong, .quick-action small { display: block; }
.quick-action small { color: var(--muted); }

.btn { min-height: 44px; border-radius: 10px; font-weight: 650; padding-inline: 16px; }
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-dark); --bs-btn-hover-border-color: var(--primary-dark); --bs-btn-active-bg: var(--primary-dark); --bs-btn-active-border-color: var(--primary-dark); }
.btn-light { --bs-btn-bg: #f3f6f5; --bs-btn-border-color: var(--line); }
.btn-icon { width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0; display: inline-grid; place-items: center; }
.form-label { margin-bottom: 7px; font-size: 13px; font-weight: 650; }
.form-control, .form-select { min-height: 44px; border-color: #d7e1de; border-radius: 10px; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 .2rem rgba(8,115,95,.12); }
textarea.form-control { min-height: 110px; }
.form-text { color: var(--muted); }
.filter-bar { display: grid; grid-template-columns: minmax(240px, 1fr) repeat(2, minmax(170px, .35fr)) auto; gap: 12px; padding: 16px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 13px; background: #fafcfb; }
.input-icon { position: relative; }
.input-icon i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-icon .form-control { padding-left: 40px; }

.table { margin: 0; vertical-align: middle; }
.table > :not(caption) > * > * { padding: 14px 16px; border-bottom-color: #e8eeec; }
.table thead th { color: var(--muted); background: #f8faf9; font-size: 11px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.thumb { width: 48px; height: 48px; object-fit: cover; border: 1px solid var(--line); border-radius: 10px; background: #edf2f0; }
.thumb-placeholder { display: grid; place-items: center; color: #8ca29d; font-size: 20px; }
.item-title { font-weight: 700; color: var(--ink); text-decoration: none; }
.item-title:hover { color: var(--primary); }
.item-meta { display: block; color: var(--muted); font-size: 12px; }
.badge { padding: 7px 9px; border-radius: 999px; font-weight: 650; }
.badge-soft-success { color: #096a56; background: #dff3ed; }
.badge-soft-secondary { color: #5d6966; background: #edf1f0; }
.badge-soft-warning { color: #885312; background: #fff0d9; }
.badge-soft-info { color: #145c70; background: #e0f3f8; }
.badge-soft-danger { color: #9d2735; background: #fde7e9; }
.badge-soft-primary { color: var(--primary-dark); background: var(--primary-soft); }
.empty-state { padding: 58px 20px; text-align: center; }
.empty-state i { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--primary-soft); color: var(--primary); font-size: 24px; }
.empty-state h3 { margin: 16px 0 6px; font-size: 18px; }
.empty-state p { max-width: 420px; margin: 0 auto 18px; color: var(--muted); }
.toast { background: #fff; box-shadow: 0 12px 36px rgba(19,52,45,.16); }
.danger-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; color: var(--danger); background: #fff0f1; font-size: 21px; }
.metric-strip { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 12px; margin-bottom: 22px; }
.metric-card { display: flex; align-items: center; gap: 13px; min-height: 86px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); text-decoration: none; }
.metric-card:hover { border-color: #add5cc; color: var(--ink); }
.metric-card i { width: 40px; height: 40px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 11px; background: var(--primary-soft); color: var(--primary); font-size: 18px; }
.metric-card strong, .metric-card span { display: block; }
.metric-card strong { font: 750 22px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.metric-card span { margin-top: 5px; color: var(--muted); font-size: 12px; }
.pagination-wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; color: var(--muted); border-top: 1px solid var(--line); }
.page-link { color: var(--primary); border-color: var(--line); }
.active > .page-link { background: var(--primary); border-color: var(--primary); }
.detail-list { margin: 0; }
.detail-list > div { display: grid; grid-template-columns: minmax(130px, .45fr) 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid #edf1ef; }
.detail-list > div:last-child { border-bottom: 0; }
.detail-list dt { color: var(--muted); font-weight: 600; }
.detail-list dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.order-heading { display: flex; align-items: flex-start; gap: 14px; }
.order-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; background: var(--primary-soft); color: var(--primary); font-size: 20px; }
.section-kicker { margin: 0 0 14px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.document-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.document-row:last-child { border-bottom: 0; }
.document-meta { display: flex; align-items: center; gap: 12px; min-width: 0; }
.document-meta > i { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px; background: #fff0f1; color: var(--danger); font-size: 19px; }
.document-meta strong, .document-meta small { display: block; }
.document-meta small { color: var(--muted); }
.timeline { position: relative; margin: 0; padding: 0; list-style: none; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 10px; bottom: 12px; width: 1px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 22px 44px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline-dot { position: absolute; left: 7px; top: 3px; width: 17px; height: 17px; border: 4px solid #d7efe9; border-radius: 50%; background: var(--primary); }
.timeline p { margin: 3px 0 0; color: var(--muted); }
.settings-units { display: flex; flex-wrap: wrap; gap: 8px; }
.unit-chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
.audit-action { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--primary-soft); color: var(--primary); }

.form-card { max-width: 920px; }
.section-title { margin: 0 0 18px; font-size: 15px; font-weight: 750; }
.image-preview { width: 112px; height: 112px; object-fit: cover; border: 1px solid var(--line); border-radius: 14px; background: #eff3f2; }
.required::after { content: " *"; color: var(--danger); }
.error-summary { border-left: 4px solid var(--danger); }

.builder-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 22px; align-items: start; }
.builder-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.field-card { margin-bottom: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 4px 18px rgba(20,49,43,.05); }
.field-card-header { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); background: #f9fbfa; border-radius: 14px 14px 0 0; }
.field-number { display: flex; align-items: center; gap: 9px; font-weight: 750; }
.drag-handle { color: #91a09d; cursor: grab; }
.field-card-body { padding: 18px; }
.option-list { display: grid; gap: 9px; }
.option-row { display: grid; grid-template-columns: 1fr 1fr 148px; gap: 9px; align-items: center; }
.option-actions { display: flex; gap: 4px; justify-content: flex-end; }
.option-section { margin-top: 16px; padding: 14px; border-radius: 12px; background: #f6f9f8; }
.preview-panel { position: sticky; top: 106px; overflow: hidden; }
.mobile-preview { max-width: 390px; margin: 0 auto; border: 8px solid #183a34; border-radius: 28px; background: #fff; box-shadow: 0 14px 34px rgba(15,45,39,.14); }
.mobile-preview-header { padding: 22px 19px 17px; color: #fff; background: var(--primary); border-radius: 18px 18px 0 0; }
.mobile-preview-header h3 { margin: 0; font-size: 21px; }
.mobile-preview-header small { color: #c7eee5; }
.mobile-preview-body { min-height: 420px; padding: 19px; }
.preview-group { margin-bottom: 18px; }
.preview-label { display: block; margin-bottom: 8px; font-weight: 700; }
.choice-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-pill { min-width: 68px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; text-align: center; background: #fff; }
.choice-pill:first-child { color: #fff; background: var(--primary); border-color: var(--primary); }
.preview-empty { padding: 80px 18px; text-align: center; color: var(--muted); }
.save-indicator { display: none; color: var(--muted); }
.save-indicator.active { display: inline-flex; align-items: center; gap: 8px; }

.login-page { min-height: 100dvh; display: grid; grid-template-columns: minmax(380px, .88fr) minmax(500px, 1.12fr); background: #eef5f3; }
.login-form-side { display: flex; flex-direction: column; justify-content: center; padding: clamp(32px, 7vw, 90px); background: #fff; }
.login-card { max-width: 460px; width: 100%; margin: 0 auto; }
.login-card .brand { color: var(--ink); padding-left: 0; }
.login-card .brand-mark { color: #fff; }
.login-card .brand small { color: var(--primary); }
.login-card h1 { margin: 34px 0 8px; font-size: clamp(28px, 3vw, 38px); font-weight: 800; }
.login-card > p { color: var(--muted); margin-bottom: 30px; }
.login-visual { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; padding: clamp(40px, 7vw, 90px); color: #fff; background: radial-gradient(circle at 75% 20%, #199b81 0, transparent 27%), linear-gradient(145deg, #073c33, #096754); }
.login-visual::before, .login-visual::after { content: ""; position: absolute; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; }
.login-visual::before { width: 520px; height: 520px; top: -170px; right: -120px; }
.login-visual::after { width: 300px; height: 300px; top: -50px; right: -10px; }
.visual-copy { position: relative; z-index: 1; max-width: 620px; }
.visual-copy .kicker { color: #88e2cd; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.visual-copy h2 { margin: 12px 0 18px; font-size: clamp(36px, 5vw, 64px); line-height: 1.02; font-weight: 800; }
.visual-copy p { color: #c1ddd6; font-size: 17px; max-width: 560px; }
.feature-row { display: flex; gap: 12px; margin-top: 34px; flex-wrap: wrap; }
.feature-chip { display: flex; align-items: center; gap: 8px; padding: 10px 13px; border: 1px solid rgba(255,255,255,.14); border-radius: 10px; background: rgba(255,255,255,.08); }

@media (max-width: 1199px) {
    .builder-layout { grid-template-columns: 1fr; }
    .preview-panel { position: static; }
}
@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); transition: transform .24s ease; }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-backdrop { position: fixed; inset: 0; z-index: 1030; background: rgba(3,20,17,.48); }
    body.sidebar-open .sidebar-backdrop { display: block; }
    .app-shell { margin-left: 0; }
    .sidebar-toggle { display: inline-grid; }
    .filter-bar { grid-template-columns: 1fr 1fr; }
    .login-page { grid-template-columns: 1fr; }
    .login-visual { display: none; }
    .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
    body { font-size: 16px; }
    .topbar { height: 74px; padding: 0 16px; }
    .topbar h1 { font-size: 18px; }
    .admin-copy { display: none; }
    .top-search { display: none; }
    .main-content { padding: 20px 16px 34px; }
    .page-heading { align-items: stretch; flex-direction: column; }
    .page-heading .btn { width: 100%; }
    .filter-bar { grid-template-columns: 1fr; }
    .table-responsive { border-radius: 0 0 var(--radius) var(--radius); }
    .option-row { grid-template-columns: 1fr; }
    .panel-body { padding: 16px; }
    .login-form-side { padding: 30px 20px; }
    .metric-strip { grid-template-columns: 1fr; }
    .detail-list > div { grid-template-columns: 1fr; gap: 3px; }
    .pagination-wrap { align-items: flex-start; flex-direction: column; }
    .document-row { align-items: flex-start; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
