:root {
  --bg: #0b1120; --panel: #121a2d; --panel-2: #18223a; --line: #26324f;
  --text: #edf1fa; --muted: #8f9bb8; --gold: #d9b46a; --gold-2: #f0d79c;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
body {
  min-height: 100vh; color: var(--text); line-height: 1.5;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1c2a4d 0, transparent 60%) fixed, var(--bg);
}
h1, h2, .brand { font-family: "Iowan Old Style", Palatino, Georgia, serif; font-weight: 600; }
input, select, button { font: inherit; color: inherit; }
input, select {
  width: 100%; height: 44px; padding: 0 12px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 10px; transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px #d9b46a33; }
button { cursor: pointer; border-radius: 10px; transition: transform .2s var(--ease), background .2s, border-color .2s, opacity .2s; }
button:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
button:active { transform: scale(.97); }
button:disabled { opacity: .35; cursor: default; }
.primary { height: 46px; width: 100%; border: 0; font-weight: 600; color: #17120a; background: linear-gradient(135deg, var(--gold-2), var(--gold)); }
.primary:hover:enabled { transform: translateY(-2px); }
.ghost { height: 40px; padding: 0 16px; background: transparent; border: 1px solid var(--line); }
.ghost:hover:enabled { border-color: var(--gold); }
.muted { color: var(--muted); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(380px, 100%); padding: 36px 32px; text-align: center; background: var(--panel);
  border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 30px 80px #0008; animation: rise .6s var(--ease) both;
}
.login-card h1 { font-size: 26px; margin-bottom: 22px; }
.login-card label { display: block; text-align: left; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.login-card input { margin-bottom: 16px; }
.login-card .error { color: #ff8d8d; margin: 14px 0 0; min-height: 22px; }
.login-card.shake { animation: shake .4s; }

#app { max-width: 1240px; margin: auto; padding: 0 24px 48px; animation: fade .5s both; }
header { display: flex; justify-content: space-between; align-items: center; padding: 22px 0; }
.brand { font-size: 21px; }
.toolbar { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.searchbox input { height: 54px; padding: 0 18px; font-size: 17px; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-top: 14px; align-items: end; }
.filters label { display: grid; gap: 5px; font-size: 12px; color: var(--muted); min-width: 0; }
.filters input, .filters select { color: var(--text); font-size: 14px; }
.filters button { height: 44px; }
.summary { margin: 22px 2px 14px; color: var(--muted); min-height: 22px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 14px; transition: opacity .25s; }
.grid.loading { opacity: .5; }
.card {
  display: flex; gap: 14px; align-items: flex-start; text-align: left; padding: 18px; min-width: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; animation: rise .45s var(--ease) backwards;
}
.card:hover { transform: translateY(-4px); border-color: var(--gold); background: var(--panel-2); }
.card-text { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
.card-text strong { font-size: 15px; }
.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 60px 20px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 28px; color: var(--muted); }

dialog {
  position: fixed; inset: 0 0 0 auto; width: min(440px, 100%); height: 100%; height: 100dvh; max-height: none; max-width: 100%;
  margin: 0 0 0 auto; padding: 28px; color: var(--text); background: var(--panel); border: 0; border-left: 1px solid var(--line);
}
dialog[open] { animation: slide .4s var(--ease); }
dialog::backdrop { background: #040813b0; backdrop-filter: blur(5px); animation: fade .35s; }
.detail-head { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.detail-head h2 { flex: 1; font-size: 21px; overflow-wrap: anywhere; }
dl div { padding: 13px 0; border-bottom: 1px solid var(--line); }
dt { font-size: 12px; color: var(--muted); }
dd { margin: 2px 0 0; overflow-wrap: anywhere; }
#copy { margin-top: 24px; }

@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(100%); } }
@keyframes shake { 25% { transform: translateX(-8px); } 50% { transform: translateX(7px); } 75% { transform: translateX(-4px); } }
@media (max-width: 600px) {
  #app { padding: 0 14px 32px; }
  .filters { grid-template-columns: 1fr 1fr; }
  input, select { font-size: 16px !important; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, ::backdrop { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
