/* dark mode only, always — not tied to system theme (see <meta color-scheme>
   in base.html too, for native form control / scrollbar chrome) */
:root{
  --bg:#1A1918; --surface:#211F1D; --surface-alt:#28251F;
  --ink:#EAE8E1; --ink-muted:#A6A29B; --line:#3B3733;
  /* brand orange, sampled from AIDOT_logo_white.png's ring mark (#FBAE26) */
  --accent:#FBAE26; --accent-soft:#3A2A0E; --accent-strong:#FFC966;
  --on-accent:#241800; /* text/icons sitting on a solid --accent fill; orange is too light for white text */
  --red:#E38A85; --red-soft:#3A2422;
  --amber:#D9A85F; --amber-soft:#372B18;
  --blue:#7FB6D6; --blue-soft:#1E313D;
  --gray:#A7ABA0; --gray-soft:#292B26;
  --green:#7FD996; --green-soft:#1E3A22;
  --yellow:#E3C24A; --yellow-soft:#3A3212;
  /* the top bar is a touch darker than the page body for definition, since
     the whole page is dark now too */
  --brand-bar-bg:#1C1A17;
  --brand-bar-line:#332F29;
}
*{box-sizing:border-box;}
/* always reserve the scrollbar's width, so short pages (AI 데모) don't shift sideways vs. long ones */
html{scrollbar-gutter:stable;}
@media (prefers-reduced-motion: reduce){ *{transition:none !important; animation:none !important;} }
body{
  margin:0; background:var(--bg); color:var(--ink);
  font-family:"Pretendard Variable",Pretendard,-apple-system,"Apple SD Gothic Neo","Malgun Gothic","Segoe UI",sans-serif;
  line-height:1.55;
}
a{color:inherit;}
.mono{font-family:"SFMono-Regular",Consolas,"Liberation Mono",Menlo,monospace;font-variant-numeric:tabular-nums;}

