:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1c2330;
  --muted: #667085;
  --line: #e2e5ea;
  --side: #1b2433;
  --side-ink: #c9d1e0;
  --accent: #2f6fde;
  --accent-ink: #ffffff;
  --ok: #1f9d55;
  --warn: #c77700;
  --bad: #c93a3a;
  --soft: #eef2f8;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161d;
    --panel: #1b212b;
    --ink: #e6e9ef;
    --muted: #98a2b3;
    --line: #2c3442;
    --side: #0d1118;
    --side-ink: #b4bdcc;
    --accent: #5b93f5;
    --accent-ink: #0d1118;
    --soft: #232b38;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0 0 4px; line-height: 1.25; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.pre { white-space: pre-wrap; }

/* Sidebar */
.side {
  width: 220px;
  flex: none;
  background: var(--side);
  color: var(--side-ink);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { color: #fff; font-weight: 700; font-size: 18px; padding: 0 10px 18px; }
.side a {
  display: block;
  color: var(--side-ink);
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 2px;
}
.side a:hover { background: rgba(255, 255, 255, .07); text-decoration: none; }
.side a.on { background: var(--accent); color: var(--accent-ink); }
.side .sep { border-top: 1px solid rgba(255, 255, 255, .1); margin: 10px 0; }
.side .who { margin-top: auto; padding: 10px; font-size: 13px; }
.side .who strong { color: #fff; display: block; }
.side button.link { color: var(--side-ink); padding: 0; }

/* Main */
.main { flex: 1; min-width: 0; padding: 26px 32px 60px; max-width: 1500px; }
.head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.head .grow { flex: 1; min-width: 260px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.flash {
  background: var(--soft);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 18px;
}
.error { border-left-color: var(--bad); }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 18px;
}
.grid2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
@media (max-width: 1050px) {
  .grid2, .grid-even { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  body { flex-direction: column; }
  .side { width: auto; height: auto; position: static; flex-direction: row; flex-wrap: wrap; padding: 10px; }
  .side .brand { width: 100%; padding-bottom: 6px; }
  .side .who { margin: 0 0 0 auto; }
  .side .sep { display: none; }
  .main { padding: 16px; }
}

/* Buttons and forms */
.btn, button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 7px 14px;
  border-radius: 8px;
  display: inline-block;
}
.btn:hover, button:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger, button.danger { color: var(--bad); }
button.link { border: 0; background: none; color: var(--accent); padding: 0; }
button.link.danger { color: var(--bad); }
form.inline { display: inline; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=url], input[type=email],
input[type=search], select, textarea {
  font: inherit;
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.fields { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px 16px; }
.fields > div { grid-column: span 12; }
.fields > .c2 { grid-column: span 2; }
.fields > .c3 { grid-column: span 3; }
.fields > .c4 { grid-column: span 4; }
.fields > .c6 { grid-column: span 6; }
.fields > .c8 { grid-column: span 8; }
@media (max-width: 760px) {
  .fields > .c2, .fields > .c3, .fields > .c4, .fields > .c6, .fields > .c8 { grid-column: span 12; }
}
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 15px; margin: 0; }
.check input { width: auto; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filters > div { min-width: 150px; }
.filters .wide { flex: 1; min-width: 220px; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--soft); }
.tablewrap { overflow-x: auto; }
td.code { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }

/* Badges */
.badge {
  display: inline-block;
  font-size: 12px;
  line-height: 1.2;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink);
  white-space: nowrap;
}
.st-IDEA, .st-DRAFT { background: #e7e9ee; color: #3d4654; }
.st-READY { background: #dceafd; color: #174a9c; }
.st-SUBMITTED, .st-IN_REVIEW { background: #fdf0d2; color: #7a4a00; }
.st-REVISION { background: #fde2cf; color: #8a3b00; }
.st-ACCEPTED { background: #d9f2e1; color: #136b38; }
.st-PUBLISHED { background: #1f9d55; color: #fff; }
.st-REJECTED, .st-WITHDRAWN { background: #f9dcdc; color: #8f2424; }
.lv-SCOPUS { background: #ece2fb; color: #5a2ea6; }
.lv-CAT_A { background: #d9f2e1; color: #136b38; }
.lv-CAT_B { background: #dceafd; color: #174a9c; }
.warnb { background: #fde2cf; color: #8a3b00; }

/* Dashboard */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.tile .n { font-size: 26px; font-weight: 700; line-height: 1.1; }
.tile .l { font-size: 13px; color: var(--muted); }
.soon { color: var(--bad); font-weight: 600; }
.near { color: var(--warn); font-weight: 600; }
.bar { height: 10px; background: var(--soft); border-radius: 999px; overflow: hidden; position: relative; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; background: #b9cff5; }
.bar b { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ok); }
.prow { display: grid; grid-template-columns: 190px minmax(80px, 1fr) 230px; gap: 12px; align-items: center; padding: 6px 0; }
.prow.total { font-weight: 600; border-bottom: 1px solid var(--line); margin-bottom: 4px; padding-bottom: 10px; }
@media (max-width: 760px) { .prow { grid-template-columns: 1fr; gap: 4px; } }

/* Board */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.col { flex: 0 0 230px; background: var(--soft); border-radius: 12px; padding: 10px; min-height: 200px; }
.col.over { outline: 2px dashed var(--accent); }
.col h3 { display: flex; justify-content: space-between; font-size: 13px; text-transform: uppercase; color: var(--muted); }
.kcard {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  margin-bottom: 8px;
  cursor: grab;
  font-size: 13.5px;
}
.kcard.drag { opacity: .4; }
.kcard a { color: var(--ink); }
.kcard .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

/* Details blocks */
dl.props { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 6px 14px; margin: 0; }
dl.props dt { color: var(--muted); font-size: 13px; padding-top: 2px; }
dl.props dd { margin: 0; overflow-wrap: anywhere; }
details.box { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-top: 10px; }
details.box summary { cursor: pointer; color: var(--accent); }
details.box[open] summary { margin-bottom: 10px; }
.item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.score {
  display: inline-block;
  min-width: 34px;
  text-align: center;
  font-weight: 700;
  border-radius: 8px;
  padding: 2px 6px;
  background: var(--soft);
}

/* Login */
body.login { align-items: center; justify-content: center; }
.loginbox { width: 360px; max-width: calc(100vw - 32px); }
.loginbox h1 { margin-bottom: 16px; }
.loginbox .row { margin-bottom: 12px; }
