:root {
  --bg: #0f1012; --panel: #17191c; --line: #26292e; --text: #eceef1; --muted: #9298a2;
  --accent: #e3262f; --accent-2: #ff4d55; --ok: #2fbf71; --radius: 6px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
a { color: inherit; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; }
main { padding: 0 20px 40px; max-width: 1800px; margin: 0 auto; }

/* header */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 22px; padding: 10px 20px;
  background: rgba(15,16,18,.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.brand .mark { background: var(--accent); color: #fff; padding: 4px 7px; border-radius: 3px; font-size: 13px; letter-spacing: .08em; }
.top nav { display: flex; gap: 4px; }
.top nav a { text-decoration: none; color: var(--muted); padding: 6px 10px; border-radius: var(--radius); font-size: 14px; display: flex; align-items: center; gap: 7px; }
.top nav a:hover, .top nav a.on { color: var(--text); background: var(--panel); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(227,38,47,.6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(227,38,47,0); } 100% { box-shadow: 0 0 0 0 rgba(227,38,47,0); } }
.search { flex: 1; max-width: 520px; }
.search { position: relative; display: flex; align-items: center; }
.search .tag { position: absolute; left: 8px; display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; padding: 3px 7px; border-radius: 4px; pointer-events: none; }
.live-search .tag { background: rgba(227,38,47,.18); color: #ff6b72; }
.live-search input { padding-left: 74px !important; border-color: #3a3d44 !important; }
.live-search input:focus { outline: none; border-color: var(--accent) !important; }
.archive-search { max-width: 300px; }
.archive-search .tag { background: var(--line); color: var(--muted); }
.archive-search input { padding-left: 84px !important; }
.archive-search input:focus { outline: none; border-color: var(--muted) !important; }
.search input, .filters input, .filters select { width: 100%; background: var(--panel); border: 1px solid var(--line); color: var(--text);
  padding: 8px 12px; border-radius: var(--radius); font-size: 14px; }
.who { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }
.role { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; padding: 2px 6px; border-radius: 3px; background: var(--line); color: var(--text); }
.role-admin { background: var(--accent); }
.role-editor { background: #2b5fd9; }
.role-client { background: #3a3f47; }

/* buttons & forms */
.btn, .btn-ghost, button { font: inherit; cursor: pointer; }
.btn { display: inline-block; background: var(--accent); color: #fff; border: 0; padding: 10px 16px; border-radius: var(--radius); font-weight: 600; text-decoration: none; font-size: 14px; }
.btn:hover { background: var(--accent-2); }
.btn-ghost { display: inline-block; background: transparent; color: var(--text); border: 1px solid var(--line); padding: 7px 12px; border-radius: var(--radius); text-decoration: none; font-size: 13px; }
.btn-ghost:hover { border-color: var(--muted); }
.btn-ghost.danger { color: var(--accent-2); border-color: rgba(227,38,47,.4); }
input, textarea, select { font: inherit; }

/* hero (public) */
.hero { text-align: center; padding: 56px 20px 40px; max-width: 760px; margin: 0 auto; }
.hero h1 { font-size: clamp(28px, 5vw, 46px); margin: 0 0 12px; letter-spacing: -.02em; }
.hero p { color: var(--muted); font-size: 17px; line-height: 1.5; margin: 0 0 24px; }
.hero-search { display: flex; gap: 8px; max-width: 560px; margin: 0 auto; }
.hero-search input { flex: 1; font-size: 17px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.hero-search button { background: var(--accent); color: #fff; border: 0; border-radius: var(--radius); padding: 0 22px; font-weight: 600; font-size: 16px; }
.hero-note { color: var(--muted); font-size: 13px; margin: 8px 0 22px; }
.hero-archive input { font-size: 15px; padding: 11px 14px; }
.hero-archive button { background: transparent; border: 1px solid var(--line); color: var(--text); font-size: 14px; }
.hero-archive button:hover { border-color: var(--muted); }

/* page bar */
.bar { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; padding: 22px 0 14px; flex-wrap: wrap; }
.bar h1 { margin: 0; font-size: 24px; letter-spacing: -.01em; }
.meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.crumb { color: var(--muted); text-decoration: none; font-size: 13px; display: inline-block; margin-bottom: 6px; }
.crumb:hover { color: var(--text); }
.filters { min-width: 240px; }

/* justified photo grid */
.grid { display: flex; flex-wrap: wrap; gap: 6px; }
.grid::after { content: ''; flex-grow: 999999999; }
.tile { position: relative; display: block; overflow: hidden; background: var(--panel); border-radius: 3px; }
.tile i { display: block; }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.tile:hover img { transform: scale(1.03); }
.tile .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 10px 8px; font-size: 12px; line-height: 1.3;
  background: linear-gradient(transparent, rgba(0,0,0,.85)); opacity: 0; transition: opacity .2s; }
.tile:hover .cap { opacity: 1; }
.tile .cap b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .cap small { color: #c9ccd2; }
.tile.is-new { outline: 2px solid var(--accent); outline-offset: -2px; animation: fadein .6s; }
@keyframes fadein { from { opacity: 0; } }
.tile.is-hidden img { opacity: .35; }
.flag { position: absolute; top: 6px; left: 6px; background: var(--accent); font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 3px; letter-spacing: .06em; }
@media (hover: none) { .tile .cap { opacity: 1; } }
.newbar { position: sticky; top: 64px; z-index: 5; margin: 0 auto 10px; width: fit-content; background: var(--accent); color: #fff;
  padding: 7px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,.4); }
.more { text-align: center; padding: 24px; display: flex; justify-content: center; gap: 10px; }
.more button { background: var(--panel); color: var(--text); border: 1px solid var(--line); padding: 10px 26px; border-radius: var(--radius); }
.empty { color: var(--muted); text-align: center; padding: 40px; }

/* gallery cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.card { background: var(--panel); border-radius: var(--radius); overflow: hidden; text-decoration: none; border: 1px solid var(--line); transition: border-color .2s; }
.card:hover { border-color: var(--muted); }
.cover { aspect-ratio: 3 / 2; background: #0b0c0d; }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body { padding: 10px 12px 12px; }
.card-body b { display: block; font-size: 14px; line-height: 1.3; }
.card-body small { color: var(--muted); font-size: 12px; }

/* single photo */
.photo-page { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; padding-top: 20px; }
.stage { position: relative; display: flex; align-items: center; justify-content: center; background: #08090a; border-radius: var(--radius); min-height: 60vh; }
.stage img { max-width: 100%; max-height: calc(100vh - 120px); display: block; }
.stage img.dim { opacity: .5; }
.nav-arrow { position: absolute; top: 50%; transform: translateY(-50%); font-size: 44px; text-decoration: none; color: #fff;
  background: rgba(0,0,0,.45); width: 46px; height: 70px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius); }
.nav-arrow.prev { left: 8px; } .nav-arrow.next { right: 8px; }
.info h1 { font-size: 20px; margin: 4px 0 10px; line-height: 1.3; }
.caption { color: #cfd2d7; line-height: 1.55; font-size: 14px; white-space: pre-line; }
.hint { display: block; color: var(--muted); font-size: 12px; margin: 6px 0 16px; }
.staff-tools { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 16px; }
.facts { display: grid; grid-template-columns: 100px 1fr; gap: 6px 10px; font-size: 13px; border-top: 1px solid var(--line); padding-top: 14px; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; word-break: break-word; }
.alert { background: rgba(227,38,47,.15); border: 1px solid rgba(227,38,47,.4); padding: 8px 12px; border-radius: var(--radius); font-size: 13px; margin: 8px 0; }
.buy { margin-top: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.buy h2 { margin: 0 0 4px; font-size: 17px; }
.buy p { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.buy form { display: grid; gap: 8px; }
.buy input, .buy textarea, .login input, .adduser input, .adduser select, .inline input {
  background: var(--bg); border: 1px solid var(--line); color: var(--text); padding: 9px 11px; border-radius: var(--radius); font-size: 14px; }
.hp { position: absolute; left: -9999px; }
.ok { color: var(--ok); font-weight: 600; }
@media (max-width: 900px) {
  .photo-page { grid-template-columns: 1fr; }
  .top { flex-wrap: wrap; gap: 10px; }
  .search { order: 5; flex-basis: 100%; max-width: none; }
  .archive-search { order: 6; }
  .brand .name { display: none; }
}

/* login */
.login { max-width: 380px; margin: 60px auto; }
.login form { display: grid; gap: 14px; margin-top: 18px; }
.login label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }

/* admin */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px; overflow-x: auto; }
.panel h2 { margin: 0 0 12px; font-size: 16px; }
.panel h3 { font-size: 14px; margin: 18px 0 8px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--line); }
td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.off { opacity: .45; }
tr.st-new td:first-child { box-shadow: inset 3px 0 var(--accent); }
.mini { width: 90px; height: 60px; object-fit: cover; border-radius: 3px; }
.row-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.row-tools form { margin: 0; }
.inline { display: flex; gap: 4px; }
.inline input { padding: 6px 8px; width: 140px; }
.adduser { display: flex; gap: 8px; flex-wrap: wrap; }
td select { background: var(--bg); color: var(--text); border: 1px solid var(--line); padding: 4px; border-radius: 4px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 30px; border-top: 1px solid var(--line); }
.foot a { color: var(--muted); }
.warn { color: var(--accent-2); }
.foot { line-height: 1.8; }
.archive-hint { text-align: center; color: var(--muted); font-size: 14px; padding: 6px 0 20px; }
.archive-hint a { color: var(--text); font-weight: 600; }
.hero-search input { min-width: 0; }
@media (max-width: 600px) {
  .hero { padding: 32px 4px 24px; }
  .hero-search { flex-direction: column; }
  .hero-search button { padding: 12px 22px; }
}