/* fixed dark bar regardless of page theme — see --brand-bar-* tokens */
.topbar{position:sticky;top:0;z-index:30;border-bottom:1px solid var(--brand-bar-line);background:var(--brand-bar-bg);}
.topbar-inner{max-width:1320px;margin:0 auto;padding:12px 24px;display:flex;align-items:center;gap:16px;flex-wrap:wrap;}
.brand{
  display:flex;align-items:center;gap:9px;text-decoration:none;color:#fff;
  padding-right:16px;margin-right:2px;border-right:1px solid var(--brand-bar-line);
}
.brand-logo{height:22px;width:auto;display:block;}
.brand-text{
  font-weight:600;font-size:11px;letter-spacing:.06em;text-transform:uppercase;
  color:rgba(255,255,255,.5);
}
.topbar nav{display:flex;gap:2px;flex-wrap:wrap;background:rgba(255,255,255,.05);padding:4px;border-radius:11px;}
.topbar nav a{text-decoration:none;color:rgba(255,255,255,.68);font-size:13.5px;font-weight:600;padding:7px 12px;border-radius:7px;}
.topbar nav a.active{background:var(--accent);color:var(--on-accent);}
.topbar nav a:hover{color:#fff;}
.topbar nav .nav-locked{color:rgba(255,255,255,.32);font-size:13.5px;font-weight:600;padding:7px 12px;border-radius:7px;cursor:not-allowed;user-select:none;white-space:nowrap;}

.topbar-user{display:flex;align-items:center;gap:10px;margin-left:auto;font-size:12.5px;}
.topbar-session-left{color:rgba(255,255,255,.4);font-size:11px;white-space:nowrap;}
.topbar-session-left:empty{display:none;}
.topbar-renew{
  background:var(--accent);border:1px solid var(--accent);color:var(--on-accent);
  font-family:inherit;font-size:11.5px;font-weight:700;padding:5px 10px;border-radius:7px;cursor:pointer;
  white-space:nowrap;
}
.topbar-renew:hover{filter:brightness(1.08);}
.topbar-renew:disabled{opacity:.6;cursor:default;}
.topbar-user-name{color:rgba(255,255,255,.75);white-space:nowrap;}
.topbar-logout{
  background:none;border:1px solid var(--brand-bar-line);color:rgba(255,255,255,.75);
  font-family:inherit;font-size:12px;font-weight:600;padding:5px 10px;border-radius:7px;cursor:pointer;
  text-decoration:none;display:inline-block;
}
.topbar-logout:hover{color:#fff;border-color:rgba(255,255,255,.3);}

/* on desktop .topbar-inner never actually wraps (everything fits on one
   line and .topbar-user's margin-left:auto pins it to the right edge), so
   centering here has no visible effect there. Once the brand/nav/user
   groups wrap to their own lines on a narrow phone, flexbox centers each
   line independently — without this they all sit flush left instead. */
@media (max-width:760px){
  .topbar-inner{justify-content:center;}
  .brand{border-right:none;padding-right:0;margin-right:0;}
  .topbar-user{margin-left:0;flex-wrap:wrap;justify-content:center;row-gap:6px;}
}
/* four top tabs still fit one row on a ~375px phone */
@media (max-width:420px){
  .topbar nav a{padding:7px 8px;font-size:12.5px;}
}

.wrap{max-width:1320px;margin:0 auto;padding:18px 16px 80px;}
@media (min-width:640px){ .wrap{padding:20px 24px 80px;} }

/* sub-navigation between views under one top-level tab (운영 버전: AI / 서비스) */
.subtabs{display:flex;gap:18px;margin-bottom:12px;border-bottom:1px solid var(--line);}
.subtab{
  font-family:inherit;font-size:13.5px;font-weight:600;color:var(--ink-muted);
  text-decoration:none;padding:8px 2px 10px;border-bottom:2px solid transparent;margin-bottom:-1px;
}
.subtab.active{color:var(--accent-strong);border-bottom-color:var(--accent);}
.subtab:hover{color:var(--ink);}

.page-head{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;margin-bottom:12px;flex-wrap:wrap;}
.page-head-actions{display:flex;gap:8px;flex-wrap:wrap;}
h1{font-size:20px;margin:0 0 4px;letter-spacing:-.01em;}
@media (min-width:640px){ h1{font-size:22px;} }
.sub{font-size:13px;color:var(--ink-muted);margin:0;}
.sub a{color:var(--accent-strong);text-decoration:none;}
.sub code{
  font-family:"SFMono-Regular",Consolas,"Liberation Mono",Menlo,monospace;font-size:11.5px;
  background:var(--surface-alt);border-radius:4px;padding:1px 5px;word-break:break-all;
}

.btn{
  display:inline-block;font-family:inherit;font-size:13.5px;font-weight:600;
  border:1px solid var(--line);background:var(--surface);color:var(--ink);
  border-radius:8px;padding:9px 14px;text-decoration:none;cursor:pointer;
  min-height:38px;line-height:20px;
}
.btn-primary{background:var(--accent);border-color:var(--accent);color:var(--on-accent);}
.btn-disabled{opacity:.4;pointer-events:none;}

.toolbar{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:10px;}
.toolbar input[type=text]{flex:1 1 160px;min-width:0;}
.toolbar select{flex:0 1 auto;}
.toolbar input, .toolbar select{
  font-family:inherit;font-size:13.5px;padding:9px 10px;border:1px solid var(--line);
  border-radius:8px;background:var(--surface);color:var(--ink);min-height:38px;
}
.result-count{font-size:12.5px;color:var(--ink-muted);margin:0 0 10px;}
.result-bar{display:flex;align-items:center;justify-content:space-between;gap:8px 14px;flex-wrap:wrap;margin-bottom:10px;}
.result-bar .result-count{margin:0;}
.page-size{display:flex;align-items:center;gap:4px;font-size:12px;color:var(--ink-muted);}
.page-size a{
  text-decoration:none;font-weight:600;color:var(--ink-muted);padding:3px 8px;border-radius:6px;
  border:1px solid var(--line);font-variant-numeric:tabular-nums;
}
.page-size a.active{background:var(--accent);border-color:var(--accent);color:var(--on-accent);}
.page-size-label{margin-left:2px;}

.sort-bar{display:flex;gap:10px;align-items:center;flex-wrap:wrap;font-size:12.5px;color:var(--ink-muted);margin-bottom:10px;}
.sort-link{color:var(--ink-muted);text-decoration:none;font-weight:600;}
.sort-link:hover{color:var(--accent-strong);}
th .sort-link{color:inherit;text-decoration:none;display:inline-flex;align-items:center;gap:3px;}
th .sort-link:hover{color:var(--accent-strong);}
.sort-arrow{font-size:10px;}

.pager{display:flex;align-items:center;justify-content:center;gap:14px;margin-top:18px;flex-wrap:wrap;}
.pager-info{font-size:12.5px;color:var(--ink-muted);}

.table-scroll{overflow-x:auto;border:1px solid var(--line);border-radius:10px;}
table{width:100%;border-collapse:collapse;background:var(--surface);font-size:13px;min-width:900px;}
th,td{text-align:left;padding:10px 12px;border-bottom:1px solid var(--line);vertical-align:top;}
thead th{background:var(--surface-alt);font-size:10.5px;text-transform:uppercase;letter-spacing:.05em;color:var(--ink-muted);font-weight:700;white-space:nowrap;}
tbody tr:last-child td{border-bottom:none;}
tbody tr:hover{background:var(--surface-alt);}
td.truncate{max-width:260px;}
.empty{color:var(--ink-muted);text-align:center;padding:26px;}

.chip{display:inline-block;font-size:11px;font-weight:700;padding:2.5px 8px;border-radius:999px;background:var(--gray-soft);color:var(--gray);white-space:nowrap;}
.chip.status-접수{background:var(--gray-soft);color:var(--gray);}
.chip.status-진행중{background:var(--amber-soft);color:var(--amber);}
.chip.status-완료{background:var(--green-soft);color:var(--green);}
.chip.status-보류{background:var(--red-soft);color:var(--red);}
.chip.err-FN{background:var(--red-soft);color:var(--red);}
.chip.err-FP{background:var(--amber-soft);color:var(--amber);}
.chip.err-TP{background:var(--accent-soft);color:var(--accent-strong);}
.chip.ai-status-해결{background:var(--green-soft);color:var(--green);}
.chip.ai-status-미해결{background:var(--yellow-soft);color:var(--yellow);}
.chip.ai-status-제외{background:var(--gray-soft);color:var(--gray);}
.chip.priority-낮음{background:var(--gray-soft);color:var(--gray);}
.chip.priority-보통{background:var(--blue-soft);color:var(--blue);}
.chip.priority-높음{background:var(--amber-soft);color:var(--amber);}
.chip.priority-긴급{background:var(--red-soft);color:var(--red);}

.row-actions{display:flex;gap:10px;align-items:center;white-space:nowrap;}
.row-actions a{font-size:12.5px;color:var(--accent-strong);text-decoration:none;font-weight:600;}
.row-actions form{display:inline;}

.view-panel{background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:18px;max-width:820px;}
.modal-body .view-panel{border:none;padding:0;max-width:none;}
.view-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px 16px;margin-bottom:14px;}
@media (max-width:640px){.view-grid{grid-template-columns:1fr;}}
.view-field{display:flex;flex-direction:column;gap:4px;margin-bottom:14px;}
.view-grid .view-field{margin-bottom:0;}
.view-label{font-size:10.5px;font-weight:700;color:var(--ink-muted);text-transform:uppercase;letter-spacing:.04em;}
.view-value{font-size:13.5px;color:var(--ink);}
.view-value.multiline{white-space:pre-wrap;line-height:1.6;}
.view-meta{margin-top:8px;padding-top:14px;border-top:1px dashed var(--line);}
.view-meta .view-value{color:var(--ink-muted);font-size:12px;}
.link-danger{
  background:none;border:none;padding:0;font-family:inherit;font-size:12.5px;font-weight:600;
  color:var(--red);cursor:pointer;text-decoration:underline;
}

.record-form{background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:18px;max-width:820px;}
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:14px 16px;margin-bottom:6px;}
@media (max-width:640px){.grid-2{grid-template-columns:1fr;}}
label{display:flex;flex-direction:column;gap:5px;font-size:12.5px;font-weight:600;color:var(--ink-muted);margin-bottom:14px;}
label[hidden]{display:none;}
label.block{display:flex;}
.field-product{grid-column:1 / -1;}
/* same look as a <label>, for pill groups (tag-select): a real <label> would
   pass clicks on its empty space to the first pill and toggle it */
