:root {
    --sample-green: #006b35;
    --sample-green-dark: #00562b;
    --sample-border: #d8ddda;
    --sample-text: #17211b;
    --sample-muted: #66716b;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--sample-text);
    background: #fbfcfb;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; overflow: hidden; background: #f5f7f8; font-family: Arial, Helvetica, sans-serif; font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { outline: 0; }
.sample-svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.sample-page { min-width: 1120px; height: 100vh; min-height: 0; padding: 10px 14px; overflow: hidden; }
.page-topbar { display: flex; height: 72px; align-items: center; justify-content: space-between; gap: 30px; padding: 0 2px 8px; }
.page-heading nav { display: flex; align-items: center; gap: 13px; margin-bottom: 6px; color: #4f5b55; font-size: 12px; }
.page-heading nav i { color: #9aa39e; font-style: normal; }
.page-heading h1 { margin: 0; color: #075d31; font-size: 25px; font-weight: 700; line-height: 1.15; }
.top-actions { display: flex; align-items: center; gap: 12px; }

.sample-button { display: inline-flex; height: 40px; align-items: center; justify-content: center; gap: 10px; padding: 0 18px; border: 1px solid #cbd3ce; border-radius: 5px; background: #fff; color: #1e2923; font-weight: 600; white-space: nowrap; cursor: pointer; transition: .16s ease; }
.sample-button svg { width: 19px; height: 19px; }
.sample-button:hover { border-color: #78a68d; background: #f7faf8; }
.sample-button:focus-visible { box-shadow: 0 0 0 3px rgba(0, 107, 53, .14); }
.sample-button.primary { border-color: var(--sample-green); background: linear-gradient(180deg, #087640, #006332); color: #fff; box-shadow: 0 2px 5px rgba(0, 91, 45, .16); }
.sample-button.primary:hover { background: var(--sample-green-dark); }
.sample-button.outline { border-color: #237449; color: #17643c; }
.sample-button.blue { border-color: #92afd2; color: #1765bd; font-weight: 500; }

.sample-workspace { display: grid; height: calc(100vh - 92px); min-height: 0; grid-template-columns: minmax(0, 1fr) 354px; align-items: stretch; gap: 12px; }
.sample-workspace.detail-closed { grid-template-columns: minmax(0, 1fr); }
.ledger-content { display: flex; min-width: 0; min-height: 0; height: 100%; flex-direction: column; }

.filter-bar { display: grid; flex: 0 0 auto; grid-template-columns: minmax(205px, 1.2fr) minmax(125px, .8fr) minmax(140px, .85fr) minmax(125px, .75fr) minmax(150px, 1fr) 70px; gap: 10px; align-items: center; margin: 0 2px 10px; }
.filter-control { position: relative; display: block; min-width: 0; margin: 0; font-weight: 400; }
.filter-control input, .filter-control select { width: 100%; height: 38px; border: 1px solid #cfd5d1; border-radius: 6px; outline: 0; background: #fff; color: #3c4640; font-size: 12px; font-weight: 400; }
.filter-control input { padding: 8px 34px 8px 13px; }
.filter-control select { padding: 8px 34px 8px 13px; appearance: none; }
.filter-control input:focus, .filter-control select:focus { border-color: var(--sample-green); box-shadow: 0 0 0 3px rgba(0, 107, 53, .1); }
.filter-control .control-icon { position: absolute; z-index: 1; top: 50%; left: 12px; display: inline-flex; color: #5f6964; transform: translateY(-50%); }
.filter-control .control-icon svg { width: 18px; height: 18px; }
.filter-control .control-arrow { position: absolute; top: 50%; right: 11px; display: inline-flex; color: #5e6963; transform: translateY(-50%); pointer-events: none; }
.filter-control .control-arrow svg { width: 16px; height: 16px; }
.date-control input, .search-control input { padding-left: 38px; }
.search-control input { padding-right: 12px; }
.filter-button { width: 70px; height: 38px; padding: 0 11px; }
.filter-button svg { width: 17px; }

.summary-grid { display: grid; flex: 0 0 auto; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 2px 10px; }
.summary-card { display: flex; min-height: 76px; align-items: center; gap: 12px; padding: 9px 12px; border: 1px solid; border-radius: 6px; background: #fff; }
.summary-icon { display: inline-flex; width: 48px; height: 48px; flex: 0 0 48px; align-items: center; justify-content: center; border-radius: 50%; color: #fff; }
.summary-icon svg { width: 28px; height: 28px; stroke-width: 1.6; }
.summary-card div span { display: block; margin-bottom: 3px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.summary-card strong { display: block; font-size: 28px; font-weight: 600; line-height: 1; }
.active-samples { border-color: #79c8ca; background: linear-gradient(120deg, #f3fcfc, #fff); color: #067170; }
.active-samples .summary-icon { background: linear-gradient(150deg, #4bc4bc, #168f84); }
.due-samples { border-color: #f0c986; background: linear-gradient(120deg, #fffaf1, #fff); color: #a85d00; }
.due-samples .summary-icon { background: linear-gradient(150deg, #f8b548, #ee911d); }
.destroyed-samples { border-color: #a8c1ae; background: linear-gradient(120deg, #f4f8f5, #fff); color: #2b6a42; }
.destroyed-samples .summary-icon { background: linear-gradient(150deg, #79a985, #47785a); }
.overdue-samples { border-color: #efaaaa; background: linear-gradient(120deg, #fff7f7, #fff); color: #d31818; }
.overdue-samples .summary-icon { background: linear-gradient(150deg, #fa4545, #d9161d); }

.ledger-panel { display: flex; min-height: 0; flex: 1; flex-direction: column; overflow: hidden; border: 1px solid var(--sample-border); border-radius: 8px; background: #fff; box-shadow: 0 1px 4px rgba(25, 52, 37, .05); }
.ledger-toolbar { display: flex; min-height: 54px; flex: 0 0 54px; align-items: center; justify-content: space-between; gap: 14px; padding: 7px 14px; border-bottom: 1px solid #d7dcd9; }
.ledger-toolbar h2 { margin: 0; font-size: 18px; font-weight: 700; }
.ledger-toolbar > div { display: flex; align-items: center; gap: 10px; }
.ledger-toolbar .sample-button { min-width: 147px; }
.ledger-toolbar .sample-button:first-child { min-width: 237px; }
.sample-grid.k-grid { min-height: 0; flex: 0 0 auto; border: 0 !important; }
.sample-grid .k-grid-header th.k-header { height: 38px; padding: 5px 4px; font-size: 10px; }
.sample-grid .k-grid-content td { height: 50px; padding: 7px 6px; font-size: 12px; }
.sample-grid .k-grid-content tbody tr { cursor: pointer; }
.sample-grid .k-grid-content tr.selected td { border-top-color: #efbd69 !important; border-bottom-color: #efbd69 !important; background: #fff8ec !important; }
.sample-grid .cell-left { text-align: left !important; }
.sample-grid .cell-center { text-align: center !important; }
.sample-grid .cell-number { text-align: right !important; }
.sample-grid .k-pager-wrap { min-height: 40px; padding: 4px 8px; }
.sample-grid .k-pager-info { font-size: 10px; }
.sample-grid .k-pager-sizes { margin-left: 7px; padding-left: 7px; }
.sample-status { display: inline-flex; min-height: 25px; align-items: center; justify-content: center; padding: 4px 8px; border: 1px solid transparent; border-radius: 7px; font-size: 11px; white-space: nowrap; }
.sample-status.storing { border-color: #93ced0; background: #dff5f5; color: #087576; }
.sample-status.due { border-color: #f0b45e; background: #fff6e9; color: #ef6d00; }
.sample-status.overdue { border-color: #ef9797; background: #ffe7e7; color: #db1717; }
.sample-status.destroyed { border-color: #a8c9b0; background: #eaf5ec; color: #287143; }
.row-actions { display: flex; align-items: center; justify-content: center; gap: 6px; }
.row-actions button { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; padding: 0; border: 1px solid #d3dad6; border-radius: 6px; background: #fff; color: #096839; cursor: pointer; }
.row-actions button:hover { border-color: #6fa486; background: #f2f8f4; }
.row-actions svg { width: 16px; height: 16px; }

.sample-detail { position: relative; display: flex; min-width: 0; min-height: 0; height: 100%; flex-direction: column; overflow: hidden; border: 1px solid #d6dcd8; border-radius: 8px; background: #fff; box-shadow: 0 2px 9px rgba(23, 47, 33, .08); }
.sample-workspace.detail-closed .sample-detail { display: none; }
.detail-heading { display: flex; min-height: 47px; align-items: center; justify-content: space-between; padding: 8px 13px; }
.detail-heading h2 { margin: 0; font-size: 16px; font-weight: 700; }
.detail-heading button { width: 31px; height: 31px; padding: 0; border: 0; background: transparent; color: #38453e; font-size: 28px; font-weight: 300; line-height: 28px; cursor: pointer; }
.detail-scroll { display: flex; flex: 1; flex-direction: column; min-height: 0; padding: 0 12px 12px; overflow-y: auto; }
.detail-scroll > * { flex-shrink: 0; }
.detail-scroll > h3 { margin: 0 0 13px; font-size: 15px; font-weight: 700; }
.sample-meta { display: grid; grid-template-columns: 145px 1fr; row-gap: 11px; margin: 0 0 14px; }
.sample-meta dt, .sample-meta dd { margin: 0; font-size: 11px; line-height: 1.4; }
.sample-meta dt { font-weight: 400; }
.sample-meta dd { color: #313b35; }
.sample-meta .sample-status { min-height: 23px; padding: 3px 8px; }
.evidence-section h4 { margin: 0 0 8px; font-size: 12px; font-weight: 500; }
.evidence-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.evidence-photo { height: 136px; margin: 0; overflow: hidden; border: 1px solid #cbd2ce; border-radius: 7px; background: #d2d6d3; }
.evidence-photo svg { width: 100%; height: 100%; border: 0; stroke: none; }
.evidence-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 7px; }
.evidence-actions .sample-button { height: 34px; padding: 0 8px; font-size: 12px; }
.evidence-actions .sample-button svg { width: 17px; height: 17px; }
#evidenceFile { display: none !important; }
.sample-owner { display: grid; grid-template-columns: 88px 1fr auto; align-items: center; gap: 7px; min-height: 44px; margin-top: 4px; color: #47534c; font-size: 11px; }
.sample-owner strong { color: #424d47; font-weight: 400; }
.sample-owner em { display: inline-flex; align-items: center; gap: 4px; color: #20804a; font-style: normal; white-space: nowrap; }
.sample-owner svg { width: 15px; height: 15px; }

.destroy-card { margin-top: auto; overflow: hidden; border: 1px solid #efad4f; border-radius: 7px; background: #fff; }
.destroy-card > h3 { display: flex; min-height: 41px; align-items: center; gap: 10px; margin: 0 0 6px; padding: 8px 12px; border-bottom: 1px solid #f4d4a8; background: linear-gradient(180deg, #fff9f0, #fff5e8); color: #8a4317; font-size: 15px; font-weight: 700; }
.destroy-card > h3 svg { width: 20px; height: 20px; color: #e42a1f; }
.destroy-card > label { display: grid; grid-template-columns: 141px 1fr; align-items: center; gap: 9px; margin: 0 10px 8px; color: #404b45; font-size: 11px; font-weight: 400; }
.destroy-card > label > span:first-child { line-height: 1.35; }
.destroy-control { position: relative; display: block; }
.destroy-control input, .destroy-control select, .destroy-card textarea { width: 100%; height: 32px; border: 1px solid #d2d8d4; border-radius: 5px; outline: 0; background: #fff; color: #48534d; }
.destroy-control input { padding: 6px 30px 6px 9px; }
.destroy-control select { padding: 5px 27px 5px 9px; appearance: none; }
.destroy-control > svg { position: absolute; top: 50%; right: 8px; width: 15px; height: 15px; color: #626e67; transform: translateY(-50%); pointer-events: none; }
.destroy-card textarea { height: 55px; padding: 7px 9px; resize: none; }
.destroy-control input:focus, .destroy-control select:focus, .destroy-card textarea:focus { border-color: #df8c28; box-shadow: 0 0 0 2px rgba(226, 133, 26, .1); }
.destroy-card > label.confirm-destroy { display: flex; grid-template-columns: none; gap: 9px; margin-top: 4px; cursor: pointer; }
.confirm-destroy input { position: absolute; opacity: 0; }
.confirm-destroy > span { display: inline-flex; width: 16px; height: 16px; flex: 0 0 16px; align-items: center; justify-content: center; border: 1px solid #7f8a84; border-radius: 3px; background: #fff; }
.confirm-destroy input:checked + span { border-color: #d91e1e; background: #d91e1e; }
.confirm-destroy input:checked + span::after { color: #fff; font-size: 12px; content: "✓"; }
.destroy-button { display: flex; width: calc(100% - 20px); height: 41px; align-items: center; justify-content: center; gap: 9px; margin: 0 10px 11px; border: 1px solid #e12020; border-radius: 5px; background: linear-gradient(180deg, #ef3232, #dd1d1d); color: #fff; font-weight: 700; cursor: pointer; }
.destroy-button:hover { background: #c91717; }
.destroy-button:disabled { cursor: default; opacity: .65; }
.destroy-button svg { width: 19px; height: 19px; }
.destroy-message { margin: -2px 10px 10px; padding: 7px 9px; border: 1px solid #efaaaa; border-radius: 5px; background: #fff1f1; color: #ad2424; font-size: 11px; }

.sample-toast { position: fixed; z-index: 100; right: 24px; bottom: 24px; max-width: 360px; padding: 11px 16px; border-radius: 7px; background: #164b31; color: #fff; box-shadow: 0 5px 18px rgba(14, 45, 29, .25); opacity: 0; pointer-events: none; transform: translateY(10px); transition: .2s ease; }
.sample-toast.error { background: #a8322b; }
.sample-toast.show { opacity: 1; transform: translateY(0); }
.detail-backdrop { display: none; }

@media (max-width: 1340px) {
    .sample-page { min-width: 1020px; }
    .sample-workspace { grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; }
    .filter-button { width: 100%; }
    .summary-grid { gap: 10px; }
    .summary-card { gap: 10px; padding: 13px 10px; }
    .summary-icon { width: 48px; height: 48px; flex-basis: 48px; }
    .summary-icon svg { width: 28px; height: 28px; }
    .summary-card div span { overflow: hidden; font-size: 12px; text-overflow: ellipsis; }
    .summary-card strong { font-size: 29px; }
}

@media (max-width: 1180px) {
    .sample-page { min-width: 0; }
    .sample-workspace { display: block; }
    .sample-detail { position: fixed; z-index: 60; top: 0; right: 0; bottom: 0; width: min(390px, 100vw); height: 100vh; min-height: 0; border-radius: 0; transform: translateX(100%); transition: transform .2s ease; }
    body.detail-open .sample-detail { transform: translateX(0); }
    .detail-backdrop { position: fixed; z-index: 55; inset: 0; display: block; background: rgba(18, 30, 23, .25); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
    body.detail-open .detail-backdrop { opacity: 1; pointer-events: auto; }
    .sample-workspace.detail-closed .sample-detail { display: flex; }
}

@media (max-height: 820px) and (min-width: 1181px) {
    .sample-grid .k-grid-content td { height: 43px; padding: 5px 6px; font-size: 11px; }
    .detail-heading { min-height: 40px; padding-top: 5px; padding-bottom: 5px; }
    .detail-scroll { padding-bottom: 8px; }
    .detail-scroll > h3 { margin-bottom: 6px; }
    .sample-meta { row-gap: 6px; margin-bottom: 7px; }
    .sample-meta dt, .sample-meta dd { font-size: 10px; line-height: 1.25; }
    .evidence-section h4 { margin-bottom: 5px; }
    .evidence-photo { height: 100px; }
    .evidence-actions { margin-top: 4px; }
    .evidence-actions .sample-button { height: 30px; }
    .sample-owner { min-height: 34px; }
    .destroy-card > h3 { min-height: 35px; margin-bottom: 4px; padding-top: 5px; padding-bottom: 5px; }
    .destroy-card > label { margin-right: 8px; margin-bottom: 5px; margin-left: 8px; }
    .destroy-control input, .destroy-control select { height: 30px; }
    .destroy-card textarea { height: 47px; }
    .destroy-button { height: 36px; margin-right: 8px; margin-bottom: 8px; margin-left: 8px; width: calc(100% - 16px); }
}

@media (max-width: 760px) {
    .sample-page { padding: 14px 11px 20px; }
    .page-topbar { align-items: stretch; flex-direction: column; gap: 10px; }
    .page-heading h1 { font-size: 23px; }
    .top-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding-top: 0; }
    .top-actions .sample-button { padding: 0 10px; }
    .filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 12px; }
    .search-control { grid-column: span 2; }
    .summary-card { min-height: 82px; }
    .ledger-toolbar { align-items: stretch; flex-direction: column; }
    .ledger-toolbar > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .ledger-toolbar .sample-button, .ledger-toolbar .sample-button:first-child { min-width: 0; padding: 0 8px; }
    .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
    .top-actions, .filter-bar, .summary-grid { grid-template-columns: 1fr; }
    .search-control { grid-column: auto; }
    .summary-card div span { font-size: 13px; }
    .ledger-toolbar > div { grid-template-columns: 1fr; }
}
