/* joki-prompt-manager — Command Code style: pure black, monochrome, mono type, ticked cards */
:root {
  --bg: #000000;
  --panel: #0a0b0d;
  --panel-2: #131417;
  --panel-3: #1b1d21;
  --border: #26282e;
  --border-soft: #191b1f;
  --tick: #4b4f57;           /* corner bracket marks */
  --text: #f2f4f7;
  --muted: #8b909a;
  --faint: #565b64;
  --accent: #f2f4f7;         /* monochrome "accent" = near white */
  --accent-dim: #1b1d21;     /* active fill */
  --star: #e0b341;
  --danger: #f2555a;
  --radius: 3px;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
:root[data-theme="light"] {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel-2: #eef0f3;
  --panel-3: #e6e9ee;
  --border: #d5dae1;
  --border-soft: #e6e9ee;
  --tick: #b3bac3;
  --text: #0d0f12;
  --muted: #5c6472;
  --faint: #98a1af;
  --accent: #0d0f12;
  --accent-dim: #e6e9ee;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); overflow: hidden;
  font-family: var(--mono); font-size: 13.5px; -webkit-font-smoothing: antialiased;
}
a { color: var(--text); text-decoration: none; }
button { font-family: inherit; cursor: pointer; color: inherit; }
::selection { background: #2b2e34; }

/* thin, dark scrollbars (Command Code style) */
.nav, .content, .modal, .modal-backdrop { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.nav::-webkit-scrollbar, .content::-webkit-scrollbar, .modal::-webkit-scrollbar { width: 8px; height: 8px; }
.nav::-webkit-scrollbar-track, .content::-webkit-scrollbar-track, .modal::-webkit-scrollbar-track { background: transparent; }
.nav::-webkit-scrollbar-thumb, .content::-webkit-scrollbar-thumb, .modal::-webkit-scrollbar-thumb {
  background: var(--border); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box;
}
.nav:hover::-webkit-scrollbar-thumb, .content:hover::-webkit-scrollbar-thumb { background: #3a3d44; background-clip: padding-box; }
.nav::-webkit-scrollbar-thumb:hover, .content::-webkit-scrollbar-thumb:hover { background: #4b4f57; background-clip: padding-box; }
.nav::-webkit-scrollbar-corner, .content::-webkit-scrollbar-corner { background: transparent; }

/* inline SVG icons */
.ic { width: 16px; height: 16px; display: inline-block; vertical-align: -3px; flex: none; }
.btn .ic, .icon-btn .ic { width: 14px; height: 14px; vertical-align: -2px; }

/* corner-tick helper: draws 4 L brackets just inside a bordered box */
.ticked { position: relative; }
.ticked::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(var(--tick),var(--tick)) left  6px  top    6px / 11px 1px no-repeat,
    linear-gradient(var(--tick),var(--tick)) left  6px  top    6px / 1px 11px no-repeat,
    linear-gradient(var(--tick),var(--tick)) right 6px  top    6px / 11px 1px no-repeat,
    linear-gradient(var(--tick),var(--tick)) right 6px  top    6px / 1px 11px no-repeat,
    linear-gradient(var(--tick),var(--tick)) left  6px  bottom 6px / 11px 1px no-repeat,
    linear-gradient(var(--tick),var(--tick)) left  6px  bottom 6px / 1px 11px no-repeat,
    linear-gradient(var(--tick),var(--tick)) right 6px  bottom 6px / 11px 1px no-repeat,
    linear-gradient(var(--tick),var(--tick)) right 6px  bottom 6px / 1px 11px no-repeat;
}

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login-card {
  width: 100%; max-width: 380px; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 34px 30px;
}
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.brand .dot { width: 9px; height: 9px; background: var(--text); }
.brand-name { font-family: var(--mono); font-weight: 700; letter-spacing: 1px; font-size: 13px; text-transform: uppercase; }
.login-title { font-size: 22px; font-weight: 700; margin: 20px 0 4px; letter-spacing: -0.5px; }
.login-title::before { content: "// "; color: var(--faint); }
.login-sub { color: var(--muted); margin: 0 0 24px; font-size: 12.5px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .06em; }
.input, input[type="text"], input[type="email"], input[type="password"], textarea, select {
  width: 100%; padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 13.5px; font-family: inherit;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, input:focus, textarea:focus, select:focus {
  border-color: var(--text); box-shadow: 0 0 0 3px rgba(255,255,255,0.06);
}
textarea { resize: vertical; min-height: 130px; font-size: 13px; line-height: 1.6; }

/* keep browser autofill on-theme (otherwise text turns black on light bg in dark mode) */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--panel-2) inset !important;
  box-shadow: 0 0 0 1000px var(--panel-2) inset !important;
  transition: background-color 9999s ease-out 0s;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 14px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); font-size: 12.5px; font-weight: 500;
  letter-spacing: .02em; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 700; }
.btn-primary:hover { background: #ffffff; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); background: rgba(242,85,90,0.08); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--panel-2); border-color: var(--border); }

.error-msg { color: var(--danger); font-size: 12px; margin-top: 10px; min-height: 16px; }
.ok-msg { color: var(--star); font-size: 12px; margin-top: 8px; min-height: 14px; }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: 250px 1fr; height: 100vh; overflow: hidden; }
.sidebar { background: var(--bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.sidebar-head { padding: 20px 18px 14px; flex: none; }
.search-box { position: relative; padding: 10px 12px; flex: none; }
.search-box input { padding-left: 32px; }
.search-ico { position: absolute; left: 22px; top: 50%; transform: translateY(-50%); color: var(--faint); display: flex; }
.search-ico .ic { width: 15px; height: 15px; }

.nav { flex: 1; overflow-y: auto; padding: 6px; }
.nav-section { padding: 14px 12px 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--faint); }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px;
  border-radius: var(--radius); border: 1px solid transparent; background: transparent;
  color: var(--muted); font-size: 12.5px; text-align: left; margin-bottom: 1px;
}
.nav-item:hover { color: var(--text); background: var(--panel); }
.nav-item.active { background: var(--accent-dim); color: var(--text); border-color: var(--border); }
.nav-item .count { margin-left: auto; font-size: 11px; color: var(--faint); }

.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; flex: none; }
.profile-trigger { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; background: transparent; border: 1px solid transparent; border-radius: var(--radius); padding: 4px; text-align: left; color: var(--text); }
.profile-trigger:hover { background: var(--panel); border-color: var(--border); }
.modal-section { border-top: 1px solid var(--border-soft); margin-top: 18px; padding-top: 16px; }
.modal-section h4 { margin: 0 0 12px; font-size: 13px; font-weight: 700; letter-spacing: .02em; }
.modal-readonly { font-size: 12px; color: var(--muted); margin: 0 0 14px; }
.modal-readonly b { color: var(--text); font-weight: 600; }
.avatar { width: 30px; height: 30px; border-radius: var(--radius); background: var(--panel-3); color: var(--text); display: grid; place-items: center; font-weight: 700; font-size: 13px; border: 1px solid var(--border); }
.who { min-width: 0; }
.who .name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .role { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* ---------- main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; overflow: hidden; background: var(--bg); }
.topbar { display: flex; align-items: center; gap: 10px; padding: 16px 24px; border-bottom: 1px solid var(--border); flex: none; }
.nav-item .ico { width: 16px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.nav-item.active .ico, .nav-item:hover .ico { color: var(--text); }
.topbar h1 { font-size: 17px; font-weight: 700; margin: 0; letter-spacing: -0.3px; }
.topbar h1::before { content: "// "; color: var(--faint); font-weight: 400; }
.topbar .sub { color: var(--faint); font-size: 12px; }
.spacer { flex: 1; }
.badge { font-size: 10.5px; padding: 3px 8px; border-radius: 2px; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.content { flex: 1; overflow-y: auto; padding: 22px 24px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 16px; display: flex; flex-direction: column; gap: 10px; min-height: 0;
  transition: border-color .15s;
}
.card:hover { border-color: #3a3d44; }
.card-head { display: flex; align-items: flex-start; gap: 8px; }
.card-title { font-weight: 600; font-size: 14px; line-height: 1.3; cursor: pointer; letter-spacing: -0.2px; }
.card-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.card-cat { font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .07em; margin-top: 4px; }
.tag-mine { display: inline-block; margin-left: 6px; padding: 1px 6px; border: 1px solid var(--border); border-radius: 2px; color: var(--star); letter-spacing: .05em; }
.card-body {
  font-size: 12px; line-height: 1.6; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer;
}
.card-actions { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 8px; }
.star { background: transparent; border: none; font-size: 16px; color: var(--faint); padding: 3px; border-radius: 3px; line-height: 1; }
.star:hover { color: var(--star); }
.star.on { color: var(--star); }
.icon-btn { background: transparent; border: 1px solid transparent; color: var(--muted); padding: 5px 8px; border-radius: var(--radius); font-size: 11.5px; }
.icon-btn:hover { border-color: var(--border); color: var(--text); }

/* ---------- smart prompt builder ---------- */
.smart { max-width: 860px; }
.smart-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.smart-card h4 { margin: 0 0 4px; font-size: 14px; font-weight: 700; }
.smart-card p.hint { margin: 0 0 16px; font-size: 12px; color: var(--muted); }
.smart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.smart .field { margin-bottom: 14px; }
.smart-sections { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chk { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); border: 1px solid var(--border); border-radius: var(--radius); padding: 7px 11px; cursor: pointer; user-select: none; }
.chk:hover { border-color: var(--text); color: var(--text); }
.chk input { width: auto; margin: 0; accent-color: var(--star); }
.chk.on { color: var(--text); border-color: var(--star); }
.smart-out .modal-body-text { max-height: 360px; overflow: auto; margin: 0 0 12px; }
.smart-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 640px) { .smart-row { grid-template-columns: 1fr; } }

.empty { text-align: center; color: var(--muted); padding: 64px 20px; }
.empty .big { margin-bottom: 12px; color: var(--faint); display: flex; justify-content: center; }
.empty .big .ic { width: 40px; height: 40px; }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(2px); display: none; place-items: center; padding: 24px; z-index: 50; }
.modal-backdrop.open { display: grid; }
.modal { width: 100%; max-width: 720px; max-height: 86vh; overflow: auto; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.2px; }
.modal-head h3::before { content: "// "; color: var(--faint); font-weight: 400; }
.modal-cat { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .07em; }
.modal-body-text { font-size: 13px; line-height: 1.7; white-space: pre-wrap; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 14px 0; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }
.modal .field label { color: var(--muted); }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--panel-2); border: 1px solid var(--text); color: var(--text); padding: 10px 16px; border-radius: var(--radius); font-size: 12.5px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.user-row { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; background: var(--bg); }
.user-row .grow { flex: 1; min-width: 0; }
.user-row .email { font-size: 12.5px; font-weight: 600; }
.user-row .meta { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

@media (max-width: 720px) { .app { grid-template-columns: 1fr; } .sidebar { display: none; } }