.field-label{display:flex;flex-direction:column;gap:5px;font-size:12.5px;font-weight:600;color:var(--ink-muted);margin-bottom:14px;}
.field-hint{font-weight:400;text-transform:none;letter-spacing:0;color:var(--ink-muted);font-size:11.5px;}
input, select, textarea{
  font-family:inherit;font-size:16px;color:var(--ink);background:var(--bg);
  border:1px solid var(--line);border-radius:8px;padding:9px 11px;width:100%;
}
@media (min-width:640px){ input, select, textarea{ font-size:14px; } }
textarea{resize:vertical;font-family:inherit;}
.form-actions{display:flex;gap:10px;margin-top:8px;flex-wrap:wrap;}
.danger-zone{margin-top:18px;padding-top:14px;border-top:1px dashed var(--line);max-width:820px;}

.photo-gallery{display:flex;flex-wrap:wrap;gap:12px;margin-top:16px;max-width:820px;}
.photo-thumb{
  position:relative;width:92px;height:92px;border-radius:12px;overflow:hidden;
  border:1px solid var(--line);box-shadow:0 2px 8px rgba(0,0,0,.25);
}
.photo-thumb img{width:100%;height:100%;object-fit:cover;display:block;cursor:pointer;}
.photo-thumb form{position:absolute;top:4px;right:4px;}
.photo-thumb-delete{
  width:22px;height:22px;border-radius:50%;border:none;cursor:pointer;
  background:rgba(20,18,16,.7);color:#fff;font-size:11px;line-height:1;backdrop-filter:blur(2px);
}
.photo-thumb-delete:hover{background:var(--red);}
.photo-count{font-size:11px;color:var(--ink-muted);white-space:nowrap;}

/* full-size photo viewer — opened in place of the browser's own new-tab
   navigation when a saved photo thumbnail is clicked (see initLightbox in
   app.js). Deliberately its own class, not .modal — that component is
   sized/padded for a form card, this needs to fill the viewport instead. */
.lightbox-modal{
  border:none;margin:0;padding:0;max-width:100vw;max-height:100vh;width:100vw;height:100vh;
  background:rgba(10,9,8,.92);
}
.lightbox-modal::backdrop{background:rgba(10,9,8,.92);}
.lightbox-modal[open]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;}
.lightbox-stage{display:flex;align-items:center;justify-content:center;gap:16px;max-width:100%;}
#lightbox-img{max-width:min(88vw,1100px);max-height:78vh;object-fit:contain;border-radius:10px;display:block;}
.lightbox-close{
  position:absolute;top:18px;right:18px;width:38px;height:38px;border-radius:50%;border:none;cursor:pointer;
  background:rgba(255,255,255,.12);color:#fff;font-size:16px;line-height:1;
}
.lightbox-close:hover{background:rgba(255,255,255,.22);}
.lightbox-nav{
  flex:none;width:44px;height:44px;border-radius:50%;border:none;cursor:pointer;
  background:rgba(255,255,255,.12);color:#fff;font-size:22px;line-height:1;
}
.lightbox-nav:hover{background:rgba(255,255,255,.22);}
.lightbox-nav[hidden]{display:none;}
.lightbox-count{color:rgba(255,255,255,.7);font-size:12.5px;font-variant-numeric:tabular-nums;}
@media (max-width:640px){
  .lightbox-stage{gap:6px;}
  .lightbox-nav{width:36px;height:36px;font-size:18px;}
  #lightbox-img{max-width:80vw;}
}

/* click-or-drag photo uploader — the native <input type=file> stays
   `hidden`; the surrounding <label> is the whole visible dropzone, which
   still forwards a click to the input per normal label/control semantics.
   Drag-and-drop and the "n / max" counter are wired up in app.js. */
.block-label{display:block;font-size:12.5px;font-weight:600;color:var(--ink-muted);margin-bottom:8px;}
.photo-uploader{margin-bottom:16px;}
.photo-dropzone{
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;
  border:1.5px dashed var(--line);border-radius:12px;padding:22px 16px;text-align:center;
  cursor:pointer;background:var(--surface-alt);transition:border-color .15s,background .15s;
}
.photo-dropzone:hover, .photo-dropzone.dragover{border-color:var(--accent);background:var(--accent-soft);}
.photo-dropzone-icon{
  width:30px;height:30px;border-radius:50%;background:var(--surface);border:1px solid var(--line);
  display:flex;align-items:center;justify-content:center;font-size:16px;color:var(--ink-muted);
}
.photo-dropzone-text{font-size:12.5px;font-weight:600;color:var(--ink);}
.photo-dropzone-count{font-size:11px;color:var(--ink-muted);font-variant-numeric:tabular-nums;}
.photo-preview-grid{display:flex;flex-wrap:wrap;gap:10px;margin-top:12px;}
.photo-preview-grid:empty{margin-top:0;}
.photo-preview-thumb{
  position:relative;width:76px;height:76px;border-radius:10px;overflow:hidden;
  border:1px solid var(--line);box-shadow:0 2px 8px rgba(0,0,0,.25);
}
.photo-preview-thumb img{width:100%;height:100%;object-fit:cover;display:block;}
.photo-preview-remove{
  position:absolute;top:4px;right:4px;width:20px;height:20px;border-radius:50%;border:none;cursor:pointer;
  background:rgba(20,18,16,.7);color:#fff;font-size:10px;line-height:1;
}
.photo-preview-remove:hover{background:var(--red);}

