/* Interrail Vault — design tokens and components from the approved
   "Interrail Vault v2" Claude Design canvas. Light Ant-Design-style theme. */

:root {
  --accent: #1677ff;
  --accent-hover: #4096ff;
  --accent-bg: #e6f4ff;
  --accent-border: #91caff;
  --bg: #f5f5f5;
  --surface: #fff;
  --border: #f0f0f0;
  --border-strong: #d9d9d9;
  --text: #1f1f1f;
  --text-2: #595959;
  --text-3: #8c8c8c;
  --text-4: #bfbfbf;
  --red-bg: #fff1f0; --red-border: #ffa39e; --red: #cf1322;
  --amber-bg: #fffbe6; --amber-border: #ffe58f; --amber: #d48806;
  --green-bg: #f6ffed; --green-border: #b7eb8f; --green: #389e0d;
  --purple-bg: #f9f0ff; --purple: #722ed1;
  --mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  --shadow: 0 1px 2px rgba(0,0,0,0.03), 0 2px 8px rgba(0,0,0,0.04);
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased; font-size: 14px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
input::placeholder { color: var(--text-4); }
button { font-family: inherit; cursor: pointer; }
.mono { font-family: var(--mono); }

/* ---------- App shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 256px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border); padding: 18px 14px;
  position: sticky; top: 0; height: 100vh;
}
.logo-row { display: flex; align-items: center; gap: 10px; padding: 2px 10px 16px; }
.logo-badge {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent-bg);
  color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.logo-name { font-size: 14px; font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 6px; font-size: 14px; color: var(--text-2);
}
.nav a:hover { background: var(--bg); color: var(--text); }
.nav a.active { background: var(--accent-bg); color: var(--accent); font-weight: 500; }
.side-spacer { flex: 1; }
.user-card {
  display: flex; align-items: center; gap: 10px; padding: 12px 10px 2px;
  border-top: 1px solid var(--border);
}
.avatar {
  width: 30px; height: 30px; border-radius: 99px; background: var(--accent-bg);
  color: var(--accent); display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.user-card .name { font-size: 13px; font-weight: 500; }
.user-card .email {
  font-size: 11px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px;
}

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 64px; flex-shrink: 0; display: flex; align-items: center; gap: 14px;
  padding: 0 28px; border-bottom: 1px solid var(--border); background: var(--surface);
  position: sticky; top: 0; z-index: 5;
}
.topbar .title { font-size: 16px; font-weight: 600; }
.topbar .count { font-size: 13px; color: var(--text-3); }
.topbar .crumb { font-size: 13.5px; color: var(--text-3); }
.topbar .crumb-sep { color: var(--border-strong); }
.topbar .crumb-here { font-size: 13.5px; font-weight: 500; color: var(--text); }
.spacer { flex: 1; }
.content { padding: 24px 28px; display: flex; flex-direction: column; gap: 16px; }

/* ---------- Buttons ---------- */
.btn-primary {
  display: inline-flex; align-items: center; gap: 7px; background: var(--accent);
  color: #fff; border: none; border-radius: 6px; padding: 8px 14px;
  font-size: 13px; font-weight: 500; box-shadow: 0 2px 0 rgba(5,145,255,0.1);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: 6px; padding: 8px 16px; font-size: 13px;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-reveal {
  background: var(--surface); color: var(--accent); border: 1px solid var(--accent-border);
  border-radius: 6px; padding: 4px 12px; font-size: 12px;
}
.btn-reveal:hover { background: var(--accent-bg); }
.btn-danger {
  background: var(--surface); color: var(--red); border: 1px solid var(--red-border);
  border-radius: 6px; padding: 8px 16px; font-size: 13px; flex-shrink: 0;
}
.btn-danger:hover { background: var(--red-bg); }
.icon-btn {
  background: none; border: none; padding: 0; width: 26px; height: 26px;
  border-radius: 6px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-3); flex-shrink: 0;
}
.icon-btn:hover { background: #f0f0f0; color: var(--accent); }
.icon-btn.danger:hover { background: var(--red-bg); color: var(--red); }
.row-actions { display: flex; align-items: center; gap: 2px; justify-content: flex-end; }
.row-actions form { display: inline-flex; }
.row-actions .icon-btn { width: 30px; height: 30px; }

/* ---------- Inputs ---------- */
.input, .select, .textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 6px; padding: 8px 12px; color: var(--text); font-size: 14px;
  font-family: inherit; outline: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 2px rgba(22,119,255,0.1);
}
.search-wrap { position: relative; flex: 1; max-width: 520px; }
.search-wrap svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-4);
}
.search-wrap .input { padding-left: 36px; }
.field-label { font-size: 13px; margin-bottom: 6px; display: block; }

/* ---------- Chips ---------- */
.chips { display: flex; gap: 8px; }
.chip {
  padding: 6px 14px; border-radius: 99px; font-size: 13px;
  background: var(--surface); color: var(--text-2); border: 1px solid var(--border-strong);
  display: inline-block;
}
.chip:hover { color: var(--accent); border-color: var(--accent); }
.chip.active { background: var(--accent-bg); color: var(--accent); border-color: var(--accent-border); }

