/* komentare: the standalone app. Three columns: sites and views | list | detail. Tokens come from the Platno design. */
:root {
  color-scheme: dark;
  --bg: #1f1f1f;
  --panel: #2a2a2a;
  --line: #3e3e3e;
  --field: #373737;
  --ink: #ebebeb;
  --mute: #a6a6a6;
  --dim: #8a8a8a;
  --pin: #1d1d1d;
  --pin-line: #555;
  --focus: oklch(62% 0.16 258);
  --sel: #333a4a;
  --nav-on: #3c3c3c;
  --chip-on: #4a4a4a;
  --danger: #e5645c;
  --font-ui: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@supports not (color: oklch(0% 0 0)) {
  :root {
    --focus: #4a8df0;
  }
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html,
body {
  height: 100%;
  margin: 0;
}
body {
  background: var(--bg);
  color: var(--ink);
  font: 13px/1.4 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
h1,
h2,
p {
  margin: 0;
}
button,
input,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}
.list,
.side,
.detail-body {
  scrollbar-color: #4a4a4a transparent;
}

/* layout */
.app {
  display: grid;
  grid-template-columns: 260px minmax(340px, 480px) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}
.col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

/* left column */
.side {
  gap: 16px;
  padding: 16px;
  overflow-y: auto;
  background: var(--panel);
  border-right: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--focus);
  color: #fff;
}
.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.brand-name {
  font-size: 14px;
  font-weight: 600;
}
.brand-sub {
  overflow: hidden;
  font-size: 11px;
  color: var(--dim);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cap {
  padding: 0 12px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--dim);
}
#sites,
#views {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--mute);
  text-align: left;
}
.nav:hover {
  background: rgb(255 255 255 / 5%);
}
.nav[aria-pressed="true"] {
  background: var(--nav-on);
}
.nav-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.nav-name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-sub {
  overflow: hidden;
  font-size: 11px;
  color: var(--dim);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.badge {
  flex: none;
  padding: 0 8px;
  border-radius: 9999px;
  background: var(--field);
  font-size: 11px;
  color: var(--ink);
}
.nav[aria-pressed="true"] .badge {
  background: #4a4a4a;
}
.count {
  flex: none;
  font-size: 11px;
  color: var(--dim);
}
.site-row {
  position: relative;
}
.rm {
  position: absolute;
  top: 50%;
  right: 8px;
  padding: 2px 8px;
  border: 0;
  border-radius: 9999px;
  background: var(--panel);
  font-size: 11px;
  color: var(--mute);
  opacity: 0;
  transform: translateY(-50%);
}
.rm:hover {
  color: var(--danger);
}
.site-row:hover .rm,
.site-row:focus-within .rm {
  opacity: 1;
}
.site-row:hover .badge,
.site-row:focus-within .badge {
  visibility: hidden;
}

.side-foot {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: auto;
}
.enable {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 8px;
  background: var(--field);
}
.enable-title {
  font-size: 12px;
  font-weight: 600;
}
.enable-text {
  font-size: 11px;
  line-height: 1.4;
  color: var(--mute);
}
.snippet-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}
.snippet {
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--pin);
  font: 11px/1.45 var(--font-mono);
  color: var(--ink);
  overflow-wrap: anywhere;
  user-select: all;
}
.add-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.link-btn {
  padding: 0;
  border: 0;
  background: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--focus);
}
.link-btn:hover {
  text-decoration: underline;
}
.err {
  font-size: 11px;
  line-height: 1.4;
  color: var(--danger);
}
.ok {
  font-size: 11px;
  line-height: 1.4;
  color: var(--mute);
}
.me {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px;
}
.me-name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.me .link-btn {
  flex: none;
  font-weight: 400;
  color: var(--mute);
}

/* shared controls */
.field {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--pin);
  font-size: 12px;
}
.field::placeholder,
.search input::placeholder,
.reply textarea::placeholder {
  color: var(--dim);
}
.btn {
  padding: 8px 12px;
  border: 0;
  border-radius: 6px;
  background: var(--field);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.btn:hover {
  background: #444;
}
.btn.primary {
  background: var(--focus);
  color: #fff;
}
.btn.primary:hover {
  filter: brightness(1.1);
}
.btn.small {
  align-self: flex-start;
  padding: 4px 10px;
  background: #444;
  font-size: 11px;
}
.btn.small:hover {
  background: #505050;
}
.btn.danger:hover {
  color: var(--danger);
}
.btn:disabled {
  opacity: 0.6;
  cursor: default;
}
a.btn {
  display: inline-block;
  text-decoration: none;
}
.btn.icon {
  display: inline-flex;
  align-items: center;
  padding: 8px;
  color: var(--mute);
}
.btn.icon:hover {
  color: var(--danger);
}

/* middle column */
.list-col {
  border-right: 1px solid var(--line);
}
.list-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
}
.list-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.list-title {
  font-size: 18px;
  font-weight: 600;
}
.sort {
  padding: 2px 0;
  border: 0;
  background: none;
  font-size: 12px;
  color: var(--mute);
}
.sort:hover {
  color: var(--ink);
}
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 6px;
  background: var(--field);
  color: var(--mute);
}
.search svg {
  flex: none;
}
.search input {
  flex: 1;
  min-width: 0;
  padding: 8px 0;
  border: 0;
  background: none;
  font-size: 13px;
  color: var(--ink);
  outline: 0;
}
.search:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  padding: 4px 12px;
  border: 0;
  border-radius: 9999px;
  background: var(--field);
  font-size: 12px;
  color: var(--mute);
}
.chip:hover {
  background: #444;
}
.chip[aria-pressed="true"] {
  background: var(--chip-on);
  font-weight: 600;
  color: var(--ink);
}
.list {
  flex: 1;
  overflow-y: auto;
}
.group-head {
  display: flex;
  gap: 4px;
  padding: 12px 16px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--dim);
  white-space: nowrap;
}
.group-site {
  flex: none;
  text-transform: uppercase;
}
.group-page {
  overflow: hidden;
  text-overflow: ellipsis;
}
.item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}
.item:hover {
  background: #262626;
}
.item[aria-current="true"] {
  background: var(--sel);
}
.item-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.item-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.who {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.when {
  flex: none;
  font-size: 11px;
  color: var(--dim);
}
.item-text {
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-line;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: 11px;
  color: var(--mute);
}
.item.resolved .pin {
  background: var(--dim);
  border-color: var(--dim);
}
.item.resolved .who,
.item.resolved .item-text {
  color: var(--mute);
}
.item.resolved .item-main {
  opacity: 0.75;
}
.done {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--mute);
}
.pin {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 24px;
  height: 24px;
  border: 1px solid var(--pin-line);
  border-radius: 50% 50% 50% 0;
  background: var(--pin);
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}
.empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--dim);
}
.empty b {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--mute);
}