/* tag-style select used for the product field */
.tag-select{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px;}
.tag-option{
  display:inline-block;font-family:inherit;font-size:12.5px;font-weight:600;color:var(--ink-muted);
  background:var(--surface);border:1px solid var(--line);border-radius:999px;
  padding:6px 12px;cursor:pointer;text-decoration:none;line-height:1.3;
}
.tag-option[aria-pressed="true"]{background:var(--accent);border-color:var(--accent);color:var(--on-accent);}

/* list-page filters: same pill-toggle look as the form's tag-select,
   but each pill is a link that jumps straight to the filtered results —
   no separate "search" step needed once you click one. */
.filter-row{display:flex;flex-wrap:wrap;gap:8px 16px;margin-bottom:10px;}
.filter-group{display:flex;flex-wrap:wrap;align-items:center;gap:6px;}
/* a faint divider between neighbouring filter groups (e.g. 제품 | 상태) */
.filter-group + .filter-group{border-left:1px solid var(--line);padding-left:16px;}
.filter-label{font-size:11.5px;font-weight:700;color:var(--ink-muted);text-transform:uppercase;letter-spacing:.04em;margin-right:2px;}

.qna-list{display:flex;flex-direction:column;gap:10px;}
.qna-card{background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:14px 16px;}
.qna-meta{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-bottom:8px;font-size:12px;color:var(--ink-muted);}
.qna-meta .row-actions{margin-left:auto;}
.qna-q{font-size:14px;font-weight:600;margin-bottom:6px;}
.qna-a{font-size:13.5px;color:var(--ink-muted);white-space:pre-wrap;}

/* modal */
dialog.modal{
  border:none;border-radius:14px;padding:0;max-width:min(760px, 92vw);width:100%;
  background:var(--surface);color:var(--ink);box-shadow:0 20px 60px rgba(0,0,0,.25);
}
dialog.modal::backdrop{background:rgba(24,22,20,.55);}
.modal-body{padding:20px;max-height:88vh;overflow-y:auto;}
.modal-body .record-form{border:none;padding:0;max-width:none;}
.modal-body .danger-zone{max-width:none;}
.modal-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px;}
.modal-head h2{font-size:17px;margin:0;}
.modal-close{
  background:none;border:none;font-size:18px;line-height:1;color:var(--ink-muted);cursor:pointer;
  padding:6px;border-radius:6px;
}
.modal-close:hover{color:var(--ink);background:var(--surface-alt);}
.modal-loading{color:var(--ink-muted);font-size:13.5px;padding:20px 0;text-align:center;}
.modal-note{font-size:12.5px;color:var(--ink-muted);margin:0 0 16px;}
.modal-note code{
  font-family:"SFMono-Regular",Consolas,"Liberation Mono",Menlo,monospace;font-size:11.5px;
  background:var(--surface-alt);border-radius:4px;padding:1px 5px;word-break:break-all;
}

.version-list{list-style:none;margin:0 0 16px;padding:0;display:flex;flex-direction:column;gap:6px;}
.version-list li{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  background:var(--surface-alt);border-radius:8px;padding:8px 12px;
}
.version-list .version-label{font-family:"SFMono-Regular",Consolas,monospace;font-weight:700;font-size:13px;}
.version-list .empty-inline{color:var(--ink-muted);font-size:12.5px;justify-content:center;}
.version-add-form{display:flex;gap:8px;flex-wrap:wrap;}
.version-add-form input{flex:1;min-width:100px;}
.version-add-form select{flex:0 0 auto;}

.version-hint{font-size:12.5px;color:var(--ink-muted);margin:0 0 10px;}

/* per-tab statistics panel (collapsed by default) */
.stats-panel{background:var(--surface);border:1px solid var(--line);border-radius:10px;margin-bottom:10px;}
.stats-panel summary{cursor:pointer;padding:9px 16px;font-size:13.5px;font-weight:600;list-style:none;}
.stats-panel summary::-webkit-details-marker{display:none;}
.stats-panel summary::before{content:"›";display:inline-block;width:14px;color:var(--ink-muted);}
.stats-panel[open] summary::before{content:"⌄";}
.stats-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:10px;padding:0 16px 14px;}
.help-body{padding:0 16px 16px;font-size:13px;color:var(--ink-muted);line-height:1.65;}
.help-body p{margin:0 0 8px;}
.help-body p:last-child{margin-bottom:0;}
.help-body strong{color:var(--ink);}
.stat{background:var(--surface-alt);border-radius:8px;padding:10px 12px;}
.stat-num{font-size:20px;font-weight:700;font-family:"SFMono-Regular",Consolas,monospace;font-variant-numeric:tabular-nums;}
.stat-label{font-size:11px;color:var(--ink-muted);margin-top:2px;}
.stats-breakdown{display:flex;flex-wrap:wrap;gap:16px;padding:0 16px 16px;border-top:1px solid var(--line);padding-top:14px;}
.breakdown-group{display:flex;flex-wrap:wrap;align-items:center;gap:6px;}
.breakdown-label{font-size:11px;font-weight:700;color:var(--ink-muted);text-transform:uppercase;letter-spacing:.04em;margin-right:2px;}

/* stacked-bar visualization inside a stats panel (proportions, not exact plotting) */
.stat-viz{padding:14px 16px 16px;border-top:1px solid var(--line);}
.stat-viz .breakdown-label{display:block;margin-bottom:8px;}
.stat-bar{display:flex;height:10px;border-radius:999px;overflow:hidden;background:var(--surface-alt);margin-bottom:10px;}
.stat-bar-seg{height:100%;}
.stat-bar-legend{display:flex;flex-wrap:wrap;gap:12px;font-size:11.5px;color:var(--ink-muted);}
.legend-item{display:flex;align-items:center;gap:5px;}
.legend-dot{width:8px;height:8px;border-radius:50%;display:inline-block;flex:none;}

