/* ============================================================
   青葉セキュリティ 備品台帳システム — app.css
   提案デモ用スタイル
   ============================================================ */

:root {
  --navy:        #0d2137;
  --navy-mid:    #173760;
  --navy-light:  #1e4a80;
  --teal:        #0a7b6c;
  --teal-light:  #0f9b8a;
  --teal-pale:   #e6f5f3;
  --teal-pale2:  #cceee9;
  --bg:          #f0f4f8;
  --surface:     #ffffff;
  --border:      #d1dde8;
  --border-dark: #a8bcd4;
  --text:        #1a2535;
  --text-mid:    #3d506a;
  --text-muted:  #5a6a7e;
  --danger:      #c0392b;
  --danger-pale: #fdf0ee;
  --s-draft:     #6b7280;
  --s-submitted: #2563eb;
  --s-returned:  #d97706;
  --s-approved:  #059669;
  --radius:      8px;
  --radius-lg:   12px;
  --shadow:      0 1px 4px rgba(13,33,55,.1), 0 2px 8px rgba(13,33,55,.06);
  --shadow-lg:   0 4px 16px rgba(13,33,55,.14), 0 2px 6px rgba(13,33,55,.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
               "Noto Sans JP", "Yu Gothic", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Utilities ── */
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); border:0; }
.hidden { display:none !important; }
.flex { display:flex; }
.gap-2 { gap: 8px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }

/* ── Demo Banner ── */
.demo-banner {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: linear-gradient(90deg, #7c1c0c 0%, #9c2d1a 50%, #7c1c0c 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 7px 16px;
  font-size: 12px;
  flex-wrap: wrap;
  text-align: center;
}
.demo-badge {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .05em;
  background: rgba(255,255,255,.15);
  padding: 2px 10px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,.3);
}
.demo-note { opacity: .9; font-size: 11.5px; }

/* ── Header ── */
.app-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  color: white;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.header-left { display:flex; align-items:center; gap:12px; }
.brand-icon svg { flex-shrink: 0; }
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: .04em; }
.brand-sub { font-size: 11px; opacity: .7; margin-top: 1px; }
.header-right { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }

/* Role switcher */
.role-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,.1);
  border-radius: 6px;
  padding: 4px;
}
.role-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  opacity: .7;
  padding: 0 6px;
  color: #f59e0b;
}
.role-btn {
  padding: 5px 14px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(255,255,255,.7);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.role-btn:hover { background: rgba(255,255,255,.1); color: white; }
.role-btn[aria-pressed="true"] {
  background: var(--teal);
  color: white;
  border-color: var(--teal-light);
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

/* Site selector */
.site-selector-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.site-select-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: rgba(255,255,255,.7);
  white-space: nowrap;
}
#site-select {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  color: white;
  border-radius: 5px;
  padding: 5px 24px 5px 10px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(255,255,255,.6)'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
#site-select option { background: var(--navy-mid); color: white; }
#site-select:focus { outline: 2px solid var(--teal-light); outline-offset: 1px; }

/* ── Navigation ── */
.app-nav {
  background: var(--navy-mid);
  border-bottom: 2px solid var(--teal);
  position: sticky;
  top: 39px;
  z-index: 900;
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  padding: 0 24px;
  gap: 2px;
  overflow-x: auto;
}
.nav-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 11px 18px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,.65);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color .15s, background .15s;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  font-family: inherit;
}
.nav-tab:hover { color: white; background: rgba(255,255,255,.06); }
.nav-tab.active {
  color: white;
  border-bottom-color: var(--teal-light);
  background: rgba(255,255,255,.06);
}
.nav-tab:focus { outline: 2px solid var(--teal-light); outline-offset: -2px; }
.nav-reset {
  margin-left: auto;
  color: rgba(255,180,160,.8);
  font-size: 12px;
}
.nav-reset:hover { color: #ff8875; }

/* ── Main ── */
.app-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}
.app-main:focus { outline: none; }

