/* FDV VA – kompakt PC-GUI */
:root {
  --bg: #f3f4f6; --card: #fff; --line: #d9dde3; --text: #1f2937; --muted: #6b7280;
  --accent: #1d5fa8; --green: #2e7d32; --orange: #ef8f00; --red: #c62828; --gray: #9ca3af;
  --font: 13px/1.35 system-ui, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: var(--font); }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 17px; margin: 0; } h2 { font-size: 14px; margin: 0 0 6px; }
.muted { color: var(--muted); } .small { font-size: 11px; } .center { text-align: center; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.err { color: var(--red); font-size: 12px; } .red { color: var(--red); } .warn { color: #b45309; }
.spacer { flex: 1; }
code { background: #e5e7eb; padding: 0 4px; border-radius: 3px; }

/* Topbar */
.topbar { display: flex; align-items: center; gap: 14px; padding: 6px 14px; background: #1f2937; color: #e5e7eb; position: sticky; top: 0; z-index: 5; }
.topbar a { color: #e5e7eb; } .topbar .brand { font-weight: 700; font-size: 15px; }
.topbar nav { display: flex; gap: 10px; align-items: center; white-space: nowrap; }
.topbar nav a.active { text-decoration: underline; }
.topbar select { background: #374151; color: #fff; border: 1px solid #4b5563; border-radius: 3px; padding: 2px 4px; font-size: 12px; }
.topbar .legend { font-size: 11px; color: #cbd5e1; } .topbar .legend .dot { margin: 0 3px 0 8px; }
.topbar .user { color: #cbd5e1; font-size: 12px; }
.notice { padding: 6px 14px; font-size: 12px; } .notice.warn { background: #fff7e6; color: #92400e; border-bottom: 1px solid #fcd9a4; }

/* Layout */
main { padding: 10px 14px; } main.loading { color: var(--muted); }
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.toolbar input#q { width: 320px; }
.count { font-weight: 400; font-size: 12px; }

/* Controls */
input, select, textarea, button { font: inherit; }
input:not([type=checkbox]):not([type=file]), select, textarea { border: 1px solid var(--line); border-radius: 3px; padding: 3px 6px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--accent); }
.toolbar input, .toolbar select { width: auto; }
.btn { display: inline-block; border: 1px solid var(--line); background: #fff; border-radius: 3px; padding: 4px 10px; cursor: pointer; color: var(--text); white-space: nowrap; }
.btn:hover { background: #f0f2f5; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; } .btn.primary:hover { background: #164a85; }
.ib { border: 0; background: none; cursor: pointer; padding: 1px 4px; font-size: 13px; opacity: .7; color: var(--text); } .ib:hover { opacity: 1; }
a.ib { color: var(--accent); }

/* Table */
.tablewrap { background: var(--card); border: 1px solid var(--line); border-radius: 4px; overflow: auto; max-height: calc(100vh - 110px); }
table.grid { border-collapse: collapse; width: 100%; font-size: 12.5px; }
table.grid th, table.grid td { padding: 3px 7px; border-bottom: 1px solid #eceff3; text-align: left; vertical-align: middle; white-space: nowrap; }
table.grid td.name { white-space: normal; min-width: 180px; max-width: 360px; }
table.grid thead th { position: sticky; top: 0; background: #f8fafc; border-bottom: 1px solid var(--line); font-weight: 600; cursor: pointer; user-select: none; }
table.grid thead th.nosort { cursor: default; }
table.grid thead th.asc::after { content: " ▲"; font-size: 9px; } table.grid thead th.desc::after { content: " ▼"; font-size: 9px; }
table.grid tbody tr:hover { background: #f5f8fc; }
table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num.red { color: var(--red); font-weight: 600; } td.num.orange { color: var(--orange); font-weight: 600; } td.num.green { color: var(--green); }
td.zero { color: var(--red); }
tr.st-red td:first-child { box-shadow: inset 3px 0 var(--red); } tr.st-orange td:first-child { box-shadow: inset 3px 0 var(--orange); } tr.st-green td:first-child { box-shadow: inset 3px 0 var(--green); }
td.act { text-align: right; white-space: nowrap; min-width: 70px; } td.files { text-align: center; }
.thumb { height: 22px; width: 30px; object-fit: cover; border-radius: 2px; vertical-align: middle; cursor: zoom-in; border: 1px solid var(--line); }
.pill { font-size: 11px; background: #e5e7eb; border-radius: 8px; padding: 0 5px; margin-left: 3px; }
.note { margin-left: 4px; color: var(--muted); cursor: help; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; vertical-align: middle; background: var(--gray); }
.dot.green { background: var(--green); } .dot.orange { background: var(--orange); } .dot.red { background: var(--red); } .dot.gray { background: var(--gray); }

/* Modal */
dialog.modal { border: 0; border-radius: 6px; padding: 0; width: 760px; max-width: 95vw; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
dialog.modal.small { width: 340px; }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog.modal form { padding: 12px 16px; }
.modal-head { display: flex; align-items: center; margin-bottom: 8px; } .modal-head h2 { flex: 1; font-size: 15px; margin: 0; }
.x { border: 0; background: none; font-size: 20px; cursor: pointer; line-height: 1; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.grid2 label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.grid2 label input, .grid2 label select, .grid2 label textarea { color: var(--text); font-size: 13px; }
.grid2 label.check { flex-direction: row; align-items: center; gap: 6px; color: var(--text); margin-top: 14px; }
.grid2 label.check input { width: auto; }
.span2 { grid-column: 1 / -1; }
.statusPreview { align-self: end; font-size: 12px; padding: 4px 0; }
.files { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.files.disabled .filecol { opacity: .45; pointer-events: none; }
.files #fileHint { grid-column: 1 / -1; margin: 0; }
.filehead { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.filehead input[type=file] { font-size: 11px; width: auto; }
.filelist { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.fitem { display: flex; align-items: center; gap: 6px; } .fitem a:first-of-type { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.fitem .thumb { height: 28px; width: 38px; }
dialog.img { background: transparent; width: auto; box-shadow: none; } dialog.img img { max-width: 90vw; max-height: 88vh; border-radius: 4px; background: #fff; }
dialog.img .x { position: absolute; top: -4px; right: 0; color: #fff; font-size: 28px; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; }
.login-box { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 24px 28px; width: 320px; display: flex; flex-direction: column; gap: 10px; }
.login-box h1 { font-size: 20px; } .login-box p { margin: -6px 0 6px; }
.login-box label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }

/* Admin */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; }
table.admin th, table.admin td { padding: 2px 4px; }
table.admin input:not([type=checkbox]), table.admin select { padding: 2px 5px; font-size: 12.5px; }
.w60 { width: 60px; } .w80 { width: 80px; } .w100 { width: 100px; }
tr.newrow td { background: #f8fafc; }
