:root {
  color-scheme: dark;
  --bg: #101318;
  --panel: #181c24;
  --panel-2: #212733;
  --line: #2c3340;
  --text: #e7ebf2;
  --muted: #93a0b5;
  --accent: #d7b072;
  --danger: #e07a6a;
  --ok: #8fb39a;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 "Segoe UI", system-ui, sans-serif;
}

button, input, select, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

h1, h2, h3, p { margin: 0; }

.mark {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

#login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

#login-form, dialog form {
  display: grid;
  gap: 12px;
}

#login-form {
  width: min(380px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
}

#login-form h1 { font-size: 28px; }

.lede, .note, .sync, .meta { color: var(--muted); }

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

input, select, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

textarea { resize: vertical; }

button[type="submit"], #new-action, #logout, #cancel, #delete-action {
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  padding: 10px 14px;
  min-height: 44px;
}

button[type="submit"], #new-action {
  background: var(--accent);
  color: #1a140a;
  border-color: transparent;
  font-weight: 650;
}

#logout, #cancel { background: transparent; }

.danger {
  color: var(--danger);
  margin-left: auto;
}

.error { min-height: 1.2em; color: var(--danger); font-size: 14px; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.top h1 { font-size: 18px; }

.top-side {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sync { font-size: 13px; }

.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: calc(100vh - 62px);
}

#fronts {
  border-right: 1px solid var(--line);
  padding: 8px;
}

.front {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 4px;
}

.front[aria-current="true"] {
  background: var(--panel-2);
  border-left-color: var(--accent);
}

.front-name { display: block; font-weight: 650; }

.area {
  display: inline-block;
  margin-top: 2px;
  color: var(--accent);
  font-size: 12px;
}

.counts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.count {
  font: 12px/1 ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: var(--muted);
  background: var(--bg);
  border-radius: 999px;
  padding: 3px 6px;
}

.count strong { color: var(--text); font-weight: 650; }

.count.zero { opacity: 0.45; }

.p0 strong { color: #e07a6a; }
.p1 strong { color: #e0a15a; }
.p2 strong { color: #d7b072; }

main { padding: 16px; min-width: 0; }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.toolbar h2 { font-size: 22px; }

.selected-counts { display: none; }

.row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
}

.row:hover { border-color: #445066; }

.row.feita { opacity: 0.62; }

.prio {
  font: 13px/1 ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-weight: 700;
  border-radius: 6px;
  padding: 6px 8px;
  background: var(--bg);
}

.prio.P0 { color: #e07a6a; }
.prio.P1 { color: #e0a15a; }
.prio.P2 { color: #d7b072; }
.prio.P3 { color: var(--ok); }
.prio.P4, .prio.P5 { color: var(--muted); }

.title { display: block; font-weight: 650; }

.meta { display: block; font-size: 13px; margin-top: 2px; }

.status {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 28px 16px;
  color: var(--muted);
}

.empty strong { display: block; color: var(--text); margin-bottom: 6px; }

dialog {
  width: min(460px, calc(100vw - 24px));
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
}

dialog::backdrop { background: rgba(0, 0, 0, 0.6); }

dialog form { padding: 20px; }

.form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 760px) {
  .layout { display: block; }
  #fronts {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .front {
    min-width: 210px;
    border: 1px solid var(--line);
    border-left-width: 3px;
  }
  .front .counts { display: none; }
  .selected-counts { display: flex; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .row { grid-template-columns: auto minmax(0, 1fr); }
  .status { grid-column: 2; }
  .split { grid-template-columns: 1fr; }
  .top { align-items: flex-start; }
}