/* shared color vocabulary for both the stacked bars above and any chip
   whose class name matches one of these (see ISSUE_STATUS_COLOR etc. in
   main.py) — one place to keep a status's color consistent everywhere */
.stat-bar-seg.seg-red, .legend-dot.seg-red{background:var(--red);}
.stat-bar-seg.seg-amber, .legend-dot.seg-amber{background:var(--amber);}
.stat-bar-seg.seg-accent, .legend-dot.seg-accent{background:var(--accent);}
.stat-bar-seg.seg-blue, .legend-dot.seg-blue{background:var(--blue);}
.stat-bar-seg.seg-gray, .legend-dot.seg-gray{background:var(--gray);}
.stat-bar-seg.seg-green, .legend-dot.seg-green{background:var(--green);}
.stat-bar-seg.seg-yellow, .legend-dot.seg-yellow{background:var(--yellow);}

/* ranked / progress bar list — one label + one fill + one value per row.
   Used both for "top N" rankings (fill scaled to the largest entry) and
   for genuine 0–100% progress (per-version completion rate). */
.bar-list{display:flex;flex-direction:column;gap:8px;}
.bar-row{display:flex;align-items:center;gap:10px;}
.bar-label{
  flex:0 0 120px;font-size:12px;color:var(--ink-muted);white-space:nowrap;
  overflow:hidden;text-overflow:ellipsis;
}
.bar-track{flex:1;height:10px;border-radius:999px;background:var(--surface-alt);overflow:hidden;}
.bar-fill{height:100%;background:var(--accent);border-radius:999px;}
.bar-value{flex:0 0 auto;min-width:38px;text-align:right;font-size:12px;font-weight:700;font-variant-numeric:tabular-nums;}

/* login pages — no topbar/nav (unauthenticated), just a centered card */
.login-page{
  margin:0;min-height:100vh;background:var(--bg);color:var(--ink);
  display:flex;align-items:center;justify-content:center;padding:24px;
  font-family:"Pretendard Variable",Pretendard,-apple-system,"Apple SD Gothic Neo","Malgun Gothic","Segoe UI",sans-serif;
}
.login-card{
  width:100%;max-width:360px;background:var(--surface);border:1px solid var(--line);
  border-radius:14px;padding:32px 28px;box-shadow:0 20px 60px rgba(0,0,0,.35);
}
.login-logo{height:26px;width:auto;display:block;margin:0 auto 22px;}
.login-title{font-size:18px;margin:0 0 6px;text-align:center;}
.login-sub{font-size:12.5px;color:var(--ink-muted);margin:0 0 20px;text-align:center;line-height:1.6;}
.login-notice{
  font-size:12px;color:var(--accent-strong);background:var(--accent-soft);
  border-radius:8px;padding:8px 10px;margin:0 0 16px;line-height:1.5;
}
.login-error{
  font-size:12.5px;color:var(--red);background:var(--red-soft);
  border-radius:8px;padding:8px 10px;margin:0 0 16px;line-height:1.5;
}
.login-form{display:flex;flex-direction:column;}
.login-email-row{display:flex;align-items:center;gap:8px;}
.login-email-row input{flex:1;min-width:0;}
.login-email-suffix{font-size:13.5px;color:var(--ink-muted);white-space:nowrap;}
.login-checkbox{
  flex-direction:row;align-items:center;gap:7px;font-weight:400;color:var(--ink);
  font-size:13px;margin-bottom:18px;
}
.login-checkbox input{width:auto;}
.login-submit{width:100%;text-align:center;}
.login-resend{margin-top:14px;text-align:center;}
.link-btn{
  background:none;border:none;padding:0;font-family:inherit;font-size:12.5px;font-weight:600;
  color:var(--accent-strong);cursor:pointer;text-decoration:underline;
}
.login-alt{
  margin-top:18px;padding-top:16px;border-top:1px solid var(--line);
  display:flex;align-items:center;justify-content:center;gap:8px;flex-wrap:wrap;
}
.login-alt .link-btn{font-size:12px;font-weight:600;color:var(--ink-muted);}
.login-alt-sep{color:var(--line);font-size:11px;}

/* small status toast — appears, holds, fades on its own (no dismiss button) */
@keyframes toast-fade{
  0%{opacity:0;transform:translate(-50%,8px);}
  10%{opacity:1;transform:translate(-50%,0);}
  80%{opacity:1;transform:translate(-50%,0);}
  100%{opacity:0;transform:translate(-50%,0);}
}
.toast{
  position:fixed;left:50%;bottom:28px;transform:translate(-50%,0);
  background:var(--surface);border:1px solid var(--line);color:var(--ink);
  font-size:13px;font-weight:600;padding:10px 18px;border-radius:999px;
  box-shadow:0 10px 30px rgba(0,0,0,.35);
  animation:toast-fade 3.2s ease forwards;pointer-events:none;z-index:60;
}
@media (prefers-reduced-motion: reduce){
  .toast{animation:none;opacity:1;}
}

