/* ArQave interface stylesheet */

@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600&family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;1,6..72,400&display=swap");

:root {
  --bg: #0b0d11;
  --surface: #101319;
  --surface-2: #161a22;
  --border: #242a35;
  --border-strong: #313949;
  --text: #ebe7df;
  --text-2: #bdb8ae;
  --muted: #858b97;
  --accent: #d9a85f;
  --accent-hover: #f0c989;
  --accent-soft: rgba(217, 168, 95, 0.12);
  --danger: #e0645a;
  --success: #7fc29b;
  --info: #8aa4e8;

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --radius: 3px;
  --sidebar: 256px;
  --topbar: 60px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh;
  background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }
::selection { background: var(--accent); color: #111; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; line-height: 1.2; color: var(--text); }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.015em; }
h1 { font-size: clamp(2rem, 3.6vw, 2.8rem); }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.02rem; font-weight: 600; }
p { margin: 0 0 12px; }
small, .small { font-size: 0.86rem; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 0.88em; }
.serif { font-family: var(--serif); }
.label { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
code { font-family: var(--mono); font-size: 0.86em; background: var(--surface-2); border: 1px solid var(--border); padding: 0 5px; border-radius: 2px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hide { display: none !important; }

/* ---------------- Public layout ---------------- */
.container { width: min(1200px, 100% - 40px); margin-inline: auto; }
@media (max-width: 600px) { .container { width: calc(100% - 32px); } }

.pub-header { position: sticky; top: 0; z-index: 40; border-bottom: 1px solid var(--border); background: rgba(11, 13, 17, 0.9); backdrop-filter: blur(10px); }
.pub-header .container { display: flex; align-items: center; gap: 32px; height: 66px; }
.pub-header .logo img { height: 46px; width: auto; }
.pub-nav { display: flex; align-self: stretch; gap: 4px; flex: 1; }
.pub-nav a { display: flex; align-items: center; padding: 0 12px; color: var(--muted); font-size: 0.93rem; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s, border-color .15s; }
.pub-nav a:hover { color: var(--text); }
.pub-nav a.current { color: var(--text); border-bottom-color: var(--accent); }
.pub-actions { display: flex; gap: 8px; align-items: center; }
@media (max-width: 800px) { .pub-nav { display: none; } }

.pub-footer { border-top: 1px solid var(--border); margin-top: 72px; padding: 36px 0; color: var(--muted); font-size: 0.88rem; }
.pub-footer .container { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.pub-footer .dev { display: flex; align-items: center; gap: 16px; color: var(--text-2); }
.pub-footer .dev img { height: 60px; width: auto; }
.pub-footer .dev strong { display: block; color: var(--text); font-weight: 500; }
.pub-footer nav { display: flex; gap: 22px; flex-wrap: wrap; }
.pub-footer nav a { color: var(--text-2); }
.pub-footer nav a:hover { color: var(--accent); }

/* ---------------- Application layout ---------------- */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.sidebar .logo { display: block; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.sidebar .logo img { height: 46px; width: auto; }
.side-nav { padding: 16px 12px; flex: 1; }
.side-group { margin-bottom: 20px; }
.side-group h4 { font-family: var(--mono); font-size: 0.7rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 0 10px 8px; }
.side-nav a {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--radius);
  color: var(--text-2); font-size: 0.93rem; transition: background .12s, color .12s;
}
.side-nav a svg { flex-shrink: 0; color: var(--muted); transition: color .12s; }
.side-nav a:hover { background: var(--surface-2); color: var(--text); }
.side-nav a:hover svg { color: var(--text-2); }
.side-nav a.current { background: var(--accent-soft); color: var(--text); }
.side-nav a.current::before { content: ""; position: absolute; left: -12px; top: 6px; bottom: 6px; width: 3px; background: var(--accent); }
.side-nav a.current svg { color: var(--accent); }
.side-user { border-top: 1px solid var(--border); padding: 14px 20px; font-size: 0.88rem; display: grid; grid-template-columns: 34px 1fr; gap: 0 10px; align-items: center; }
.side-user .initials { grid-row: span 2; width: 34px; height: 34px; display: grid; place-items: center; background: var(--accent); color: #17120a; font-family: var(--mono); font-size: 0.8rem; font-weight: 500; border-radius: 2px; }
.side-user .name { color: var(--text); font-weight: 500; line-height: 1.3; }
.side-user .email { color: var(--muted); font-size: 0.78rem; word-break: break-all; line-height: 1.3; }
.side-user .links { grid-column: 1 / -1; display: flex; gap: 14px; margin-top: 10px; }
.side-user .links a { color: var(--text-2); font-size: 0.85rem; }
.side-user .links a:hover { color: var(--accent); }
.side-dev { padding: 14px 20px 18px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.8rem; line-height: 1.35; }
.side-dev img { height: 40px; width: auto; opacity: .92; }
.side-dev:hover { color: var(--text-2); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar); display: flex; align-items: center; gap: 16px; padding: 0 36px;
  border-bottom: 1px solid var(--border); background: rgba(11, 13, 17, 0.92); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.crumbs { font-family: var(--mono); font-size: 0.78rem; letter-spacing: .03em; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.crumbs span { margin: 0 8px; }
.menu-btn { display: none; background: none; border: 1px solid var(--border); color: var(--text); border-radius: var(--radius); width: 38px; height: 36px; cursor: pointer; }
.content { padding: 36px 36px 64px; width: 100%; max-width: 1280px; animation: rise .35s ease both; }
.page-title { margin-bottom: 8px; }
.page-intro { color: var(--text-2); max-width: 72ch; margin-bottom: 28px; font-size: 1rem; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; width: 280px; left: 0; transform: translateX(-100%); transition: transform .22s; }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.6); }
  .menu-btn { display: grid; place-items: center; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------------- Components ---------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; }
.card-head h2, .card-head h3 { font-family: var(--font); font-size: 0.98rem; font-weight: 600; letter-spacing: 0; }
.card-body { padding: 20px; }
.card + .card { margin-top: 20px; }
.methods > .card, .grid-2 > .card { margin-top: 0; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 390px) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 1050px) { .grid-2 { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius);
  font: inherit; font-size: 0.92rem; font-weight: 500; white-space: nowrap; cursor: pointer;
  border: 1px solid var(--border-strong); background: transparent; color: var(--text);
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.btn:hover { border-color: var(--muted); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #17120a; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #17120a; }
.btn-ghost { background: transparent; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 0.85rem; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn .arrow { transition: transform .15s; }
.btn:hover .arrow { transform: translateX(3px); }

.form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label, .field .lbl { font-family: var(--mono); font-size: 0.72rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.field .hint { font-size: 0.83rem; color: var(--muted); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .row-2 { grid-template-columns: 1fr; } }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--radius);
  background: var(--bg); color: var(--text); border: 1px solid var(--border-strong);
  font: inherit; font-size: 0.93rem; outline: none; transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: #5b616d; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select {
  appearance: none; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23858b97' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.check { display: flex; align-items: center; gap: 10px; font-size: 0.93rem; color: var(--text-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.range-row { display: grid; grid-template-columns: 1fr 52px; gap: 12px; align-items: center; }
input[type=range] { width: 100%; accent-color: var(--accent); cursor: pointer; }
.range-val { font-family: var(--mono); font-size: 0.88rem; text-align: center; color: var(--accent); border: 1px solid var(--border-strong); border-radius: 2px; padding: 3px 0; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.seg button { background: transparent; color: var(--muted); border: 0; border-right: 1px solid var(--border-strong); padding: 0 14px; height: 36px; font: inherit; font-size: 0.88rem; cursor: pointer; transition: background .12s, color .12s; }
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-hover); }

.dropzone {
  position: relative; border: 1px dashed var(--border-strong); border-radius: var(--radius);
  padding: 26px 16px; text-align: center; cursor: pointer;
  background: linear-gradient(var(--border) 1px, transparent 1px) 0 0 / 22px 22px, linear-gradient(90deg, var(--border) 1px, transparent 1px) 0 0 / 22px 22px, var(--bg);
  background-blend-mode: normal; transition: border-color .15s, background-color .15s;
}
.dropzone::before { content: ""; position: absolute; inset: 0; background: rgba(11,13,17,.82); pointer-events: none; transition: background .15s; }
.dropzone > * { position: relative; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); }
.dropzone:hover::before, .dropzone.over::before { background: rgba(11,13,17,.7); }
.dropzone input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2; }
.dropzone .dz-title { font-weight: 500; }
.dropzone .dz-title::before { content: "↑"; display: block; font-size: 1.3rem; color: var(--accent); margin-bottom: 2px; }
.dropzone .dz-sub { font-size: 0.84rem; color: var(--muted); }
.dropzone .dz-file { margin-top: 8px; font-family: var(--mono); font-size: 0.82rem; color: var(--accent-hover); word-break: break-all; }

.alert { padding: 11px 14px; border-radius: var(--radius); border: 1px solid var(--border); border-left-width: 3px; background: var(--surface-2); font-size: 0.9rem; animation: rise .2s ease; }
.alert.info { border-left-color: var(--info); }
.alert.error { border-left-color: var(--danger); }
.alert.success { border-left-color: var(--success); }
.alert.warn { border-left-color: var(--accent); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { background: var(--surface-2); font-family: var(--mono); font-size: 0.72rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-family: var(--mono); font-size: 0.85rem; }
.table th.num { color: var(--accent); }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover td { background: rgba(255,255,255,.02); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.stat { padding: 14px 16px; border-right: 1px solid var(--border); }
.stat:last-child { border-right: 0; }
.stat .k { font-family: var(--mono); font-size: 0.7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stat .v { font-family: var(--serif); font-size: 1.7rem; line-height: 1.2; margin-top: 4px; }

.figure { border: 1px solid var(--border); border-radius: var(--radius); background: #fff; padding: 10px; cursor: zoom-in; transition: box-shadow .2s; }
.figure:hover { box-shadow: 0 0 0 3px var(--accent-soft); }
.figure img { margin: 0 auto; }
.figcap { font-size: 0.84rem; color: var(--muted); margin-top: 8px; }
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.86); display: grid; place-items: center; padding: 24px; cursor: zoom-out; animation: fade .15s ease; }
.lightbox img { max-width: 96vw; max-height: 92vh; background: #fff; padding: 12px; border-radius: 2px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.progress { height: 3px; background: var(--surface-2); overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .4s; }
.progress.indeterminate > div { width: 30%; animation: slide 1.1s infinite ease-in-out; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }

.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 8px 0; font-size: 0.92rem; color: var(--muted); align-items: center; }
.steps li .n { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border-strong); display: grid; place-items: center; font-family: var(--mono); font-size: 0.74rem; }
.steps li.done { color: var(--text-2); }
.steps li.done .n { background: var(--success); border-color: var(--success); color: #0b0d11; }
.steps li.active { color: var(--text); }
.steps li.active .n { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.empty::before { content: ""; display: block; width: 56px; height: 48px; margin: 0 auto 14px; opacity: .6;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 56 48' fill='none' stroke='%23858b97' stroke-width='1.2'%3E%3Cpath d='M28 3 53 45H3z'/%3E%3Cpath d='M15.5 24h25M9.3 34.5h37.4M22 13.5h12' stroke-dasharray='2 3'/%3E%3Ccircle cx='27' cy='30' r='2' fill='%23d9a85f' stroke='none'/%3E%3Ccircle cx='33' cy='26' r='2' fill='%23d9a85f' stroke='none'/%3E%3Ccircle cx='22' cy='36' r='2' fill='%238aa4e8' stroke='none'/%3E%3C/svg%3E") center / contain no-repeat; }
.results-in { animation: rise .3s ease both; }

/* Auth pages */
.auth-wrap { min-height: calc(100vh - 66px - 140px); display: grid; place-items: center; padding: 48px 0; }
.auth-card { width: min(460px, 100%); }
.auth-card .card-body { padding: 32px; }
.auth-card h1 { font-size: 2.1rem; margin-bottom: 6px; }
.oauth { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.82rem; margin: 20px 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

/* Document pages */
.doc { max-width: 760px; }
.doc h1 { margin-bottom: 4px; }
.doc h2 { font-size: 1.35rem; margin: 32px 0 8px; }
.doc p, .doc li { color: var(--text-2); }
.doc ul { padding-left: 20px; }

/* Toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { min-width: 260px; max-width: 380px; padding: 11px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border-strong); border-left: 3px solid var(--info); font-size: 0.9rem; animation: rise .2s ease; }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }

/* Drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%); z-index: 61; background: var(--surface); border-left: 1px solid var(--border-strong); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .25s cubic-bezier(.2,.8,.2,1); }
.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
.drawer-open .drawer { transform: none; }
.drawer-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.drawer-body { flex: 1; overflow: auto; padding: 22px; }
.drawer-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; background: none; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-2); cursor: pointer; }
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
#out:not(.hide), #work:not(.hide) { animation: rise .3s ease both; }
.gtable td:first-child { white-space: nowrap; }

/* Public header user menu */
.umenu { position: relative; }
.umenu-btn { display: inline-flex; align-items: center; gap: 9px; height: 38px; padding: 0 10px 0 4px; background: transparent; border: 1px solid var(--border-strong); border-radius: 999px; color: var(--text-2); font: inherit; font-size: .9rem; cursor: pointer; transition: border-color .15s, color .15s; }
.umenu-btn:hover, .umenu.open .umenu-btn { border-color: var(--accent); color: var(--text); }
.umenu-btn .initials { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #17120a; font-size: .75rem; font-weight: 600; }
.umenu-btn svg { transition: transform .15s; }
.umenu.open .umenu-btn svg { transform: rotate(180deg); }
.umenu-pop { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0,0,0,.45); padding: 6px; display: none; z-index: 60; }
.umenu.open .umenu-pop { display: block; animation: rise .15s ease; }
.umenu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; display: flex; flex-direction: column; gap: 2px; }
.umenu-head strong { font-weight: 500; color: var(--text); }
.umenu-head span { font-family: var(--mono); font-size: .75rem; color: var(--muted); }
.umenu-pop a { display: block; padding: 9px 12px; border-radius: 2px; color: var(--text-2); font-size: .9rem; }
.umenu-pop a:hover { background: var(--surface-2); color: var(--text); }
.umenu-pop a.out { border-top: 1px solid var(--border); margin-top: 6px; border-radius: 0; color: var(--danger); }
@media (max-width: 720px) { .umenu-name { display: none; } }

/* Keep browser autofill in the dark theme */
.input:autofill, .input:-webkit-autofill { box-shadow: inset 0 0 0 100px var(--surface-2); -webkit-text-fill-color: var(--text); caret-color: var(--text); }
