* { box-sizing: border-box; }
:root { --bg: #F8F9FE; --surface: #ffffff; --surface2: rgba(61,79,181,0.04); --border: rgba(61,79,181,0.12); --text: #1a1f3a; --muted: rgba(26,31,58,0.65); --primary: #3D4FB5; --primary2: #4F5FC7; --danger: #E8505B; --success: #52C41A; --warn: #FAAD14; --supply-control-h: 36px; }
body { margin: 0; font-family: "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, Roboto, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif; background: radial-gradient(1200px 600px at 20% -10%, rgba(61,79,181,0.12), transparent 60%), radial-gradient(900px 500px at 100% 0%, rgba(79,95,199,0.10), transparent 55%), var(--bg); color: var(--text); background-repeat: no-repeat; }
input, select, textarea, button { font-family: inherit; }
a { color: var(--primary2); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1400px; margin: 0 auto; padding: 24px; width: 100%; }
.supply-app { display: flex; min-height: 100vh; align-items: stretch; }
.supply-app--guest { display: block; min-height: 100vh; }
.sidebar { width: 248px; flex: 0 0 248px; display: flex; flex-direction: column; min-height: 100vh; padding: 20px 0 16px; background: var(--surface); border-right: 1px solid var(--border); box-shadow: 1px 0 0 rgba(15,23,42,0.04); }
.sidebar-brand { padding: 0 20px 20px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.sidebar-identity { display: flex; flex-direction: row; align-items: center; gap: 12px; }
.sidebar-avatar { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(180deg, var(--primary2), var(--primary)); color: #ffffff; font-size: 18px; font-weight: 800; line-height: 44px; text-align: center; box-shadow: 0 4px 12px rgba(61,79,181,0.35); }
.sidebar-identity-text { flex: 1 1 auto; min-width: 0; }
.sidebar-role-label { font-size: 15px; font-weight: 700; letter-spacing: -0.2px; color: var(--text); line-height: 1.25; }
.sidebar-name { font-size: 12px; margin-top: 3px; line-height: 1.3; word-break: break-all; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; padding: 0 12px; flex: 1 1 auto; }
.sidebar-link { display: flex; align-items: center; padding: 10px 12px; border-radius: 10px; color: var(--text); font-size: 14px; font-weight: 500; text-decoration: none; }
.sidebar-link:hover { background: var(--surface2); text-decoration: none; }
.sidebar-link.is-active { background: rgba(61,79,181,0.10); color: var(--primary); font-weight: 600; }
.sidebar-foot { padding: 16px 20px 0; margin-top: auto; border-top: 1px solid var(--border); }
.sidebar-user { font-size: 12px; line-height: 1.35; margin-bottom: 10px; word-break: break-all; }
.sidebar-logout { width: 100%; }
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.main-head { padding: 20px 24px 0; flex: 0 0 auto; }
.main-title { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.3px; color: var(--text); }
.guest-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid var(--border); background: rgba(248,249,254,0.92); backdrop-filter: blur(10px); }
.guest-brand { display: flex; flex-direction: column; gap: 2px; }
.guest-sub { font-size: 12px; }
.supply-app--guest .container { padding-top: 32px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; box-shadow: 0 10px 30px rgba(15,23,42,0.06); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 auto; }
.brand { display: flex; flex-direction: column; gap: 2px; }
.brand-title { font-weight: 800; letter-spacing: -0.2px; color: var(--primary); }
.muted { color: var(--muted); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font-size: 14px; font-weight: 500; }
.btn:hover { background: rgba(61,79,181,0.06); border-color: rgba(61,79,181,0.22); }
.btn.primary { background: linear-gradient(180deg, var(--primary2), var(--primary)); border-color: rgba(61,79,181,0.35); color: #ffffff; }
.btn.primary:hover { filter: brightness(1.05); }
.btn-kakao { background: #FEE500; border-color: #E0C900; color: #191919; font-weight: 600; }
.btn.btn-kakao:hover { background: #F5DA00; border-color: #D4BE00; color: #191919; }
.btn-kakao-icon { flex-shrink: 0; display: block; }
.btn.danger { background: rgba(232,80,91,0.10); border-color: rgba(232,80,91,0.28); color: #7f1d1d; }
.btn.danger:hover { background: rgba(232,80,91,0.14); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 0 10px; font-size: 13px; border-radius: 8px; gap: 4px; height: var(--supply-control-h); min-height: var(--supply-control-h); box-sizing: border-box; }
.row > .btn-sm { flex: 0 0 auto; }
.row > .btn-apply { flex: 0 0 100px; }
.btn-apply { width: 100px; box-sizing: border-box; }
.row > .btn-new-request { flex: 0 0 200px; }
.btn-new-request { width: 200px; box-sizing: border-box; }
.request-view-btn { width: 150px; box-sizing: border-box; height: var(--supply-control-h); min-height: var(--supply-control-h); padding: 0 12px; font-size: 14px; }
.row > .request-view-btn { flex: 0 0 150px; }
.request-view-btn.request-view-btn-list { width: 120px; }
.row > .request-view-btn.request-view-btn-list { flex: 0 0 120px; }
.request-view-btn-cancel { width: 100px; box-sizing: border-box; height: var(--supply-control-h); min-height: var(--supply-control-h); padding: 0 12px; font-size: 14px; }
.row > .request-view-cancel-form { flex: 0 0 auto; }
select.select-sm { padding: 0 10px; font-size: 13px; border-radius: 8px; height: var(--supply-control-h); min-height: var(--supply-control-h); box-sizing: border-box; }
.input, select, textarea { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); outline: none; }
.input:focus, select:focus, textarea:focus { border-color: rgba(61,79,181,0.45); box-shadow: 0 0 0 4px rgba(61,79,181,0.12); }
textarea { min-height: 92px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px; font-weight: 500; }
.field { margin: 0 0 12px; }
.field.field-filter { min-width: 160px; max-width: 200px; margin: 0 12px 0 0; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th, .table td { padding: 12px; border-bottom: 1px solid rgba(26,31,58,0.07); vertical-align: middle; }
.table th { text-align: left; font-size: 12px; font-weight: 700; letter-spacing: -0.02em; color: rgba(26,31,58,0.52); background: #edf0f7; border-bottom: 1px solid rgba(61,79,181,0.14); }
.table td { font-size: 13px; color: var(--text); line-height: 1.45; }
.table tbody tr:hover td { background: rgba(61,79,181,0.045); }
.table tbody tr:last-child td { border-bottom-color: transparent; }
.table td a { font-weight: 600; color: var(--primary2); text-decoration: none; }
.table td a:hover { color: var(--primary); text-decoration: underline; }
.table td .dashboard-id-link { display: inline-flex; align-items: center; justify-content: center; min-width: 3.25rem; padding: 5px 11px; border-radius: 8px; font-size: 13px; font-weight: 700; background: rgba(61,79,181,0.14); border: 1px solid rgba(61,79,181,0.38); color: var(--primary); text-decoration: none; box-shadow: 0 1px 3px rgba(61,79,181,0.15); }
.table td .dashboard-id-link:hover { background: linear-gradient(180deg, var(--primary2), var(--primary)); border-color: rgba(61,79,181,0.5); color: #ffffff; text-decoration: none; box-shadow: 0 2px 10px rgba(61,79,181,0.28); }
.dashboard-id-cell { display: inline-flex; align-items: center; gap: 6px; flex-wrap: nowrap; white-space: nowrap; }
.dashboard-row-new { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; line-height: 0; }
.dashboard-row-new-img { width: 40px; height: 40px; object-fit: contain; display: block; border-radius: 6px; box-shadow: 0 1px 6px rgba(61,79,181,0.22); }
.pill { display: inline-flex; align-items: center; justify-content: center; height: var(--supply-control-h); min-height: var(--supply-control-h); box-sizing: border-box; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface2); font-size: 13px; color: rgba(26,31,58,0.78); font-weight: 500; max-width: 100%; }
.pill.green { border-color: rgba(82,196,26,0.35); background: rgba(82,196,26,0.10); color: #135200; }
.pill.blue { border-color: rgba(61,79,181,0.32); background: rgba(61,79,181,0.10); color: var(--primary); }
.pill.orange { border-color: rgba(250,173,20,0.40); background: rgba(250,173,20,0.12); color: #7a3e00; }
.pill.red { border-color: rgba(232,80,91,0.30); background: rgba(232,80,91,0.10); color: #7f1d1d; }
.priority-urgent { color: var(--danger); font-weight: 700; }
.pill.pill-view-toolbar { width: 120px; flex: 0 0 120px; box-sizing: border-box; }
.flash { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); margin: 12px 0; }
.flash.ok { border-color: rgba(82,196,26,0.30); background: rgba(82,196,26,0.08); }
.flash.err { border-color: rgba(232,80,91,0.30); background: rgba(232,80,91,0.08); }
.footer { margin: 18px 0 0; color: rgba(26,31,58,0.55); font-size: 12px; }
.supply-page { display: flex; flex-direction: column; gap: 24px; }
.kakao-preview-card { padding: 14px 14px 16px; }
.kakao-preview-caption { font-size: 12px; margin-bottom: 10px; font-weight: 500; }
.kakao-preview-phone { border-radius: 14px; overflow: hidden; border: 1px solid rgba(60,30,30,0.15); box-shadow: 0 6px 20px rgba(15,23,42,0.1); background: #ffffff; }
.kakao-preview-topbar { background: #3c1e1e; color: #ffffff; font-size: 14px; font-weight: 600; text-align: center; padding: 11px 14px; letter-spacing: -0.02em; }
.kakao-preview-messages { background: #9bbbd4; min-height: 100px; padding: 16px 12px 14px; }
.kakao-preview-row { display: flex; justify-content: flex-end; }
.kakao-preview-bubble { max-width: 92%; background: #fee500; color: #191919; font-size: 14px; line-height: 1.5; padding: 10px 14px 10px 12px; border-radius: 12px; border-top-right-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,0.08); white-space: pre-wrap; word-break: break-word; }
.kakao-preview-time { text-align: right; font-size: 11px; color: rgba(25,25,25,0.5); margin-top: 8px; padding-right: 2px; }
.supply-table-card { overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 0; position: relative; overscroll-behavior-x: contain; scrollbar-color: rgba(61,79,181,0.38) rgba(61,79,181,0.08); scrollbar-width: thin; }
.supply-table-card::-webkit-scrollbar { height: 7px; }
.supply-table-card::-webkit-scrollbar-track { background: rgba(61,79,181,0.06); border-radius: 999px; }
.supply-table-card::-webkit-scrollbar-thumb { background: rgba(61,79,181,0.34); border-radius: 999px; }
.supply-table-card .table { min-width: 640px; }
.supply-table-card--dash .table { min-width: 800px; }
.supply-table-card--items .table { min-width: 580px; }
.supply-table-card--tpl .table { min-width: 820px; }
.supply-table-card .table thead th { position: sticky; top: 0; z-index: 1; box-shadow: 0 1px 0 rgba(61,79,181,0.14); }
.supply-table-card .table thead th:first-child { border-top-left-radius: 12px; left: 0; z-index: 4; background: #edf0f7; box-shadow: 6px 0 14px -8px rgba(15,23,42,0.16), 0 1px 0 rgba(61,79,181,0.14); }
.supply-table-card .table thead th:last-child { border-top-right-radius: 12px; }
.supply-table-card .table tbody td:first-child { position: sticky; left: 0; z-index: 2; background: var(--surface); box-shadow: 6px 0 14px -8px rgba(15,23,42,0.12); }
.supply-table-card .table tbody tr:hover td:first-child { background: rgba(61,79,181,0.045); }
.supply-table-card--tpl .table td .input { min-width: 7rem; }
.supply-table-card--tpl .table td .input[type="number"] { min-width: 4.25rem; }
.supply-table-card--tpl .table td select { min-width: 4.5rem; }
.supply-table-card--dash .table td:nth-child(7) { font-size: 13px; white-space: nowrap; }
.supply-table-card--dash .table td:nth-child(5) { max-width: min(280px, 36vw); word-break: break-word; }
.supply-table-card--items .table td:nth-child(4) { max-width: min(220px, 40vw); word-break: break-word; }
.login-card { max-width: 420px; margin: 0 auto; width: 100%; }
.supply-dashboard-toolbar { gap: 12px; }
.supply-dashboard-toolbar-form { flex: 1 1 auto; min-width: 0; }
@media (max-width: 900px) {
  .supply-app:not(.supply-app--guest) { flex-direction: column; }
  .sidebar { width: 100%; flex: none; min-height: 0; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; gap: 8px; border-right: none; border-bottom: 1px solid var(--border); box-shadow: none; }
  .sidebar-brand { padding: 0 12px 0 0; margin: 0; border: none; flex: 0 0 auto; }
  .sidebar-nav { flex: 1 1 auto; flex-direction: row; flex-wrap: wrap; padding: 0; gap: 6px; }
  .sidebar-link { padding: 8px 12px; }
  .sidebar-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; padding: 0; border: none; flex: 0 0 auto; }
  .sidebar-identity { gap: 10px; }
  .sidebar-avatar { width: 40px; height: 40px; font-size: 16px; line-height: 40px; }
  .sidebar-role-label { font-size: 14px; }
  .sidebar-logout { width: auto; }
  .main-head { padding: 16px 16px 0; }
  .main-title { font-size: 18px; }
}
@media (max-width: 820px) {
  .container { padding: 18px 16px; }
  .guest-top { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
  .grid, .grid3 { grid-template-columns: 1fr; }
  .field.field-filter { max-width: none; min-width: 0; flex: 1 1 100%; margin: 0 0 8px 0; }
  .supply-dashboard-toolbar { flex-direction: column; align-items: stretch; }
  .supply-dashboard-toolbar-form { width: 100%; }
  .supply-dashboard-toolbar-form.row > .btn-apply { flex: 1 1 auto; width: 100%; max-width: none; }
  .supply-dashboard-toolbar.row > .btn-new-request { flex: 1 1 auto; width: 100%; max-width: none; }
  .supply-table-card--dash .table { min-width: 720px; }
  .supply-table-card--items .table { min-width: 520px; }
  .supply-table-card--tpl .table { min-width: 700px; }
  .supply-table-card--dash .table td:nth-child(5) { max-width: 220px; }
  .supply-table-card--items .table td:nth-child(4) { max-width: 180px; }
  .request-form-actions { flex-direction: column-reverse; align-items: stretch; gap: 10px; }
  .request-form-actions > .btn, .request-form-actions > a.btn { width: 100%; text-align: center; }
}
@media (max-width: 640px) {
  .supply-table-card--dash .table { min-width: 660px; }
  .supply-table-card--items .table { min-width: 480px; }
  .supply-table-card--tpl .table { min-width: 620px; }
  .supply-table-card .table thead th { padding: 10px 10px; font-size: 11px; letter-spacing: -0.03em; }
  .supply-table-card .table td { padding: 10px 10px; font-size: 13px; line-height: 1.4; }
  .supply-table-card .table .pill { font-size: 12px; padding: 0 10px; min-height: 32px; height: 32px; }
  .supply-table-card .table td .dashboard-id-link { min-width: 2.75rem; padding: 4px 9px; font-size: 12px; }
  .dashboard-row-new-img { width: 32px; height: 32px; }
  .supply-table-card--dash .table td:nth-child(5) { max-width: 180px; }
  .supply-table-card--items .table td:nth-child(4) { max-width: 140px; }
}
@media (max-width: 480px) {
  .container { padding: 14px 12px; }
  .main-head { padding: 12px 12px 0; }
  .main-title { font-size: 17px; }
  .card { padding: 14px 12px; }
  .supply-table-card--dash .table { min-width: 600px; }
  .supply-table-card--items .table { min-width: 440px; }
  .supply-table-card--tpl .table { min-width: 560px; }
  .supply-table-card .table thead th { padding: 9px 8px; font-size: 10px; }
  .supply-table-card .table td { padding: 9px 8px; font-size: 12px; }
  .supply-table-card .table tbody td:first-child { box-shadow: 4px 0 10px -6px rgba(15,23,42,0.14); }
  .supply-table-card .table thead th:first-child { box-shadow: 4px 0 10px -6px rgba(15,23,42,0.14), 0 1px 0 rgba(61,79,181,0.14); }
  .table th, .table td { padding: 10px 12px; }
  .table th { font-size: 11px; }
  .btn-sm { font-size: 12px; }
  .login-card { max-width: none; margin: 0; }
  .supply-table-card--dash .table td:nth-child(5) { max-width: 160px; }
  .supply-table-card--items .table td:nth-child(4) { max-width: 120px; }
  .supply-table-card--tpl .table td .input { min-width: 5.5rem; font-size: 13px; padding: 8px 10px; }
  .supply-table-card--tpl .table td select { min-width: 3.75rem; font-size: 13px; padding: 8px 10px; }
}

/* 품목 템플릿 썸네일 */
.tpl-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--surface2); border: 1px solid var(--border); display: inline-block; vertical-align: middle; }
.tpl-thumb-empty { display: inline-flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); }
.tpl-image-cell { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.tpl-image-cell .tpl-image-file { font-size: 12px; padding: 4px; min-width: 0; max-width: 100%; }
.tpl-image-controls { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }

/* 재고 표시 (templates.php) */
.stock-display { display: inline-block; min-width: 36px; padding: 4px 10px; text-align: center; border-radius: 999px; background: var(--surface2); color: var(--text); font-weight: 700; font-size: 14px; }
.stock-display.stock-low { background: rgba(232,80,91,0.12); color: #b91c1c; }
.row-below-threshold td { background: rgba(232,80,91,0.04); }

/* 요청 구분 배지 (dashboard.php) */
.pill.type-purchase { background: rgba(124,58,237,0.12); color: #6d28d9; font-weight: 600; }
.pill.type-issue { background: rgba(15,23,42,0.06); color: var(--muted); font-weight: 500; }
.row-purchase td { background: rgba(124,58,237,0.04); }