/* 운영 버전 (AI / 서비스) */
.section-title{font-size:15px;margin:24px 0 10px;}
.section-title:first-of-type{margin-top:8px;}
.view-switch{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:10px;}
.nowrap{white-space:nowrap;}
.multiline{white-space:pre-wrap;}
.muted{color:var(--ink-muted);}
td.cell-wide{min-width:220px;}
.cell-note{font-size:11.5px;color:var(--ink-muted);margin-top:2px;word-break:break-all;}
td.cell-note-col{max-width:220px;font-size:12px;color:var(--ink-muted);}
td.ver{white-space:nowrap;font-size:12px;}
td.cell-min{min-width:120px;}
.status-stack{display:flex;flex-direction:column;align-items:flex-start;gap:4px;}
.clamp{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;white-space:pre-wrap;}
tr.group-row td{
  background:var(--bg);font-size:11.5px;font-weight:700;color:var(--accent-strong);
  letter-spacing:.03em;padding:9px 12px;
}
tbody tr.group-row:hover{background:var(--bg);}
.group-count{color:var(--ink-muted);font-weight:600;margin-left:4px;}
.deploy-chips{display:flex;flex-wrap:wrap;gap:4px;max-width:420px;}
.chip-date{font-weight:500;opacity:.75;font-family:"SFMono-Regular",Consolas,monospace;font-size:10px;}
.chip.deploy-current{background:var(--green-soft);color:var(--green);}
.chip.deploy-past{text-decoration:line-through;opacity:.5;}
.chip.version-latest{background:var(--green-soft);color:var(--green);}
.chip.version-behind{background:var(--amber-soft);color:var(--amber);}
.chip.update-Major{background:var(--accent-soft);color:var(--accent-strong);}
.chip.update-Minor{background:var(--blue-soft);color:var(--blue);}
.chip.update-Patch{background:var(--gray-soft);color:var(--gray);}
.chip.svc-ON{background:var(--green-soft);color:var(--green);}
.chip.svc-STOP{background:var(--red-soft);color:var(--red);}
.chip.svc-일시정지{background:var(--yellow-soft);color:var(--yellow);}
.chip.svc-종료{background:var(--gray-soft);color:var(--gray);}
.tag-option.archived{border-style:dashed;opacity:.6;}
.tag-option.archived[aria-pressed="true"]{opacity:1;}
/* the "not in use any more" corner: collapsed, dimmed, below everything */
.archive-panel{margin-top:22px;}
.archive-panel summary{color:var(--ink-muted);}
.archive-hint{font-size:12.5px;color:var(--ink-muted);margin:0 16px 12px;}
.archive-table{margin:0 16px 16px;opacity:.8;}
.append-chips{display:flex;flex-wrap:wrap;gap:6px;margin:-6px 0 14px;}
.append-chips .tag-option{font-size:11.5px;padding:4px 10px;}
.product-switch{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin-bottom:8px;}
.ref-links{display:flex;flex-wrap:wrap;align-items:center;gap:6px 16px;margin:-6px 0 16px;font-size:12.5px;}
.ref-links a{color:var(--accent-strong);text-decoration:none;font-weight:600;}
.ref-links a:hover{text-decoration:underline;}
td.ver-changed{color:var(--accent-strong);font-weight:700;}
details.history{margin-top:6px;}
details.history summary{cursor:pointer;color:var(--accent-strong);font-weight:600;font-size:11.5px;}
details.history ol{margin:6px 0 0;padding-left:18px;font-size:11.5px;line-height:1.55;}
details.history li{margin-bottom:4px;}
label.checkbox-row{flex-direction:row;align-items:center;gap:7px;font-weight:400;color:var(--ink);font-size:13px;}
label.checkbox-row input{width:auto;}

/* mobile: turn data tables into stacked cards */
@media (max-width:720px){
  .table-scroll{overflow-x:visible;border:none;}
  table{min-width:0;}
  thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;}
  table, tbody, tr, td{display:block;width:100%;}
  tbody tr{
    border:1px solid var(--line);border-radius:10px;margin-bottom:10px;padding:10px 12px;background:var(--surface);
  }
  tbody tr:hover{background:var(--surface);}
  td{border:none;padding:6px 0;display:flex;gap:10px;align-items:flex-start;}
  td.truncate{max-width:none;}
  td[data-label]:not([data-label=""])::before{
    content:attr(data-label);flex:0 0 84px;font-size:10.5px;font-weight:700;text-transform:uppercase;
    letter-spacing:.04em;color:var(--ink-muted);padding-top:2px;
  }
  td.actions-cell{justify-content:flex-end;padding-top:10px;border-top:1px dashed var(--line);margin-top:4px;}
  .empty{padding:20px 0;}
  tbody tr.group-row{border:none;background:none;padding:14px 0 2px;margin-bottom:2px;}
  tr.group-row td{background:none;padding:0;}
  td.cell-wide, td.cell-note-col{min-width:0;max-width:none;}
  td.ver{white-space:normal;word-break:break-all;}
  /* cells holding several lines (name + notes, history) stack under their label */
  td.cell-wide, td.cell-min, td.cell-note-col{display:block;}
  td.cell-wide[data-label]::before, td.cell-min[data-label]::before, td.cell-note-col[data-label]::before{display:block;margin-bottom:4px;}
  .archive-table{margin:0 12px 12px;}
}

/* links carried over from the version workbooks (manager pages, build files, issues) */
a.cell-link, a.issue-link{color:var(--accent-strong);text-decoration:none;}
a.cell-link:hover, a.issue-link:hover{text-decoration:underline;}
details.link-fields{margin-bottom:14px;}
details.link-fields summary{cursor:pointer;font-size:12.5px;font-weight:600;color:var(--ink-muted);margin-bottom:10px;}
.view-history li{font-size:12.5px;line-height:1.6;display:block;}