/* ── Page Header ── */
.page-header {
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title { font-size: 22px; font-weight: 700; color: var(--navy); line-height: 1.3; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* ── Card ── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-body { padding: 20px; }

/* ── Status Badge ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .03em;
  white-space: nowrap;
}
.badge::before { content:''; display:inline-block; width:6px; height:6px; border-radius:50%; background:currentColor; }
.badge-draft    { color: var(--s-draft);     background: #f3f4f6; border: 1px solid #d1d5db; }
.badge-submitted{ color: var(--s-submitted); background: #eff6ff; border: 1px solid #bfdbfe; }
.badge-returned { color: var(--s-returned);  background: #fffbeb; border: 1px solid #fcd34d; }
.badge-approved { color: var(--s-approved);  background: #f0fdf4; border: 1px solid #a7f3d0; }

/* ── Dashboard ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  border-top: 4px solid var(--border);
  cursor: pointer;
  transition: box-shadow .15s, transform .12s;
}
.stat-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.stat-card:focus { outline: 2px solid var(--teal); outline-offset: 2px; }
.stat-card.draft    { border-top-color: var(--s-draft); }
.stat-card.submitted{ border-top-color: var(--s-submitted); }
.stat-card.returned { border-top-color: var(--s-returned); }
.stat-card.approved { border-top-color: var(--s-approved); }
.stat-num   { font-size: 36px; font-weight: 800; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-card.draft     .stat-num { color: var(--s-draft); }
.stat-card.submitted .stat-num { color: var(--s-submitted); }
.stat-card.returned  .stat-num { color: var(--s-returned); }
.stat-card.approved  .stat-num { color: var(--s-approved); }
.stat-site-note { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* ── Progress Timeline ── */
.timeline {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 24px 0;
  overflow-x: auto;
  padding-bottom: 4px;
}
.timeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
  flex: 1;
}
.timeline-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  z-index: 1;
  position: relative;
}
.timeline-dot.active   { background: var(--teal); color: white; box-shadow: 0 0 0 4px var(--teal-pale); }
.timeline-dot.done     { background: var(--s-approved); color: white; }
.timeline-dot.pending  { background: var(--border); color: var(--text-muted); }
.timeline-dot.alert    { background: var(--s-returned); color: white; }
.timeline-label { font-size: 10.5px; margin-top: 5px; color: var(--text-muted); text-align: center; }
.timeline-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  min-width: 20px;
  align-self: flex-start;
  margin-top: 15px;
}
.timeline-connector.done { background: var(--s-approved); }