/* right column */
.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 67px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.d-title {
  min-width: 0;
}
.d-title h2 {
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.d-sub {
  overflow: hidden;
  font-size: 12px;
  color: var(--dim);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.d-actions {
  display: flex;
  flex: none;
  gap: 8px;
}
.detail-body {
  flex: 1;
  overflow-y: auto;
}
.thread {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 20px 16px;
}
.resolved-note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--mute);
}
.msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.msg.reply-msg {
  padding-left: 12px;
  border-left: 2px solid var(--line);
}
.msg-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.msg-who {
  font-weight: 600;
}
.msg-when {
  font-size: 11px;
  color: var(--dim);
}
.msg-text {
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.reply {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 20px 20px;
  background: var(--bg);
}
.reply-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.reply textarea {
  flex: 1;
  min-width: 0;
  max-height: 200px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--field);
  font-size: 13px;
  line-height: 1.4;
  resize: none;
}
.reply .btn.primary {
  padding: 8px 16px;
}
/* login */
.login {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 16px;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(360px, 100%);
  padding: 24px;
  border-radius: 8px;
  background: var(--panel);
}
.login-title {
  font-size: 18px;
  font-weight: 600;
}
.login-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--mute);
}
.login-form .field {
  background: var(--field);
  font-size: 13px;
}
/* password field with the eye button (eye.js); the widget (k.js) has the same look */
.pw {
  position: relative;
  display: flex;
}
.pw .field {
  padding-right: 34px;
}
.pw-eye {
  position: absolute;
  top: 50%;
  right: 4px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--mute);
  transform: translateY(-50%);
}
.pw-eye:hover {
  background: var(--panel);
  color: var(--ink);
}

/* users (admin): replaces the list and the detail */
.users {
  grid-column: 2 / -1;
  gap: 16px;
  padding: 16px 24px 32px;
  overflow-y: auto;
  scrollbar-color: #4a4a4a transparent;
}
.u-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.u-who {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 260px;
  min-width: 0;
}
.u-email {
  overflow-wrap: anywhere;
}
.u-name {
  color: var(--mute);
}
.u-sites {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  flex: 2 1 320px;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px 2px 10px;
  border-radius: 9999px;
  background: var(--field);
  font-size: 12px;
  color: var(--mute);
}
.tag-x {
  padding: 0 6px;
  border: 0;
  border-radius: 9999px;
  background: none;
  font-size: 14px;
  line-height: 1.2;
  color: var(--dim);
}
.tag-x:hover {
  color: var(--danger);
}
.u-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.u-add .field {
  width: auto;
  max-width: 280px;
  padding: 4px 8px;
  background: var(--field);
}
.u-row .btn.small {
  align-self: center;
}
.u-actions {
  display: flex;
  gap: 8px;
}
.u-new {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  max-width: 420px;
  margin-top: 8px;
}
.u-new .field {
  background: var(--field);
}
.u-new .cap {
  padding: 0;
}
.check-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--mute);
}
.secret {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 16px;
  border: 2px solid var(--focus);
  border-radius: 8px;
  background: var(--sel);
}
.secret-pw {
  padding: 8px 12px;
  border-radius: 4px;
  background: var(--pin);
  font: 16px/1.4 var(--font-mono);
  overflow-wrap: anywhere;
  user-select: all;
}
.secret-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* a short message on top (a failed load, a failed action) */
.banner {
  position: fixed;
  top: 8px;
  left: 50%;
  z-index: 10;
  max-width: min(640px, calc(100vw - 16px));
  padding: 8px 16px;
  border: 1px solid var(--danger);
  border-radius: 8px;
  background: #3a2422;
  font-size: 12px;
  transform: translateX(-50%);
  cursor: pointer;
}

/* narrow: the columns lie under each other and the page scrolls */
@media (max-width: 999px) {
  html,
  body {
    height: auto;
  }
  .app {
    display: block;
    height: auto;
  }
  .side {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .list-col {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .list {
    flex: none;
    max-height: 60vh;
  }
  .detail-body {
    flex: none;
    overflow: visible;
  }
  .detail-head {
    flex-wrap: wrap;
  }
}