/* AI 데모 (Cerviray AI demo page, ported from the public demo site) */
.btn[hidden], .demo-legend[hidden]{display:none;}
#demo-upload h1{margin-bottom:14px;}
.demo-dropzone{min-height:150px;}
.demo-thumbs{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;}
.demo-thumbs:empty{display:none;}
.demo-thumbs img{width:54px;height:54px;object-fit:cover;border-radius:8px;border:1px solid var(--line);}
.demo-actions{display:flex;align-items:center;justify-content:space-between;gap:10px 16px;flex-wrap:wrap;margin:12px 0 18px;}
.demo-actions .demo-mode{margin:0;}
.demo-buttons{display:flex;gap:8px;}
.demo-results{display:flex;flex-direction:column;gap:14px;}
.demo-result{
  display:grid;grid-template-columns:minmax(0, 420px) minmax(0, 1fr);gap:18px;align-items:start;
  background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:14px;
}
@media (max-width:760px){ .demo-result{grid-template-columns:1fr;} }
.demo-image{position:relative;line-height:0;}
.demo-image img{width:100%;height:auto;border-radius:8px;cursor:zoom-in;display:block;}
.demo-image canvas, .demo-modal-stage canvas{position:absolute;top:0;left:0;pointer-events:none;}
.demo-file-name{font-size:11.5px;color:var(--ink-muted);margin-bottom:8px;word-break:break-all;}
.demo-message{font-size:14px;line-height:1.7;margin:0 0 10px;}
.demo-strong{font-weight:700;}
.demo-toggle{margin:4px 0 0;}
.demo-image-modal{
  border:none;margin:auto;padding:16px;max-width:96vw;max-height:96vh;background:rgba(10,9,8,.96);color:#fff;border-radius:12px;
}
.demo-image-modal::backdrop{background:rgba(10,9,8,.9);}
.demo-modal-stage{position:relative;line-height:0;}
.demo-modal-stage img{display:block;max-width:min(92vw, 1200px);max-height:80vh;width:auto;height:auto;border-radius:8px;}
.demo-legend{
  position:absolute;right:10px;top:10px;background:rgba(0,0,0,.7);padding:8px 10px;border-radius:6px;
  font-size:13px;line-height:1.6;
}
.demo-legend div{display:flex;align-items:center;gap:6px;}
.demo-swatch{width:10px;height:10px;display:inline-block;}
.demo-modal-toggle{margin:12px 0 0;color:#fff;}
/* Advanced Mode raw-response panel */
.debug-panel{font-size:12.5px;color:var(--ink);}
.debug-summary{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:10px;}
.debug-chip{background:var(--surface-alt);border-radius:6px;padding:4px 10px;}
.debug-key{color:var(--blue);font-weight:700;margin-right:6px;}
.debug-section{margin-top:10px;background:var(--surface-alt);border-radius:8px;padding:8px 10px;}
.debug-section-title{color:var(--accent-strong);font-weight:700;margin-bottom:6px;}
.debug-table{width:100%;min-width:0;border-collapse:collapse;background:none;font-size:12px;}
.debug-table td{padding:4px 8px;border-bottom:1px solid var(--line);vertical-align:top;word-break:break-word;}
.debug-table td.debug-key{white-space:nowrap;width:1%;}
.debug-num{font-family:"SFMono-Regular",Consolas,monospace;}
.debug-null{color:var(--ink-muted);font-style:italic;}
.debug-details summary{cursor:pointer;color:var(--accent-strong);}
.debug-raw{white-space:pre-wrap;font-family:"SFMono-Regular",Consolas,monospace;font-size:11px;color:var(--ink-muted);margin:4px 0 0;}
@media (max-width:720px){
  /* the global "tables become cards" rule shouldn't restyle the debug tables */
  .debug-table, .debug-table tbody, .debug-table tr, .debug-table td{display:revert;width:auto;}
  .debug-table tr{border:none;margin:0;padding:0;background:none;}
}
.demo-engine{display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:12.5px;color:var(--ink-muted);margin:-8px 0 0;}
td.access-block{white-space:pre-wrap;font-size:11.5px;line-height:1.55;min-width:180px;max-width:280px;word-break:break-word;}
.access-api{margin-bottom:4px;word-break:break-all;}
.photo-download{margin-top:14px;}
.photo-download .btn{font-size:12.5px;min-height:32px;padding:6px 12px;}
.legend-note{font-size:12px;color:var(--ink-muted);margin:0 0 6px;}
.ver-changed-sample{color:var(--accent-strong);font-weight:700;margin-right:4px;}

/* column headers stay pinned under the top bar while the page scrolls.
   A scroll container would capture the sticky header, so on desktop the
   wrapper stops clipping (very narrow desktop windows scroll the page
   sideways instead); phones get the stacked-card layout and no thead. */
@media (min-width:721px){
  .table-scroll{overflow:visible;}
  .table-scroll thead th{position:sticky;top:calc(var(--topbar-h, 64px) + var(--sticky-head-h, 0px));z-index:5;box-shadow:0 1px 0 var(--line);}
  .table-scroll thead th:first-child{border-top-left-radius:9px;}
  .table-scroll thead th:last-child{border-top-right-radius:9px;}
  .table-scroll table.no-sticky thead th{position:static;box-shadow:none;}
}
.bar-list.wide .bar-label{flex-basis:200px;}
@media (max-width:640px){ .bar-list.wide .bar-label{flex-basis:110px;} }
/* service version tables: bigger row titles, builds split over two lines */
.row-title{font-size:14.5px;}
.build{display:inline-flex;flex-direction:column;gap:2px;line-height:1.35;}
.build-cfg{font-size:11px;opacity:.75;}
td.api-col{min-width:250px;}
td.access-block.bastion-col{min-width:100px;max-width:170px;}
@media (max-width:720px){ td.api-col{min-width:0;} }
label.copy-from{background:var(--surface-alt);border-radius:10px;padding:12px 14px;}
label.copy-from select{margin-top:2px;}
.block-head{display:flex;align-items:center;justify-content:space-between;gap:8px;}
.block-head .link-btn{font-size:11.5px;}
.copy-notice{font-size:12.5px;color:var(--accent-strong);background:var(--accent-soft);border-radius:8px;padding:8px 12px;margin:0 0 14px;}

/* click-to-change chips (제품 이슈 종류/우선순위/상태, AI 피드백 상태) */
button.quick-chip{border:none;font-family:inherit;cursor:pointer;}
button.quick-chip:hover{filter:brightness(1.25);box-shadow:0 0 0 1px var(--line);}
button.quick-chip:disabled{opacity:.5;cursor:wait;}
.chip.quick-empty{background:none;border:1px dashed var(--line);color:var(--ink-muted);}
.quick-menu{
  position:absolute;z-index:70;min-width:110px;display:flex;flex-direction:column;padding:4px;
  background:var(--surface);border:1px solid var(--line);border-radius:10px;box-shadow:0 10px 30px rgba(0,0,0,.4);
}
.quick-menu-item{
  font-family:inherit;font-size:12.5px;font-weight:600;text-align:left;color:var(--ink);background:none;
  border:none;border-radius:6px;padding:7px 10px;cursor:pointer;
}
.quick-menu-item:hover{background:var(--surface-alt);}
.quick-menu-item.current{color:var(--accent-strong);}
/* ▾ marks a chip as a dropdown you can click to change */
button.quick-chip{display:inline-flex;align-items:center;gap:5px;}
button.quick-chip::after{
  content:"";width:0;height:0;margin-left:1px;opacity:.85;
  border-left:5px solid transparent;border-right:5px solid transparent;border-top:6px solid currentColor;
}
button.quick-chip:hover::after{opacity:1;}

/* 사내망 전용 page (outside the office) */
.locked-page{text-align:center;padding:72px 16px;}
.locked-page .locked-icon{font-size:40px;margin-bottom:10px;}
.locked-page h1{font-size:19px;margin:0 0 6px;}
.locked-page .sub{margin:0 0 22px;}

/* 운영 버전 › AI 버전 › AI 서버 라이선스 관리 */
.license-body{padding:0 16px 16px;}
.license-count{font-weight:400;color:var(--ink-muted);font-size:12.5px;margin-left:6px;}
.license-help{font-size:12.5px;color:var(--ink-muted);margin:0 0 14px;line-height:1.6;}
.license-head{display:flex;align-items:center;justify-content:space-between;gap:8px 12px;flex-wrap:wrap;margin:16px 0 8px;}
.license-head:first-of-type{margin-top:4px;}
.license-note{font-size:12px;color:var(--ink-muted);}
.license-table{min-width:720px;}
/* same row height as 서버별 현재 버전 just below (44px) */
@media (min-width:721px){ .license-table tbody tr{height:44px;} .license-table td{vertical-align:middle;} }
.license-receivers{list-style:none;margin:0 0 10px;padding:0;display:flex;flex-direction:column;gap:6px;font-size:13px;}
.license-receivers li{display:flex;align-items:center;gap:10px;flex-wrap:wrap;}
.license-receivers form{margin:0;}
.license-receiver-form{margin:0;}

/* page title, search and filters stay pinned under the top bar too (통계
   보기 and the result count below them scroll with the list), so it's always clear which tab/filter the
   rows below belong to; table headers pin right under it (--sticky-head-h,
   measured in app.js). When opened panels make it too tall to leave room
   for the list, app.js unpins it (.unpinned) until they're closed again.
   Desktop only — on phones it would leave no room for the list. */
@media (min-width:721px){
  .sticky-head{
    position:sticky;top:var(--topbar-h, 64px);z-index:20;background:var(--bg);
    /* absorbs all of .wrap's 20px top padding, so the head already sits at
       its pinned spot before any scrolling and never travels before sticking */
    margin-top:-20px;padding-top:20px;
  }
  .sticky-head.unpinned{position:static;}  /* not relative: `top` would still shift it down */
  .sticky-head{overflow-anchor:none;}
  .sticky-head.is-stuck{box-shadow:0 10px 12px -12px rgba(0,0,0,.8);}
}

/* page title + "사용 설명서" button (the guide opens as a popup) */
.title-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:4px;}
.title-row h1{margin:0;}
.help-chip{
  font-family:inherit;font-size:11.5px;font-weight:600;color:var(--ink-muted);background:transparent;
  border:1px solid var(--line);border-radius:999px;padding:2px 10px;cursor:pointer;line-height:18px;
}
.help-chip:hover{color:var(--accent-strong);border-color:var(--accent);}
.help-body.help-modal{padding:0;}