/* ---------- Badges ---------- */
.badge { padding: 2px 10px; border-radius: 4px; font-size: 12px; display: inline-block; border: 1px solid transparent; }
.badge-red { background: var(--red-bg); border-color: var(--red-border); color: var(--red); }
.badge-amber { background: var(--amber-bg); border-color: var(--amber-border); color: var(--amber); }
.badge-green { background: var(--green-bg); border-color: var(--green-border); color: var(--green); }
.badge-purple { background: var(--purple-bg); border-color: #d3adf7; color: var(--purple); }
.badge-blue { background: var(--accent-bg); border-color: var(--accent-border); color: #0958d9; }
.badge-gray { background: var(--bg); border-color: var(--border-strong); color: var(--text-2); }
.badge-mono { font-family: var(--mono); font-size: 11px; }
.tag {
  padding: 1px 8px; border-radius: 4px; font-family: var(--mono); font-size: 11px;
  background: #fafafa; border: 1px solid var(--border-strong); color: var(--text-2);
}

/* ---------- Tables ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden; box-shadow: var(--shadow);
}
.trow { display: grid; gap: 16px; align-items: center; padding: 13px 20px; }
.trow + .trow, tbody .trow { border-top: 1px solid var(--border); }
.thead {
  display: grid; gap: 16px; padding: 12px 20px; font-size: 13px; font-weight: 600;
  background: #fafafa; border-bottom: 1px solid var(--border);
}
.grid-items { grid-template-columns: 2fr 1.2fr 1.5fr 0.6fr 0.7fr; }
.grid-servers { grid-template-columns: 1.2fr 1.3fr 1fr 1.4fr 0.6fr 0.7fr; }
.grid-keys { grid-template-columns: 1.6fr 0.8fr 1.5fr 0.9fr 1fr; }
a.trow { color: inherit; display: grid; }
a.trow:hover, .trow.hover:hover { background: #fafafa; color: inherit; }

.item-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.kind-icon {
  width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0;
}
.kind-credential { background: var(--accent-bg); color: var(--accent); }
.kind-server { background: var(--bg); color: var(--text-2); }
.kind-ssh_key { background: var(--purple-bg); color: var(--purple); }
.item-cell .iname { font-size: 14px; font-weight: 500; }
.item-cell .isub { font-size: 12px; color: var(--text-3); }
.item-cell .isub .mono { font-size: 12px; }

.secret-cell { display: flex; align-items: center; gap: 4px; min-width: 0; }
.login-val {
  font-family: var(--mono); font-size: 12.5px; color: var(--text-2);
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.secret-mask {
  font-family: var(--mono); font-size: 12.5px; color: var(--text-2);
  letter-spacing: 0.08em; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.muted { color: var(--text-3); font-size: 13px; }
.faint { color: var(--text-4); font-size: 12px; }

/* ---------- Detail page ---------- */
.detail-head { display: flex; align-items: center; gap: 14px; }
.detail-icon {
  width: 44px; height: 44px; border-radius: 10px; display: flex;
  align-items: center; justify-content: center;
}
.detail-name { font-size: 20px; font-weight: 600; }
.detail-cols { display: flex; gap: 20px; align-items: flex-start; }
.detail-maincol { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 22px 24px; display: flex; flex-direction: column; gap: 18px; box-shadow: var(--shadow); }
.flabel { font-size: 12px; font-weight: 600; color: var(--text-3); margin-bottom: 7px; }
.fbox {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #fafafa; border: 1px solid var(--border); border-radius: 6px; padding: 9px 12px;
}
.fbox .val { font-family: var(--mono); font-size: 13.5px; }
.fbox .val.spaced { letter-spacing: 0.1em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fbox-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.notes-box {
  background: #fafafa; border: 1px solid var(--border); border-radius: 6px;
  padding: 12px; font-size: 13px; color: var(--text-2); line-height: 1.6; white-space: pre-wrap;
}
.danger-zone {
  background: var(--surface); border: 1px solid #ffccc7; border-radius: 8px;
  padding: 18px 24px; display: flex; align-items: center; gap: 16px;
}
.danger-zone .dz-title { font-size: 13px; font-weight: 600; color: var(--red); margin-bottom: 3px; }
.danger-zone .dz-sub { font-size: 12.5px; color: var(--text-3); }
.side-panel {
  width: 320px; flex-shrink: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 18px 20px; box-shadow: var(--shadow);
}
.vrow { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.vrow:first-of-type { margin-top: 0; }
.vnum { font-family: var(--mono); font-size: 12px; width: 24px; color: var(--text-3); }
.vnum.current { color: var(--text); }
.vmeta { font-size: 12px; color: var(--text-3); margin-left: auto; white-space: nowrap; }
.vrow form { display: inline; }
.vrow .linklike { background: none; border: none; padding: 0; font-size: 12px; color: var(--accent); }
.vrow .linklike:hover { color: var(--accent-hover); }

/* ---------- Auth screens ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 20px; background: var(--bg); padding: 24px;
}
.auth-logo { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 8px; }
.auth-logo-badge {
  width: 52px; height: 52px; border-radius: 12px; background: var(--accent-bg);
  border: 1px solid var(--accent-border); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.auth-title { font-size: 20px; font-weight: 600; }
.auth-sub { font-size: 14px; color: var(--text-3); }
.auth-card {
  width: 384px; max-width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 28px; display: flex; flex-direction: column; gap: 16px;
  box-shadow: var(--shadow);
}
.auth-card.compact { padding: 22px 28px; gap: 14px; }
.auth-footer { font-family: var(--mono); font-size: 11px; color: var(--text-4); margin-top: 10px; }
.auth-error {
  background: var(--red-bg); border: 1px solid var(--red-border); color: var(--red);
  border-radius: 6px; padding: 8px 12px; font-size: 13px;
}
.card-head { display: flex; align-items: center; gap: 10px; }
.card-head .ct { font-size: 14px; font-weight: 600; }
.hint { font-size: 13px; color: var(--text-2); line-height: 1.5; }

.flash-ok {
  background: var(--green-bg); border: 1px solid var(--green-border); color: var(--green);
  border-radius: 6px; padding: 10px 14px; font-size: 13px;
}
.flash-ok .mono { user-select: all; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.page-note { font-size: 12px; color: var(--text-4); padding-left: 2px; }
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
