:root { color-scheme: light dark; }
* { box-sizing: border-box; }
body { font-family: -apple-system, Segoe UI, Roboto, sans-serif; margin: 0; background: #0f1115; color: #e8e8e8; }

/* ---- layout: collapsible left rail + content area ---- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar { width: 220px; background: #14161c; border-right: 1px solid #2c2f38; flex-shrink: 0; transition: width .15s ease; display: flex; flex-direction: column; }
.sidebar.collapsed { width: 56px; }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px; border-bottom: 1px solid #2c2f38; }
.sidebar-brand { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: #e8e8e8; white-space: nowrap; overflow: hidden; }
.sidebar-brand img { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar.collapsed .sidebar-brand span { display: none; }
.sidebar-toggle { background: none; border: none; color: #9aa0a6; cursor: pointer; font-size: 14px; padding: 4px 6px; }
.sidebar-toggle:hover { color: #e8e8e8; }

.sidebar-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.sidebar-section-label { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: #6b7078; padding: 12px 8px 4px; white-space: nowrap; overflow: hidden; }
.sidebar.collapsed .sidebar-section-label { visibility: hidden; height: 4px; padding: 8px 0 0; }
.sidebar-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; color: #c7cad1; text-decoration: none; font-size: 13px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; }
.sidebar-link:hover { background: #1b1e26; color: #e8e8e8; }
.sidebar-link.active { background: #1c2432; color: #6ec6ff; }
.sidebar-link .icon { width: 16px; flex-shrink: 0; text-align: center; }
.sidebar.collapsed .sidebar-link span.label { display: none; }

.sidebar-footer { padding: 10px; border-top: 1px solid #2c2f38; }
.sidebar-user { font-size: 12px; color: #9aa0a6; white-space: nowrap; overflow: hidden; margin-bottom: 6px; }
.sidebar.collapsed .sidebar-user, .sidebar.collapsed .sidebar-footer-btns span { display: none; }
.sidebar-footer-btns { display: flex; flex-direction: column; gap: 4px; }

.content { flex: 1; padding: 24px 28px; min-width: 0; }
.content h1 { font-size: 20px; margin: 0 0 4px 0; }
.sub { color: #9aa0a6; font-size: 13px; margin-bottom: 20px; }

/* ---- common components (shared across pages) ---- */
.panel { background: #171a21; border: 1px solid #2c2f38; border-radius: 8px; padding: 14px 16px; margin-bottom: 16px; }
.panel-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #9aa0a6; margin-bottom: 10px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.row:last-child { margin-bottom: 0; }
label { font-size: 13px; color: #9aa0a6; display: flex; align-items: center; gap: 6px; }
select, input, button { background: #1b1e26; color: #e8e8e8; border: 1px solid #2c2f38; border-radius: 6px; padding: 6px 10px; font-size: 13px; }
input[type="checkbox"] { width: 15px; height: 15px; }
button { cursor: pointer; }
button:hover:not(:disabled) { border-color: #4a90e2; }
button:disabled { opacity: .4; cursor: not-allowed; }
button.primary { background: #2563eb; border-color: #2563eb; color: white; }
button.danger:hover { border-color: #e5636b; color: #e5636b; }

table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 7px 9px; text-align: right; border-bottom: 1px solid #2c2f38; white-space: nowrap; }
th:first-child, td:first-child, th:nth-child(2), td:nth-child(2) { text-align: left; }
th { color: #9aa0a6; font-weight: 600; position: sticky; top: 0; background: #0f1115; }
tr:hover { background: #171a21; }
.pos { color: #4caf7d; }
.neg { color: #e5636b; }
.group-tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 10px; background: #22262f; border: 1px solid #2c2f38; color: #9aa0a6; }
.empty { color: #9aa0a6; padding: 40px 0; text-align: center; }
.table-wrap { max-height: 70vh; overflow: auto; border: 1px solid #2c2f38; border-radius: 8px; }
.icon-btn { padding: 3px 7px; font-size: 12px; margin-left: 4px; }

.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); align-items: center; justify-content: center; z-index: 50; }
.modal-backdrop.open { display: flex; }
.modal { background: #171a21; border: 1px solid #2c2f38; border-radius: 10px; padding: 20px; width: 380px; max-width: 90vw; }
.modal h3 { margin: 0 0 14px 0; font-size: 15px; }
.modal .field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.modal .field label { font-size: 12px; }
.modal .field input { width: 100%; box-sizing: border-box; }
.modal .buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.auth-overlay { position: fixed; inset: 0; background: #0f1115; display: flex; align-items: center; justify-content: center; z-index: 100; }
.auth-box { background: #171a21; border: 1px solid #2c2f38; border-radius: 10px; padding: 32px; width: 340px; max-width: 90vw; }
.auth-box h2 { margin: 0 0 4px 0; font-size: 18px; }
.auth-box .sub { margin-bottom: 18px; }
.auth-box .field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.auth-box .field input { width: 100%; box-sizing: border-box; }
.auth-box button.primary { width: 100%; padding: 8px; margin-top: 6px; }
.auth-error { color: #e5636b; font-size: 12px; margin-top: 8px; min-height: 14px; }
.auth-link { color: #4a90e2; font-size: 12px; cursor: pointer; text-align: center; margin-top: 12px; }
.auth-link:hover { text-decoration: underline; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; color: white; }

/* ── Export / Import action-menu dropdown (v1.5.2) ─────────────────────── */
.ft-action-menu-wrap{position:relative;display:inline-block}
.ft-action-btn{background:#1e2028;border:1px solid #2c2f38;color:#e8e8e8;
  padding:5px 12px;border-radius:6px;cursor:pointer;font-size:13px;white-space:nowrap}
.ft-action-btn:hover{border-color:#4a90e2;color:#4a90e2}
.ft-action-menu{display:none;position:absolute;top:calc(100% + 4px);left:0;
  background:#1a1d26;border:1px solid #2c2f38;border-radius:8px;
  box-shadow:0 6px 20px rgba(0,0,0,.5);z-index:200;min-width:210px;padding:6px 0}
.ft-action-menu-wrap.open .ft-action-menu{display:block}
.ft-action-item{display:block;width:100%;text-align:left;background:none;
  border:none;color:#c7cad1;padding:7px 16px;cursor:pointer;font-size:13px;white-space:nowrap}
.ft-action-item:hover{background:#22262f;color:#4a90e2}
.ft-action-section-label{font-size:10px;text-transform:uppercase;letter-spacing:.07em;
  color:#6b7078;padding:4px 16px 2px;pointer-events:none}
.ft-action-divider{border:none;border-top:1px solid #2c2f38;margin:4px 0}

/* ── Sidebar footer version + copyright (v1.6.0) ───────────────────────── */
.sidebar-version {
  font-size: 11px;
  color: #4a90e2;
  margin-top: 8px;
  letter-spacing: .04em;
}
.sidebar-copyright {
  font-size: 10px;
  color: #4a5060;
  margin-top: 3px;
  line-height: 1.4;
}
.sidebar.collapsed .sidebar-version,
.sidebar.collapsed .sidebar-copyright { display: none; }