/* phones: the top bar (menu + account, ~220px once it wraps) scrolls away,
   and the page header pins to the very top instead — trimmed so the list
   keeps most of the screen: no description line, smaller buttons, and each
   filter group on one sideways-scrolling line. */
@media (max-width:720px){
  .topbar{position:static;}
  .sticky-head{
    position:sticky;top:0;z-index:20;background:var(--bg);overflow-anchor:none;
    margin:-12px -16px 0;padding:12px 16px 2px;
  }
  .sticky-head.unpinned{position:static;}
  .sticky-head.is-stuck{box-shadow:0 10px 12px -12px rgba(0,0,0,.8);}
  .sticky-head .page-head{margin-bottom:8px;gap:8px;}
  .sticky-head .page-head .sub{display:none;}
  .sticky-head .page-head-actions .btn{min-height:34px;padding:6px 12px;font-size:13px;}
  .sticky-head .filter-row{flex-direction:column;flex-wrap:nowrap;gap:6px;}
  .sticky-head .filter-group + .filter-group{border-left:none;padding-left:0;}
  .sticky-head .filter-group,
  .sticky-head .product-switch,
  .sticky-head .view-switch,
  .sticky-head .sort-bar{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;white-space:nowrap;}
  .sticky-head .filter-group::-webkit-scrollbar,
  .sticky-head .product-switch::-webkit-scrollbar,
  .sticky-head .view-switch::-webkit-scrollbar,
  .sticky-head .sort-bar::-webkit-scrollbar{display:none;}
  .sticky-head .tag-option, .sticky-head .filter-label{flex:none;}
  .sticky-head .subtabs{margin-bottom:8px;}
}
.mail-toggle{border:none;font-family:inherit;cursor:pointer;}
.mail-toggle.on{background:var(--green-soft);color:var(--green);}
.mail-toggle:hover{filter:brightness(1.2);}
.mail-toggle:disabled{opacity:.6;cursor:progress;}
/* drag-to-reorder (license list) */
th.drag-col, td.drag-col{width:28px;padding-right:0;}
.drag-handle{cursor:grab;color:var(--ink-muted);font-size:15px;line-height:1;user-select:none;touch-action:none;padding:2px 4px;display:inline-block;vertical-align:middle;}
.drag-handle:hover{color:var(--accent-strong);}
tr.dragging{opacity:.55;background:var(--surface-alt);}
tr.dragging .drag-handle{cursor:grabbing;}
@media (max-width:720px){ td.drag-col{justify-content:flex-end;} }