/* ── Ledger List ── */
.search-bar {
  position: relative;
  margin-bottom: 16px;
}
.search-bar input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.search-bar input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(10,123,108,.12);
}
.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.ledger-table-wrap { overflow-x: auto; position: relative; }
table.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ledger-table th {
  background: var(--bg);
  padding: 10px 14px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.ledger-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.ledger-table tr:last-child td { border-bottom: none; }
.ledger-table tr.clickable { cursor: pointer; }
.ledger-table tr.clickable:hover td { background: var(--teal-pale); }
.ledger-table tr.clickable:focus-within td { background: var(--teal-pale); }
.emp-name { font-weight: 600; color: var(--navy); }
.emp-num  { font-size: 11px; color: var(--text-muted); }
.item-count { font-size: 12px; color: var(--text-muted); }
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: .4; }
.empty-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.empty-desc  { font-size: 13px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
  white-space: nowrap;
  text-decoration: none;
}
.btn:focus { outline: 2px solid var(--teal); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--teal); color: white; border-color: var(--teal); }
.btn-primary:hover:not(:disabled) { background: var(--teal-light); border-color: var(--teal-light); }
.btn-navy { background: var(--navy); color: white; border-color: var(--navy); }
.btn-navy:hover:not(:disabled) { background: var(--navy-mid); }
.btn-ghost { background: transparent; color: var(--text-mid); border-color: var(--border-dark); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #a93226; }
.btn-warn { background: #d97706; color: white; border-color: #d97706; }
.btn-warn:hover:not(:disabled) { background: #b45309; }
.btn-approve { background: var(--s-approved); color: white; border-color: var(--s-approved); }
.btn-approve:hover:not(:disabled) { background: #047857; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-icon { padding: 6px; border-radius: 6px; }

/* ── Ledger Detail ── */
.detail-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  color: white;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 20px 24px;
}
.detail-emp-name { font-size: 20px; font-weight: 700; }
.detail-meta { font-size: 12px; opacity: .75; margin-top: 4px; display:flex; gap:16px; flex-wrap:wrap; }
.detail-status { margin-top: 10px; }

.detail-body { padding: 24px; }
.section { margin-bottom: 28px; }
.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--teal-pale2);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Items table */
.items-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.items-table th {
  padding: 8px 12px;
  background: var(--bg);
  text-align: left;
  font-size: 11.5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}
.items-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.items-table tr:last-child td { border-bottom: none; }
.balance-num {
  font-weight: 700;
  color: var(--navy);
}
.balance-zero { color: var(--text-muted); }

/* Item add form */
.item-add-form {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px dashed var(--border-dark);
  margin-top: 12px;
}
.form-row { display:flex; gap:10px; flex-wrap:wrap; align-items:flex-end; }
.form-group { display:flex; flex-direction:column; gap:4px; }
.form-group label { font-size: 11.5px; font-weight:600; color:var(--text-muted); }
.form-group input,
.form-group select,
.form-group textarea {
  padding: 7px 10px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: white;
  transition: border-color .15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(10,123,108,.1);
}
.form-group input.error { border-color: var(--danger); }
.form-error { font-size: 11px; color: var(--danger); margin-top: 2px; }
.form-group textarea { resize: vertical; min-height: 70px; }
.qty-input { width: 72px; }
.date-input { width: 140px; }

/* History events */
.history-list { display:flex; flex-direction:column; gap:8px; }
.history-item {
  display:flex; gap:12px; align-items:flex-start;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--bg);
  border-left: 4px solid var(--border);
  font-size: 13px;
}
.history-item.issued   { border-left-color: var(--s-submitted); }
.history-item.returned_item { border-left-color: var(--s-returned); }
.history-item.submit   { border-left-color: var(--teal); }
.history-item.hq_return{ border-left-color: var(--s-returned); }
.history-item.resubmit { border-left-color: var(--navy-light); }
.history-item.approved { border-left-color: var(--s-approved); }
.history-date { font-size: 11px; color: var(--text-muted); white-space:nowrap; margin-top: 2px; }
.history-type { font-weight: 700; font-size: 12px; }
.history-detail { font-size: 13px; }
.history-comment { font-size: 12px; color: var(--text-muted); font-style: italic; margin-top: 3px; }
.history-actor {
  font-size: 10px;
  color: var(--text-muted);
  background: var(--border);
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: auto;
  white-space: nowrap;
  align-self: flex-start;
}

/* HQ comment area */
.hq-comment-box {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
}
.hq-comment-label { font-size: 12px; font-weight: 700; color: #92400e; margin-bottom: 6px; }
.hq-comment-text  { font-size: 13px; color: #78350f; line-height: 1.6; }

/* Action bar */
.action-bar {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  display:flex; gap:10px; flex-wrap:wrap; align-items:center;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.action-note { font-size: 12px; color: var(--text-muted); flex:1; }

/* Edit mode badge */
.edit-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  background: #eff6ff;
  color: #1e40af;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #bfdbfe;
}
.locked-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  background: #f3f4f6;
  color: var(--text-muted);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

/* ── Flow Overview ── */
.flow-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}
@media (max-width: 720px) {
  .flow-comparison { grid-template-columns: 1fr; }
}
.flow-col-title {
  font-size: 14px;
  font-weight: 700;
  padding: 12px 16px;
  border-radius: var(--radius) var(--radius) 0 0;
  margin-bottom: 0;
}
.flow-current .flow-col-title  { background: #fef3c7; color: #92400e; border:1px solid #fcd34d; border-bottom:none; }
.flow-proposed .flow-col-title { background: var(--teal-pale); color: var(--teal); border:1px solid var(--teal-pale2); border-bottom:none; }
.flow-steps {
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  overflow:hidden;
}
.flow-step {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display:flex; gap:12px; align-items:flex-start;
  font-size: 13px;
}
.flow-step:last-child { border-bottom:none; }
.flow-step-num {
  width:22px; height:22px;
  border-radius:50%;
  background: var(--navy);
  color:white;
  font-size:11px;
  font-weight:700;
  display:flex; align-items:center; justify-content:center;
  flex-shrink:0;
  margin-top:1px;
}
.flow-proposed .flow-step-num { background: var(--teal); }
.flow-step-body { flex:1; }
.flow-step-title { font-weight:600; }
.flow-step-desc  { font-size:12px; color:var(--text-muted); margin-top:2px; }
.flow-pain { color:var(--danger); font-size:12px; margin-top:3px; }
.flow-gain { color:var(--teal); font-size:12px; margin-top:3px; }

.limitations-box {
  background: var(--bg);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 24px;
  font-size: 13px;
}
.limitations-box ul { padding-left:18px; }
.limitations-box li { margin-bottom:4px; color:var(--text-muted); }

/* ── New ledger form ── */
.new-ledger-form {
  max-width: 540px;
}

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset:0;
  background: rgba(0,0,0,.5);
  display:flex; align-items:center; justify-content:center;
  z-index: 2000;
  padding: 20px;
}
.modal-backdrop.hidden { display:none; }
.modal-dialog {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display:flex; align-items:center; justify-content:space-between;
}
.modal-title { font-size:16px; font-weight:700; color:var(--navy); }
.modal-close {
  background:none; border:none; cursor:pointer; color:var(--text-muted);
  padding:4px; border-radius:4px; font-size:18px; line-height:1;
  font-family:inherit;
}
.modal-close:hover { background:var(--bg); color:var(--text); }
.modal-close:focus { outline:2px solid var(--teal); }
.modal-body { padding:20px; }
.modal-footer { padding:14px 20px; border-top:1px solid var(--border); display:flex; gap:8px; justify-content:flex-end; flex-wrap:wrap; }

/* ── Print Preview Modal ── */
.modal-dialog.print-modal {
  max-width: 860px;
  width: 96%;
}

/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 3000;
  display:flex; flex-direction:column; gap:8px;
  max-width: 380px;
}
.toast {
  background: var(--navy);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  display:flex; align-items:flex-start; gap:10px;
  animation: slideIn .2s ease;
}
.toast.success { background: var(--s-approved); }
.toast.error   { background: var(--danger); }
.toast.warn    { background: #d97706; }
.toast-msg { flex:1; }
.toast-close {
  background:none; border:none; color:rgba(255,255,255,.7);
  cursor:pointer; font-size:16px; line-height:1; padding:0;
  flex-shrink:0;
}
@keyframes slideIn { from { transform:translateX(20px); opacity:0; } to { transform:none; opacity:1; } }

/* ── Print layout ── */
.print-area {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 13px;
  color: #1a2535;
  line-height: 1.6;
  padding: 20px;
}
.print-watermark {
  text-align: center;
  color: #b91c1c;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  margin-bottom: 12px;
  padding: 5px 0;
  border: 1.5px solid #f87171;
  border-radius: 4px;
  background: #fef2f2;
}
.print-ledger-title {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}
.print-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 20px;
  border: 1px solid #888;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 12.5px;
}
.print-meta-row { display:flex; gap:8px; }
.print-meta-label { font-weight:700; color:#555; min-width:80px; }
.print-items-title { font-weight:700; margin-bottom:6px; font-size:13px; }
.print-items-table { width:100%; border-collapse:collapse; font-size:12.5px; margin-bottom:16px; }
.print-items-table th { background:#f0f4f8; padding:6px 10px; text-align:left; border:1px solid #ccc; }
.print-items-table td { padding:6px 10px; border:1px solid #ccc; }
.print-history-title { font-weight:700; margin-bottom:6px; font-size:13px; }
.print-history-table { width:100%; border-collapse:collapse; font-size:12px; margin-bottom:16px; }
.print-history-table th { background:#f0f4f8; padding:5px 8px; text-align:left; border:1px solid #ccc; }
.print-history-table td { padding:5px 8px; border:1px solid #ccc; }
.print-approval-box {
  border: 2px solid #059669;
  border-radius:6px;
  padding:12px 16px;
  background:#f0fdf4;
  display:flex; gap:20px; flex-wrap:wrap;
  font-size:12.5px;
  margin-bottom:16px;
}
.print-approval-label { font-weight:700; color:#059669; }
.print-footer { text-align:right; font-size:11px; color:#888; margin-top:12px; }
.print-preview-actions {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display:flex; gap:8px; justify-content:flex-end; align-items:center;
}
.print-note { font-size:12px; color:var(--text-muted); flex:1; }

/* ── Back button ── */
.back-btn {
  display:inline-flex; align-items:center; gap:6px;
  padding: 6px 0;
  background:none; border:none;
  color:var(--teal); font-size:13px; font-weight:600;
  cursor:pointer; font-family:inherit;
  margin-bottom:16px;
}
.back-btn:hover { color:var(--teal-light); }
.back-btn:focus { outline:2px solid var(--teal); border-radius:4px; }

/* ── Divider ── */
.divider { border:none; border-top:1px solid var(--border); margin:20px 0; }

/* ── Info banner (returned) ── */
.info-banner {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  display:flex; gap:10px; align-items:flex-start;
  font-size: 13px;
}
.info-banner.warning { background:#fffbeb; border:1px solid #fcd34d; color:#92400e; }
.info-banner.info    { background:#eff6ff; border:1px solid #bfdbfe; color:#1e3a8a; }
.info-banner.success { background:#f0fdf4; border:1px solid #a7f3d0; color:#14532d; }

/* ── Responsive ── */
@media screen and (max-width: 768px) {
  .app-header { padding: 10px 14px; }
  .header-right { gap: 8px; }
  .app-main { padding: 16px 14px 40px; }
  .nav-inner { padding: 0 14px; }
  .nav-tab { padding: 9px 12px; font-size: 12px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { flex-direction: column; }
  .action-bar { padding: 12px 14px; }
  .detail-body { padding: 16px; }
  .detail-header { padding: 16px; }
  .ledger-table th:nth-child(3),
  .ledger-table td:nth-child(3) { display:none; }
  .page-header { flex-direction:column; }
  .ledger-table { min-width: 620px; }
  .items-table { min-width: 580px; }
  .ledger-table-wrap { max-width: 100%; overflow-x: auto; }
  .history-item { flex-wrap: wrap; }
  .modal-dialog input, .modal-dialog select { max-width: 100%; box-sizing: border-box; }
  .print-area table { font-size: 11px; }
}
@media (max-width: 480px) {
  .demo-banner { flex-direction:column; gap:4px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-num { font-size: 28px; }
  .role-label { display:none; }
  .brand-sub { display:none; }
}

/* ── detail-header ghost buttons — white text/border for legibility ── */
.detail-header .btn-ghost {
  color: white;
  border-color: rgba(255,255,255,.35);
}
.detail-header .btn-ghost:hover:not(:disabled) {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.55);
}

/* ── @print ── */
@media print {
  /* Hide everything by default */
  body > * { display:none !important; }

  /* Reveal the modal stack so #print-area is reachable */
  .modal-backdrop:not(.hidden) {
    display:block !important;
    position: static !important;
    overflow: visible !important;
    background: none !important;
    padding: 0 !important;
  }
  .modal-backdrop:not(.hidden) .modal-dialog.print-modal {
    display:block !important;
    position: static !important;
    max-width: none !important;
    width: auto !important;
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }
  .modal-backdrop:not(.hidden) .modal-dialog.print-modal .modal-body {
    display:block !important;
    position: static !important;
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
    padding: 0 !important;
  }
  /* Hide modal chrome and action bar inside print modal */
  .modal-header,
  .modal-footer,
  .print-preview-actions { display:none !important; }

  /* Hide app chrome even if :has is not supported */
  .demo-banner, .app-header, .app-nav, .app-main,
  .toast-container, .back-btn, .action-bar { display:none !important; }

  /* #print-area itself */
  #print-area {
    display:block !important;
    width: auto !important;
    padding: 0 !important;
  }

  /* Tables */
  .print-items-table,
  .print-history-table { width: 100% !important; }
  .print-items-table tr,
  .print-history-table tr { page-break-inside: avoid; }
  .print-approval-box { page-break-inside: avoid; }
  .print-items-table thead,
  .print-history-table thead { display: table-header-group; }

  /* Page setup */
  @page {
    size: A4 portrait;
    margin: 12mm;
  }

  /* Misc */
  body { font-size: 12px; background:white; margin:0; }
}
