/* Meortech admin panel */
:root {
  --bg: #131313; --bg-2: #1a1a1a; --bg-3: #222; --line: rgba(255,255,255,.1); --line-2: rgba(255,255,255,.18);
  --text: #e5e2e1; --muted: #a9b6b9; --cyan: #00e5ff; --cyan-ink: #00363d; --danger: #ff8a80; --danger-bg: #5c1410; --ok: #7ee2a8;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 400 15px/1.5 Inter, system-ui, sans-serif; min-height: 100vh; }
h1, h2, h3 { font-family: "Space Grotesk", sans-serif; margin: 0; line-height: 1.2; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--cyan); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.material-symbols-outlined { font-size: 20px; vertical-align: middle; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 40px; padding: .5rem 1rem; border-radius: 4px; border: 1px solid transparent; cursor: pointer; font-weight: 600; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; text-decoration: none; transition: background .15s, border-color .15s, opacity .15s; }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-primary { background: var(--cyan); color: var(--cyan-ink); }
.btn-primary:hover:not(:disabled) { background: #66f0ff; }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--text); }
.btn-ghost:hover { background: rgba(255,255,255,.06); }
.btn-danger { background: #c62828; color: #fff; }
.btn-danger:hover { background: #a61f1f; }
.btn-sm { min-height: 34px; padding: .35rem .75rem; font-size: 12px; }
.btn-block { width: 100%; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 4px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: rgba(255,255,255,.08); color: var(--text); }
.icon-btn:disabled { opacity: .3; cursor: default; background: none; }
.icon-btn.danger:hover { color: var(--danger); }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.login-box { width: 100%; max-width: 380px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 2.25rem 2rem; }
.login-logo { height: 28px; width: auto; margin-bottom: 1.5rem; }
.login-box h1 { font-size: 1.75rem; margin-bottom: .35rem; }
.login-box p { margin: 0 0 1.5rem; font-size: 14px; }
.login-box label { display: block; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: .4rem; }
.login-box input { width: 100%; margin-bottom: 1rem; }

/* Inputs */
input[type=text], input[type=password], input[type=number], input[type=url], select, textarea {
  width: 100%; background: rgba(255,255,255,.04); border: 1px solid var(--line-2); border-radius: 4px; padding: .6rem .75rem; min-height: 42px;
}
textarea { min-height: 96px; resize: vertical; }
select option { background: var(--bg-2); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cyan); }
[aria-invalid="true"] { border-color: var(--danger) !important; }
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: .35rem; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: .3rem; }
.field-error { color: var(--danger); font-size: 13px; margin: .35rem 0 0; min-height: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.check { display: flex; align-items: center; gap: .6rem; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--cyan); }

/* Top bar & tabs */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1.5rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .75rem; }
.brand img { height: 22px; width: auto; }
.brand span { font: 500 11px "IBM Plex Mono", monospace; letter-spacing: .25em; text-transform: uppercase; color: var(--cyan); border-left: 1px solid var(--line-2); padding-left: .75rem; }
.topbar-right { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.tabs { display: flex; gap: .25rem; padding: 0 1.5rem; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { display: inline-flex; align-items: center; gap: .45rem; background: none; border: 0; border-bottom: 2px solid transparent; padding: .9rem .9rem; cursor: pointer; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--cyan); border-bottom-color: var(--cyan); }
.badge { display: inline-flex; min-width: 20px; height: 20px; padding: 0 6px; align-items: center; justify-content: center; border-radius: 10px; background: var(--cyan); color: var(--cyan-ink); font-size: 11px; font-weight: 700; }
.content { max-width: 1080px; margin: 0 auto; padding: 1.75rem 1.5rem 4rem; }

/* Panels & lists */
.panel-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.panel-head h2 { font-size: 1.6rem; }
.panel-head p { margin: .25rem 0 0; max-width: 60ch; }
.list { display: flex; flex-direction: column; gap: .5rem; }
.row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .75rem; padding: .75rem .75rem .75rem .5rem; background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px; }
.row.inactive { border-style: dashed; }
.row.inactive .row-title { opacity: .72; text-decoration: line-through; text-decoration-color: rgba(255,255,255,.35); }
.row.dragging { opacity: .4; }
.row.drop-before { box-shadow: 0 -3px 0 var(--cyan); }
.row.drop-after { box-shadow: 0 3px 0 var(--cyan); }
.handle { display: flex; align-items: center; gap: .1rem; color: var(--muted); }
.handle .grip { cursor: grab; padding: .25rem; }
.handle .order-btns { display: flex; flex-direction: column; }
.handle .order-btns .icon-btn { width: 28px; height: 20px; }
.row-main { min-width: 0; }
.row-title { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { font-size: 13px; color: var(--muted); display: flex; gap: .75rem; flex-wrap: wrap; margin-top: .15rem; }
.row-meta .tag { font: 500 11px "IBM Plex Mono", monospace; letter-spacing: .12em; text-transform: uppercase; }
.row-actions { display: flex; align-items: center; gap: .25rem; }
.switch { position: relative; display: inline-flex; align-items: center; gap: .5rem; font-size: 12px; color: var(--muted); cursor: pointer; margin-right: .5rem; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 36px; height: 20px; border-radius: 10px; background: #444; position: relative; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .track { background: var(--cyan); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--cyan); outline-offset: 2px; }

.state { text-align: center; padding: 3rem 1rem; border: 1px dashed var(--line-2); border-radius: 8px; color: var(--muted); }
.state .btn { margin-top: 1rem; }
.skeleton { height: 62px; border-radius: 6px; background: linear-gradient(90deg, var(--bg-2), var(--bg-3), var(--bg-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Submissions */
.filters { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { background: none; border: 1px solid var(--line-2); border-radius: 999px; padding: .35rem .8rem; cursor: pointer; color: var(--muted); font-size: 13px; }
.chip.active { background: var(--cyan); border-color: var(--cyan); color: var(--cyan-ink); font-weight: 600; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: .7rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font: 500 11px "IBM Plex Mono", monospace; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); background: var(--bg-2); }
tr:last-child td { border-bottom: 0; }
tr.unread td:first-child { box-shadow: inset 3px 0 0 var(--cyan); }
tr.unread .who { font-weight: 700; }
.type-pill { font: 500 11px "IBM Plex Mono", monospace; letter-spacing: .1em; text-transform: uppercase; padding: .15rem .5rem; border: 1px solid var(--line-2); border-radius: 3px; white-space: nowrap; }
.dl { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: .1rem 1rem; margin: 0; }
.dl dt { color: var(--muted); font-size: 13px; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.dl dd { margin: 0; padding: .5rem 0; border-bottom: 1px solid var(--line); white-space: pre-wrap; word-break: break-word; }

/* Settings */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 1.5rem; }
.card h3 { font-size: 1.1rem; margin-bottom: .35rem; }
.card p { margin: 0 0 1rem; }

/* Modals */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 1rem; z-index: 100; overflow-y: auto; }
.modal-box { width: 100%; max-width: 640px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 10px; }
.modal-sm { max-width: 420px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 1.1rem 1.5rem; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 1.25rem; }
.modal-body { padding: 1.25rem 1.5rem; }
.modal-body p { margin: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: .5rem; padding: 1rem 1.5rem; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* Live preview (mirrors the public cards) */
.preview { margin-top: .5rem; }
.preview-label { font: 500 11px "IBM Plex Mono", monospace; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); margin-bottom: .5rem; }
.pv-card { background: #131313; border: 1px solid rgba(255,255,255,.08); padding: 1.75rem; max-width: 360px; }
.pv-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.25rem; }
.pv-cat { font: 400 10px "IBM Plex Mono", monospace; letter-spacing: .2em; text-transform: uppercase; border: 1px solid rgba(255,255,255,.2); padding: .2rem .5rem; color: rgba(255,255,255,.7); }
.pv-title { font: 700 22px/1.3 "Space Grotesk", sans-serif; margin: 0 0 .75rem; }
.pv-desc { color: #bac9cc; font-size: 14px; margin: 0 0 1.5rem; }
.pv-btn { display: block; text-align: center; border: 1px solid rgba(255,255,255,.1); padding: .7rem; font: 700 12px Inter, sans-serif; letter-spacing: .15em; text-transform: uppercase; }
.pv-eyebrow { font: 400 10px "IBM Plex Mono", monospace; letter-spacing: .2em; text-transform: uppercase; color: #9cf0ff; margin-bottom: .75rem; }
.pv-foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid rgba(255,255,255,.1); margin-top: 1.5rem; padding-top: 1rem; font: 400 10px "IBM Plex Mono", monospace; letter-spacing: .2em; text-transform: uppercase; color: rgba(255,255,255,.7); }
.pv-foot .material-symbols-outlined { color: #9cf0ff; font-size: 24px; }

/* Toasts */
.toasts { position: fixed; right: 1.25rem; bottom: 1.25rem; display: flex; flex-direction: column; gap: .5rem; z-index: 200; }
.toast { display: flex; align-items: center; gap: .5rem; padding: .75rem 1rem; border-radius: 6px; font-size: 14px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.4); animation: toast-in .2s ease; max-width: 360px; }
.toast.success { background: var(--cyan); color: var(--cyan-ink); }
.toast.error { background: var(--danger-bg); color: #ffdad6; border: 1px solid var(--danger); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

@media (max-width: 640px) {
  .topbar, .tabs, .content { padding-left: 1rem; padding-right: 1rem; }
  .row { grid-template-columns: auto 1fr; }
  .row-actions { grid-column: 1 / -1; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: .5rem; }
  .field-row { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; }
  .dl dt { border-bottom: 0; padding-bottom: 0; }
}
