/* Article import check — FutureLog design tokens (from "FutureLog Design System/colors_and_type.css") */
@font-face { font-family: "Lato"; font-style: normal; font-weight: 300; font-display: swap; src: url("../fonts/Lato-Light.ttf") format("truetype"); }
@font-face { font-family: "Lato"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/Lato-Regular.ttf") format("truetype"); }
@font-face { font-family: "Lato"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/Lato-Regular.ttf") format("truetype"); }
@font-face { font-family: "Lato"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/Lato-Bold.ttf") format("truetype"); }

:root {
  --fl-font-family: "Lato", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fl-color-primary: #fd9728;
  --fl-color-primary-dark: #d36800;
  --fl-gray-50: #fffbfe;
  --fl-gray-75: #faf5f9;
  --fl-gray-100: #f4eff4;
  --fl-gray-150: #ede8ed;
  --fl-gray-200: #e6e1e5;
  --fl-gray-300: #c9c5ca;
  --fl-gray-400: #bdbdbd;
  --fl-gray-500: #939094;
  --fl-gray-600: #787579;
  --fl-gray-900: #484649;
  --fl-black: #1c1b1f;
  --fl-white: #ffffff;
  --fl-green-50: #e8f5e9;
  --fl-green-800: #2e7d32;
  --fl-red-50: #ffebee;
  --fl-red-100: #ffcdd2;
  --fl-red-200: #ef9a9a;
  --fl-red-800: #c62828;
  --fl-red-900: #b71c1c;
  --fl-amber-50: #fff8e1;
  --fl-amber-100: #ffecb3;
  --fl-amber-300: #ffb74d;
  --fl-yellow-50: #fffde7;
  --fl-yellow-100: #fff9c4;
  --fl-blue-50: #e3f2fd;
  --fl-blue-700: #1976d2;
  --fl-blue-900: #0d47a1;
  --fl-shadow-floating: 0 5.5px 16px 0 rgba(0,0,0,0.07), 0 1px 6px 0 rgba(0,0,0,0.04), 0 4px 24px 0 rgba(0,0,0,0.15);
  --fl-shadow-overlay: 0 8px 32px rgba(0,0,0,0.24);
  --row-h: 32px;
  --head-h: 44px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--fl-white);
  color: var(--fl-black);
  font: 500 14px/18px var(--fl-font-family);
  letter-spacing: 0.25px;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
b { font-weight: 700; }
.muted { color: var(--fl-gray-600); }
.material-symbols-outlined { font-size: 20px; line-height: 1; vertical-align: middle; user-select: none; }

.fl-h1 { font: 700 28px/36px var(--fl-font-family); margin: 0; letter-spacing: 0; }
.fl-h2 { font: 700 20px/28px var(--fl-font-family); margin: 0; letter-spacing: 0; }
.fl-h3 { font: 700 16px/24px var(--fl-font-family); margin: 0; letter-spacing: 0; }
.fl-h4 { font: 700 12px/16px var(--fl-font-family); margin: 0; }
.fl-label-xsmall { font: 700 10px/16px var(--fl-font-family); letter-spacing: 0.5px; text-transform: uppercase; color: var(--fl-gray-600); }

/* ---------- App header ---------- */
.app-header {
  height: 56px; display: flex; align-items: center; gap: 16px;
  padding: 0 24px; border-bottom: 1px solid var(--fl-gray-200); background: var(--fl-white);
  position: sticky; top: 0; z-index: 30;
}
.app-header .logo { height: 22px; width: auto; }
.app-divider { width: 1px; height: 24px; background: var(--fl-gray-200); }
.app-name { font: 700 16px/24px var(--fl-font-family); }
.app-header-note { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--fl-gray-600); font-size: 12px; }
.app-header-note .material-symbols-outlined { font-size: 16px; }

/* ---------- Page ---------- */
.page { padding: 16px 24px 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.crumbs { color: var(--fl-gray-600); font-size: 12px; line-height: 16px; margin-bottom: 4px; }
.crumbs span { margin: 0 4px; }
.sub { margin: 4px 0 0; color: var(--fl-gray-900); }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 6px 12px; border: 0; outline: none; cursor: pointer; text-decoration: none;
  background: var(--bg); color: var(--fg); box-shadow: inset 0 0 0 1px var(--ring, transparent);
  border-radius: 1px; font: 500 14px/1 var(--fl-font-family); letter-spacing: 0.25px; white-space: nowrap;
  transition: background-color 0.4s ease, color 0.4s ease;
}
.btn:hover { background: var(--bgh, var(--bg)); color: var(--fgh, var(--fg)); }
.btn:active { opacity: 0.8; }
.btn:focus-visible { outline: 2px solid var(--fl-blue-700); outline-offset: 2px; }
.btn[disabled] { cursor: not-allowed; opacity: 0.5; }
.btn .material-symbols-outlined { font-size: 18px; }
.btn.primary   { --bg: var(--fl-color-primary); --bgh: var(--fl-color-primary-dark); --fg: #fff; }
.btn.secondary { --bg: transparent; --bgh: var(--fl-gray-100); --fg: var(--fl-color-primary-dark); --ring: currentColor; }
.btn.tertiary  { --bg: var(--fl-gray-200); --bgh: var(--fl-gray-300); --fg: var(--fl-black); }
.btn.clear     { --bg: transparent; --bgh: var(--fl-gray-200); --fg: var(--fl-black); }
.btn.link { background: transparent; color: var(--fl-blue-700); text-decoration: underline; padding: 0; height: auto; box-shadow: none; }
.btn.link.small { font-size: 12px; }
.btn.sq { width: 32px; padding: 2px; }
.btn.mini { height: 24px; padding: 2px 9px; }

/* ---------- Empty state ---------- */
.drop-card { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); border: 1px solid var(--fl-gray-200); border-radius: 1px; }
.drop-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px;
  min-height: 360px; padding: 32px; margin: 16px; border: 1px dashed var(--fl-gray-400); border-radius: 1px;
  background: var(--fl-gray-50); cursor: pointer; transition: background-color 0.2s ease, border-color 0.2s ease;
}
.drop-zone:hover, .drop-zone.over { background: var(--fl-yellow-50); border-color: var(--fl-color-primary); }
.drop-zone:focus-visible { outline: 2px solid var(--fl-blue-700); outline-offset: 2px; }
.drop-zone p { margin: 0; max-width: 460px; color: var(--fl-gray-600); }
.drop-side { border-left: 1px solid var(--fl-gray-200); padding: 24px; display: flex; flex-direction: column; gap: 8px; }
.drop-side h3 { margin-top: 8px; }
.drop-side p { margin: 0; }
ul.plain { margin: 0; padding-left: 18px; color: var(--fl-gray-900); }
ul.plain li { margin: 4px 0; }
.row-gap { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-top: 4px; }

/* ---------- Banners ---------- */
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border: 1px solid; border-radius: 1px; margin-bottom: 12px; }
.banner .material-symbols-outlined { font-size: 20px; }
.banner.err  { background: var(--fl-red-50); border-color: var(--fl-red-200); color: var(--fl-red-900); }
.banner.warn { background: var(--fl-amber-50); border-color: var(--fl-amber-300); color: #7a4a00; }
.banner.info { background: var(--fl-blue-50); border-color: #bbdefb; color: var(--fl-blue-900); }
.banner .msg { flex: 1; }
.banner .msg b { display: block; margin-bottom: 2px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 12px; }
.stat {
  border: 1px solid var(--fl-gray-200); border-radius: 1px; padding: 12px 16px; background: var(--fl-white);
  text-align: left; cursor: pointer; font-family: var(--fl-font-family); color: var(--fl-black);
  transition: background-color 0.2s ease;
}
.stat:hover { background: var(--fl-gray-75); }
.stat.active { background: var(--fl-yellow-50); border-color: var(--fl-color-primary); }
.stat .k { display: flex; align-items: center; gap: 6px; font: 700 12px/16px var(--fl-font-family); color: var(--fl-gray-900); }
.stat .k .material-symbols-outlined { font-size: 16px; }
.stat .n { font: 700 28px/36px var(--fl-font-family); margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat.bad .n { color: var(--fl-red-800); }
.stat.good .n { color: var(--fl-green-800); }
.stat.amber .n { color: #a15c00; }
.stat .s { font-size: 12px; line-height: 16px; color: var(--fl-gray-600); }

/* ---------- Reason chips ---------- */
.reasons { border: 1px solid var(--fl-gray-200); border-radius: 1px; padding: 8px 12px 10px; margin-bottom: 12px; }
.reasons-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--fl-gray-200); background: var(--fl-white); cursor: pointer;
  font: 500 12px/16px var(--fl-font-family); color: var(--fl-black); transition: background-color 0.2s ease;
}
.chip:hover { background: var(--fl-gray-100); }
.chip .cnt { font-weight: 700; color: var(--fl-red-800); font-variant-numeric: tabular-nums; }
.chip.amber .cnt { color: #a15c00; }
.chip.on { background: var(--fl-yellow-50); border-color: var(--fl-color-primary); }
.chips .none { color: var(--fl-green-800); display: inline-flex; gap: 6px; align-items: center; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.search {
  display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px; min-width: 260px; flex: 0 1 340px;
  border: 1px solid var(--fl-gray-300); border-radius: 1px; background: var(--fl-white);
}
.search:focus-within { border-color: var(--fl-blue-700); box-shadow: 0 0 0 1px var(--fl-blue-700); }
.search .material-symbols-outlined { color: var(--fl-gray-600); font-size: 18px; }
.search input { border: 0; outline: 0; flex: 1; font: 400 14px/18px var(--fl-font-family); background: transparent; min-width: 0; }
.sel { display: inline-flex; align-items: center; gap: 6px; font: 700 12px/16px var(--fl-font-family); color: var(--fl-gray-900); }
select, .inp {
  height: 32px; border: 1px solid var(--fl-gray-300); border-radius: 1px; background: var(--fl-white);
  font: 400 14px/18px var(--fl-font-family); color: var(--fl-black); padding: 0 8px; letter-spacing: 0.25px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
select { max-width: 240px; cursor: pointer; }
select:focus, .inp:focus { outline: 0; border-color: var(--fl-blue-700); box-shadow: 0 0 0 1px var(--fl-blue-700); }
.chk { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.chk input { position: absolute; opacity: 0; width: 0; height: 0; }
.chk .cb { position: relative; width: 18px; height: 18px; flex: none; }
.chk .cb::before { content: ""; position: absolute; left: 1px; top: 1px; width: 16px; height: 16px; border-radius: 4px; background: #fff; border: 1px solid var(--fl-gray-300); box-sizing: border-box; }
.chk input:checked + .cb::before { background: var(--fl-color-primary); border-color: var(--fl-color-primary-dark); }
.chk input:checked + .cb::after { content: ""; position: absolute; left: 6px; top: 3px; width: 5px; height: 9px; border-right: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(45deg); }
.chk input:focus-visible + .cb::before { outline: 2px solid var(--fl-blue-700); outline-offset: 2px; }
.spacer { flex: 1; }

.grid-meta { display: flex; gap: 16px; justify-content: space-between; align-items: center; font-size: 12px; line-height: 16px; margin-bottom: 6px; flex-wrap: wrap; }
#viewCount { font-weight: 700; }

/* ---------- Grid ---------- */
.grid {
  position: relative; overflow: auto; border: 1px solid var(--fl-gray-200); border-radius: 1px;
  height: calc(100vh - 210px); min-height: 360px; outline: none; background: var(--fl-white);
}
.grid-inner { position: relative; }
.grid-head { position: sticky; top: 0; z-index: 5; display: flex; height: var(--head-h); background: var(--fl-white); border-bottom: 1px solid var(--fl-gray-300); }
.grid-rows { position: absolute; left: 0; top: var(--head-h); }
.gr { display: flex; height: var(--row-h); }
.gr.alt .gc { background: var(--fl-gray-75); }
.gr.wrong .gc { background: var(--fl-red-50); }
.gr:hover .gc { background: var(--fl-gray-100); }
.gr.sel .gc { background: var(--fl-yellow-50); }
.gc, .gh {
  flex: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  padding: 0 8px; border-bottom: 1px solid var(--fl-gray-200); background: var(--fl-white);
}
.gh {
  display: flex; align-items: flex-end; padding-bottom: 6px; white-space: normal; border-bottom: 0;
  font: 700 12px/14px var(--fl-font-family); letter-spacing: 0.25px; color: var(--fl-black);
}
.gh .col { display: block; font-weight: 400; color: var(--fl-gray-600); font-size: 10px; }
.gh.hasErr::after { content: attr(data-n); margin-left: 4px; color: var(--fl-red-800); font-size: 10px; }
.gc { line-height: calc(var(--row-h) - 1px); font-variant-numeric: tabular-nums; }
.gc.edit { cursor: cell; }
.gc.sticky, .gh.sticky { position: sticky; z-index: 3; }
.gh.sticky { z-index: 6; }
.gc.lastSticky, .gh.lastSticky { box-shadow: 1px 0 0 var(--fl-gray-200); }
.gc.num { text-align: right; }
.gc.rownum { color: var(--fl-gray-600); font-size: 12px; display: flex; align-items: center; justify-content: space-between; gap: 2px; }
.gc.rownum .del { visibility: hidden; border: 0; background: transparent; cursor: pointer; color: var(--fl-gray-600); padding: 0; height: 22px; width: 22px; border-radius: 1px; }
.gc.rownum .del:hover { background: var(--fl-gray-200); color: var(--fl-black); }
.gr:hover .gc.rownum .del { visibility: visible; }
.gc.reason { cursor: pointer; color: var(--fl-gray-900); font-size: 12px; }
.gc.reason:hover { text-decoration: underline; }

/* cell states — light fill + strong inner border, readable on any row tint */
.gr .gc.c-err  { background: var(--fl-red-100); box-shadow: inset 0 0 0 1px var(--fl-red-800); color: var(--fl-red-900); }
.gr .gc.c-grp  { box-shadow: inset 0 -2px 0 var(--fl-red-800); }
.gr .gc.c-map  { background: var(--fl-amber-100); box-shadow: inset 0 0 0 1px #e2a33a; }
.gr .gc.c-warn { box-shadow: inset 0 -3px 0 #f5b700; }
.gr .gc.c-xl   { background: var(--fl-red-100); box-shadow: inset 0 0 0 2px var(--fl-red-900); font-weight: 700; color: var(--fl-red-900); }
.gr .gc.c-edited::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 999px; background: var(--fl-blue-700); margin-right: 6px; vertical-align: middle; }
.gr .gc.active { outline: 2px solid var(--fl-blue-700); outline-offset: -2px; }
.gc .blank { color: var(--fl-gray-400); }

/* status tags */
.tag { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font: 700 10px/14px var(--fl-font-family); letter-spacing: 0.6px; text-transform: uppercase; white-space: nowrap; vertical-align: middle; }
.tag.red { background: #ffd9d9; color: #b01414; }
.tag.green { background: #d8ecd9; color: #1f5b22; }
.tag.amber { background: #ffefc4; color: #8a4b00; }
.tag.gray { background: var(--fl-gray-100); color: var(--fl-gray-900); }
.tag.blue { background: #dbecff; color: var(--fl-blue-900); }

.cell-editor {
  position: absolute; z-index: 8; height: var(--row-h); border: 2px solid var(--fl-blue-700); border-radius: 1px;
  padding: 0 6px; font: 500 14px/18px var(--fl-font-family); letter-spacing: 0.25px; background: #fff; outline: 0;
  box-shadow: var(--fl-shadow-floating);
}
.grid-empty { position: absolute; inset: var(--head-h) 0 0 0; display: flex; align-items: center; justify-content: center; color: var(--fl-gray-600); }

.tip {
  position: fixed; z-index: 60; max-width: 360px; background: var(--fl-black); color: #fff;
  font: 500 12px/16px var(--fl-font-family); padding: 6px 10px; border-radius: 4px; letter-spacing: 0.25px; pointer-events: none;
}
.tip div + div { margin-top: 2px; }

/* ---------- Drawer ---------- */
.drawer {
  position: fixed; top: 56px; right: 0; bottom: 0; width: min(520px, 100vw); z-index: 40; background: var(--fl-white);
  border-left: 1px solid var(--fl-gray-200); box-shadow: var(--fl-shadow-floating); display: flex; flex-direction: column;
}
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 16px 12px 24px; border-bottom: 1px solid var(--fl-gray-200); }
.drawer-body { flex: 1; overflow: auto; padding: 16px 24px 24px; }
.drawer-foot { display: flex; justify-content: space-between; padding: 8px 16px; border-top: 1px solid var(--fl-gray-200); }
.issue-list { list-style: none; margin: 8px 0 16px; padding: 0; }
.issue-list li { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-bottom: 1px solid var(--fl-gray-200); }
.issue-list li .material-symbols-outlined { font-size: 18px; color: var(--fl-red-800); }
.issue-list li.amber .material-symbols-outlined { color: #c77800; }
.issue-list li.ok .material-symbols-outlined { color: var(--fl-green-800); }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label { font: 700 12px/16px var(--fl-font-family); color: var(--fl-black); display: flex; gap: 6px; }
.field label .col { color: var(--fl-gray-600); font-weight: 400; }
.field .inp { width: 100%; height: 36px; }
.field.err .inp { background: #fdecef; border-color: var(--fl-red-800); }
.field.warn .inp { background: var(--fl-amber-50); border-color: #e2a33a; }
.field .msg { font: 700 12px/16px var(--fl-font-family); color: var(--fl-red-800); }
.field.warn .msg { color: #8a4b00; }
.section-title { margin: 16px 0 8px; padding-top: 12px; border-top: 1px solid var(--fl-gray-200); }

/* ---------- Dialog ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.dialog { width: min(520px, 100%); background: #fff; border-radius: 1px; box-shadow: var(--fl-shadow-overlay); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 8px 12px 16px; font: 700 16px/24px var(--fl-font-family); border-bottom: 1px solid var(--fl-gray-200); }
.dialog-body { padding: 16px; overflow: auto; color: var(--fl-gray-900); }
.dialog-body p { margin: 0 0 12px; }
.dialog-body .form { grid-template-columns: 1fr; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--fl-gray-200); flex-wrap: wrap; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 24px; bottom: 24px; z-index: 70; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 12px; min-width: 280px; max-width: 420px; background: #fff; border-radius: 4px;
  padding: 12px 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 0 1px rgba(0,0,0,0.1), 0 4px 24px rgba(0,0,0,0.15);
  font: 500 14px/20px var(--fl-font-family);
}
.toast .ic { width: 24px; height: 24px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.toast .ic .material-symbols-outlined { font-size: 16px; }
.toast .ic.success { background: var(--fl-green-800); }
.toast .ic.error { background: var(--fl-red-900); }
.toast .ic.info { background: var(--fl-blue-700); }
.toast .msg { flex: 1; }
.toast .btn.link { font-size: 14px; }

.drop-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(253,151,40,0.12); border: 3px dashed var(--fl-color-primary); display: flex; align-items: center; justify-content: center; pointer-events: none; }
.drop-overlay div { background: #fff; padding: 16px 24px; font: 700 16px/24px var(--fl-font-family); box-shadow: var(--fl-shadow-floating); border-radius: 1px; }

.spinner { width: 20px; height: 20px; border-radius: 999px; border: 2px solid var(--fl-gray-200); border-top-color: var(--fl-color-primary); animation: sp 0.9s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .page { padding: 12px 16px 16px; }
  .app-header { padding: 0 16px; }
  .app-header-note { display: none; }
  .drop-card { grid-template-columns: 1fr; }
  .drop-side { border-left: 0; border-top: 1px solid var(--fl-gray-200); }
  .drop-zone { min-height: 260px; }
  .search { min-width: 0; flex: 1 1 100%; }
  .form { grid-template-columns: 1fr; }
  .grid-meta .muted { display: none; }
}
