:root { --ink:#1d2823; --muted:#526159; --line:#d8e1db; --paper:#fff; --surface:#f4f7f5; --green:#1f694e; --light:#e5f1e9; color:var(--ink); background:var(--surface); font:15px/1.55 system-ui,"Yu Gothic",Meiryo,sans-serif; }
* { box-sizing:border-box; }
body { margin:0; }
a { color:var(--green); text-underline-offset:3px; }
a:hover { text-decoration-thickness:2px; }
:focus-visible { outline:2px solid #14694c; outline-offset:3px; }
.login-panel { width:min(100%,420px); margin:28px auto; background:var(--paper); border:1px solid var(--line); border-radius:8px; padding:24px; }
.login-panel form { display:grid; gap:14px; margin-top:18px; }
.login-panel button { justify-self:start; }
.check-option { display:flex; gap:8px; align-items:center; }
.check-option input { width:16px; min-height:0; margin:0; padding:0; }
.app-frame { width:min(1440px,calc(100% - 40px)); min-height:calc(100vh - 40px); min-height:calc(100svh - 40px); margin:20px auto; display:flex; flex-direction:column; background:var(--paper); border:1px solid #c8d5ce; }
.topbar,.page-title,.section-title,.actions { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.topbar { min-height:64px; padding:8px 20px; border-bottom:1px solid #c8d5ce; }
.topbar form { flex:none; }
.brand { display:inline-flex; align-items:center; gap:10px; color:var(--ink); text-decoration:none; }
.brand-symbol { display:grid; place-items:center; inline-size:34px; block-size:34px; flex:none; background:var(--light); border:1px solid #bdd9c9; border-radius:6px; color:var(--green); }
.brand-caption { display:grid; line-height:1.35; }
.brand-caption strong { font-size:18px; }
.brand-caption small { color:var(--muted); font-size:11px; font-weight:500; }
svg { inline-size:19px; block-size:19px; flex:none; }
.app-workspace { display:grid; grid-template-columns:minmax(0,1fr); flex:1; }
.app-workspace.has-app-navigation { grid-template-columns:174px minmax(0,1fr); }
.app-navigation { background:#f2f6f3; border-inline-end:1px solid var(--line); padding:20px 10px; }
.app-nav-group { display:grid; gap:2px; margin-top:18px; }
.app-nav-heading { padding:0 12px 6px; color:var(--muted); font-size:11px; font-weight:700; }
.app-nav-link { display:flex; align-items:center; min-height:36px; padding:5px 10px; border-inline-start:2px solid transparent; border-radius:4px; color:#33473e; font-size:14px; font-weight:600; text-decoration:none; }
.app-nav-link:hover { background:#e9f0eb; }
.app-nav-link[aria-current] { color:#164935; background:var(--light); border-inline-start-color:var(--green); font-weight:700; }
.app-content { min-width:0; padding:24px 28px 42px; }
.app-workspace:not(.has-app-navigation) .app-content > .notice { max-width:420px; margin-inline:auto; }
.environment { color:var(--muted); font-size:12px; white-space:nowrap; border:1px solid var(--line); border-radius:4px; padding:2px 8px; }
h1,h2,h3,p { margin:0; }
h1 { font-size:26px; line-height:1.3; overflow-wrap:anywhere; }
h2 { font-size:16px; }
h3 { font-size:15px; }
.back { display:inline-block; margin-bottom:14px; font-size:13px; }
.page-title { margin-bottom:20px; }
.detail-title { margin:6px 0 2px; }
.button { background:var(--paper); color:var(--ink); border:1px solid #b9c9bf; cursor:pointer; display:inline-flex; min-height:38px; align-items:center; justify-content:center; gap:6px; padding:6px 13px; border-radius:6px; font:inherit; font-weight:600; text-decoration:none; flex-shrink:0; }
.button:hover { background:var(--light); }
.button.primary { background:var(--green); color:#fff; border-color:var(--green); }
.button.primary:hover { background:#15553d; }
button:disabled { opacity:.42; cursor:default; }
.tabs { display:flex; gap:18px; flex-wrap:wrap; padding-inline:12px; border-bottom:1px solid var(--line); background:var(--paper); }
.tabs a { padding:12px 4px 10px; color:var(--muted); text-decoration:none; border-bottom:2px solid transparent; }
.tabs .active { color:var(--green); border-color:var(--green); font-weight:700; }
.table-scroll { overflow-x:auto; }
table { width:100%; border-collapse:collapse; text-align:left; background:var(--paper); }
th,td { padding:9px 12px; border-bottom:1px solid var(--line); vertical-align:middle; }
th { background:#eef3ef; color:#34483c; font-weight:600; white-space:nowrap; }
td { overflow-wrap:anywhere; }
td:first-child { min-width:82px; }
.listing td:nth-child(2) { min-width:150px; }
.items td:first-child { width:42%; min-width:120px; }
.number { text-align:right; font-variant-numeric:tabular-nums; }
.nowrap,.items .number { white-space:nowrap; }
.subject { font-weight:600; }
.meta { display:block; font-size:13px; color:var(--muted); overflow-wrap:anywhere; }
.badge { display:inline-block; color:#245a49; background:var(--light); font-size:12px; line-height:1.55; border-radius:4px; padding:1px 6px; white-space:nowrap; }
.badge.invoice { color:#7e341c; background:#f8e9e1; }
.badge.delivery { color:#235365; background:#e5f1f5; }
.empty { background:var(--paper); text-align:center; padding:40px 16px; border-bottom:1px solid var(--line); }
.empty p { margin-bottom:8px; }
.notice { background:#e6f3eb; color:#1d573e; border-left:3px solid #3c8b66; margin-bottom:16px; padding:8px 12px; }
.notice.error { background:#fff1ec; color:#8d2e1a; border-color:#a34028; }
.notice ul { margin:4px 0; padding-left:22px; }
.section { border-top:1px solid var(--line); padding:15px 0; }
.section h2 { margin-bottom:10px; }
.section-title h2 { margin:0; }
.section-title { margin-bottom:8px; }
.fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
label { display:block; color:#384c40; font-size:13px; font-weight:600; min-width:0; }
input,select,textarea { display:block; width:100%; margin-top:4px; background:var(--paper); color:var(--ink); font:inherit; font-weight:400; font-size:15px; min-height:38px; border:1px solid #b9c9bf; border-radius:5px; padding:6px 8px; }
textarea { resize:vertical; }
.required { color:#8a3f2a; font-weight:500; font-size:11px; }
.line { display:grid; align-items:end; grid-template-columns:minmax(140px,3.6fr) minmax(75px,1fr) minmax(55px,.7fr) minmax(95px,1.25fr) minmax(62px,.7fr) 38px; gap:8px; padding:9px 0; border-bottom:1px solid var(--line); }
.line:last-child { border-bottom:0; }
.document-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; }
.transfer-actions { justify-content:flex-start; }
.document-search { display:flex; flex-wrap:wrap; gap:8px; align-items:end; padding-bottom:12px; }
.document-search label { flex:0 1 320px; }
.document-search .document-status-filter { flex:0 1 165px; }
.status-badge[data-status="completed"] { color:#245a49; background:var(--light); border-color:#bdd9c9; }
.party-wide { grid-column:1/-1; }
.party-fields { max-width:820px; }
.party-address { white-space:pre-line; }
.party-name { min-width:120px; }
.product-picker { width:min(650px,calc(100% - 24px)); max-height:85vh; padding:16px; border:1px solid var(--line); border-radius:8px; color:var(--ink); background:var(--paper); }
.product-picker::backdrop { background:rgba(22,36,27,.48); }
.product-picker .document-search label { flex:1 1 160px; }
.product-results { list-style:none; display:grid; gap:4px; max-height:45vh; overflow:auto; padding:2px; margin:0 0 8px; }
.product-results .button { justify-content:space-between; width:100%; flex-wrap:wrap; text-align:left; overflow-wrap:anywhere; }
.product-results .subject { flex:1 1 150px; min-width:0; }
.product-picker .back { margin:12px 0 0; }
.invoice-line { display:grid; grid-template-columns:minmax(135px,3fr) minmax(44px,.6fr) minmax(65px,1fr) minmax(64px,.9fr) minmax(52px,.7fr) minmax(90px,1.2fr) minmax(96px,1.2fr) auto; align-items:end; gap:8px; padding:9px 0; border-bottom:1px solid var(--line); }
.invoice-line .remove { justify-self:start; }
.invoice-line textarea { height:38px; }
.line-item-field { position:relative; min-width:0; }
.line-item-field label > span { display:block; line-height:24px; }
.product-line-button { position:absolute; inset:0 0 auto auto; min-height:24px; padding:0 3px; border:0; background:transparent; color:var(--green); font:inherit; font-size:12px; text-decoration:underline; cursor:pointer; }
.product-line-button:hover { text-decoration-thickness:2px; }
.invoice-wide { grid-column:1/-1; }
.icon { background:var(--paper); color:var(--muted); display:grid; place-items:center; min-height:38px; border-radius:5px; border:1px solid var(--line); cursor:pointer; }
.actions { justify-content:flex-end; }
.document-info { display:grid; grid-template-columns:1fr auto; gap:18px; align-items:start; background:var(--paper); border:1px solid var(--line); border-radius:6px; padding:14px 16px; margin-bottom:16px; }
dl { margin:0; display:grid; grid-template-columns:auto auto; gap:4px 12px; }
dt { color:var(--muted); }
dd { margin:0; text-align:right; }
.totals { width:min(320px,100%); margin:12px 0 0 auto; gap:0; background:var(--paper); }
.totals dt,.totals dd { padding:5px 10px; border-bottom:1px solid var(--line); }
.grand { background:var(--light); color:#15442f; font-weight:700; font-size:16px; }
.notes { white-space:pre-wrap; overflow-wrap:anywhere; }
.convert-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.conversion-item { background:var(--paper); border:1px solid var(--line); border-radius:6px; padding:12px; }
.conversion-item h3 { margin-bottom:8px; }
.conversion-item button { margin-top:12px; }
.pagination { display:flex; justify-content:flex-end; gap:14px; padding-top:12px; }
@media (max-width:980px) {
    .app-content { padding-inline:20px; }
    .line { grid-template-columns:repeat(3,minmax(0,1fr)); }
    .line label:first-child { grid-column:1/-1; }
    .icon { justify-self:start; width:38px; }
    .convert-grid { grid-template-columns:1fr; }
    .page-title:has(.document-actions) { flex-wrap:wrap; }
    .document-actions { justify-content:flex-start; }
    .invoice-line { grid-template-columns:repeat(3,minmax(0,1fr)); }
    .invoice-line .line-item-field { grid-column:1/-1; }
}
@media (max-width:760px) {
    .app-frame { width:100%; min-height:100vh; min-height:100svh; margin:0; border:0; }
    .topbar { min-height:56px; padding-inline:14px; }
    .app-workspace.has-app-navigation { grid-template-columns:minmax(0,1fr); grid-template-rows:auto 1fr; }
    .app-navigation,.app-nav-group { display:flex; flex-wrap:wrap; gap:4px; align-items:center; }
    .app-navigation { padding:6px 10px; border-inline-end:0; border-bottom:1px solid var(--line); }
    .app-nav-group { margin:0; }
    .app-nav-heading { display:none; }
    .app-nav-link { padding-inline:9px; min-height:34px; font-size:13px; border-inline-start:0; border-bottom:2px solid transparent; }
    .app-nav-link[aria-current] { border-bottom-color:var(--green); }
    .app-content { padding:18px 14px 34px; }
    h1 { font-size:22px; }
}
@media (max-width:420px) {
    .fields,.document-info { grid-template-columns:minmax(0,1fr); }
    .page-title { flex-wrap:wrap; align-items:flex-start; }
    .tabs { gap:8px; padding-inline:6px; }
    .document-index-filter > label:first-of-type { flex-basis:100%; }
}
@media (max-width:560px) {
    .document-listing,.document-listing tbody { display:block; }
    .document-listing thead { position:absolute; width:1px; height:1px; padding:0; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
    .document-listing tbody tr { display:grid; grid-template-columns:minmax(0,1fr) auto; grid-template-areas:"kind state" "subject subject" "date total"; align-items:center; gap:4px 10px; padding:10px 6px; border-bottom:1px solid var(--line); }
    .document-listing td,.document-listing td:nth-child(2) { display:block; min-width:0; padding:0; border:0; }
    .document-listing .document-list-kind { grid-area:kind; display:flex; flex-wrap:wrap; align-items:center; gap:5px; }
    .document-list-subject { grid-area:subject; }
    .document-list-state { grid-area:state; justify-self:end; }
    .document-list-date { grid-area:date; color:var(--muted); font-size:13px; }
    .document-list-total { grid-area:total; font-weight:600; }
}
