:root {
  color-scheme: dark;
  --bg: #080912;
  --panel: rgba(18, 20, 36, .9);
  --panel-solid: #121424;
  --panel-raised: #181b32;
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(123, 141, 255, .28);
  --text: #f5f6ff;
  --muted: #969bb7;
  --green: #7b8dff;
  --green-strong: #6075ff;
  --green-dim: rgba(123, 141, 255, .12);
  --danger: #ff6e7e;
  --danger-dim: rgba(255, 110, 126, .1);
  --shadow: 0 28px 70px rgba(0, 0, 0, .36);
  --radius: 22px;
  font-family: Tahoma, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    var(--bg);
  background-size: 42px 42px;
  color: var(--text);
}

button, input { font: inherit; }
button { color: inherit; }

.hidden { display: none !important; }
.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;
}

.ambient {
  position: fixed; z-index: -1; width: 420px; height: 420px; border-radius: 50%;
  filter: blur(120px); opacity: .13; pointer-events: none;
}
.ambient-one { top: -180px; right: -80px; background: var(--green); }
.ambient-two { bottom: -220px; left: -120px; background: #bc5cff; opacity: .09; }

.topbar {
  height: 78px; padding: 0 clamp(20px, 5vw, 76px); display: flex; align-items: center;
  justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(8,9,18,.82);
  backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 30;
}

.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; direction: ltr; }
.brand-mark {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px;
  color: #090b1b; font-size: 22px; font-weight: 900; background: var(--green);
  box-shadow: 0 0 28px rgba(123,141,255,.28); transform: skew(-7deg);
}
.brand span:last-child { display: flex; flex-direction: column; line-height: 1; }
.brand strong { font-size: 17px; letter-spacing: .03em; }
.brand small { margin-top: 5px; color: var(--muted); font-size: 9px; letter-spacing: .19em; }

.connection-state { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px var(--green); }

.page-shell { min-height: calc(100vh - 78px); }
.auth-layout {
  min-height: calc(100vh - 78px); width: 100%; margin: 0 auto; padding: 64px 20px;
  display: grid; place-items: center;
}

.eyebrow { color: var(--green); font: 700 11px/1.4 "Segoe UI", sans-serif; letter-spacing: .22em; direction: ltr; display: inline-block; }

.auth-card {
  position: relative; width: min(100%, 460px); padding: 34px; border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(25,28,51,.96), rgba(12,13,26,.96)); box-shadow: var(--shadow);
}
.auth-card::before { content: ""; position: absolute; inset: 0 28px auto; height: 1px; background: linear-gradient(90deg, transparent, var(--green), transparent); opacity: .55; }
.card-heading { margin-bottom: 28px; }
.step-kicker { color: var(--green); font-size: 12px; }
.card-heading h2 { margin: 9px 0 8px; font-size: 26px; }
.card-heading p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.8; }

.auth-form, .inquiry-form { display: grid; gap: 15px; }
label { color: #c9d2ce; font-size: 13px; font-weight: 600; }
.input-wrap { position: relative; }
.input-wrap input { padding-left: 46px; }
.input-icon { position: absolute; left: 17px; top: 50%; transform: translateY(-50%); color: var(--muted); direction: ltr; }
input {
  width: 100%; border: 1px solid var(--line); border-radius: 13px; outline: none;
  background: rgba(7,8,18,.76); color: var(--text); padding: 14px 15px; transition: .2s ease;
}
input:hover { border-color: rgba(255,255,255,.16); }
input:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(123,141,255,.1); }
.otp-input { direction: ltr; text-align: center; font-size: 23px; font-weight: 700; letter-spacing: .35em; }
.field-help { margin: -5px 0 3px; color: var(--muted); font-size: 12px; }

.primary-button, .secondary-button, .text-button, .logout-button, .nav-item, .icon-button, .mini-button, .service-card {
  border: 0; cursor: pointer;
}
.primary-button {
  min-height: 51px; border-radius: 13px; display: flex; align-items: center; justify-content: center; gap: 12px;
  background: var(--green); color: #090b1b; font-weight: 800; transition: transform .18s ease, background .18s ease, opacity .18s ease;
}
.primary-button:hover { background: #96a4ff; transform: translateY(-1px); }
.primary-button:disabled { cursor: wait; opacity: .55; transform: none; }
.primary-button.compact { min-height: 45px; padding: 0 24px; }
.text-button { background: transparent; color: var(--muted); padding: 5px; font-size: 12px; }
.text-button:hover { color: var(--text); }
.security-note { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 23px; color: #77827d; font-size: 11px; line-height: 1.7; }
.security-note span { color: var(--green); margin-left: 7px; }

.message { padding: 12px 14px; margin-top: 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--green-dim); color: #ccd2ff; font-size: 13px; line-height: 1.7; }
.message.error { border-color: rgba(255,110,126,.27); background: var(--danger-dim); color: #ffc0c7; }

.question-fields, .inquiry-fields { display: grid; gap: 14px; }
.field-group { display: grid; gap: 8px; }

.dashboard { min-height: calc(100vh - 78px); display: grid; grid-template-columns: 250px minmax(0,1fr); direction: rtl; }
.sidebar {
  position: sticky; top: 78px; height: calc(100vh - 78px); padding: 30px 20px 22px;
  border-left: 1px solid var(--line); background: rgba(12,13,27,.72); display: flex; flex-direction: column;
}
.sidebar-label { margin: 0 4px 12px; color: #69746f; font-size: 11px; }
.user-card { display: flex; align-items: center; gap: 11px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.025); }
.user-avatar { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 12px; background: var(--green-dim); color: var(--green); font-weight: 800; }
.user-card > span:last-child { min-width: 0; display: grid; gap: 5px; }
.user-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.user-card small { color: var(--green); font-size: 10px; }
.side-nav { margin-top: 28px; }
.nav-item { width: 100%; padding: 13px 14px; border-radius: 12px; text-align: right; background: transparent; color: var(--muted); }
.nav-item span { color: var(--green); margin-left: 8px; }
.nav-item.active { background: var(--green-dim); color: #e4e7ff; }
.logout-button { margin-top: auto; display: flex; justify-content: space-between; padding: 13px 14px; border-radius: 12px; background: transparent; color: #8f9994; }
.logout-button:hover { color: var(--danger); background: var(--danger-dim); }

.workspace { padding: 46px clamp(24px,4vw,62px) 70px; min-width: 0; }
.workspace-header { display: flex; justify-content: space-between; align-items: end; gap: 28px; margin-bottom: 34px; }
.workspace-header h2 { margin: 8px 0 7px; font-size: 34px; }
.workspace-header p { margin: 0; color: var(--muted); font-size: 13px; }
.search-box { position: relative; width: min(280px,100%); }
.search-box span { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 21px; }
.search-box input { padding-right: 45px; background: rgba(255,255,255,.025); }

.service-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 15px; }
.service-card {
  min-height: 154px; padding: 20px; border: 1px solid var(--line); border-radius: 17px; text-align: right;
  background: linear-gradient(145deg, rgba(25,28,51,.78), rgba(12,14,27,.78)); transition: .2s ease; position: relative; overflow: hidden;
}
.service-card::after { content: ""; position: absolute; inset: auto -30px -65px auto; width: 120px; height: 120px; border-radius: 50%; background: var(--green); filter: blur(70px); opacity: 0; transition: .2s; }
.service-card:hover { transform: translateY(-3px); border-color: rgba(123,141,255,.38); box-shadow: 0 18px 40px rgba(0,0,0,.2); }
.service-card:hover::after { opacity: .12; }
.service-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--green-dim); color: var(--green); font: 800 15px/1 "Segoe UI", sans-serif; direction: ltr; }
.service-card h3 { margin: 17px 0 7px; font-size: 15px; }
.service-card p { margin: 0; color: var(--muted); font-size: 11px; }
.service-arrow { position: absolute; left: 18px; top: 21px; color: #64706a; direction: ltr; }
.empty-state { grid-column: 1/-1; padding: 70px 20px; border: 1px dashed var(--line); border-radius: var(--radius); text-align: center; color: var(--muted); }

.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 22px; }
.modal-backdrop { position: absolute; inset: 0; border: 0; background: rgba(1,3,4,.76); backdrop-filter: blur(8px); cursor: default; }
.modal-panel { width: min(660px,100%); max-height: calc(100vh - 44px); overflow-y: auto; position: relative; border: 1px solid var(--line); border-radius: 22px; background: #101222; box-shadow: var(--shadow); }
.modal-header { padding: 25px 27px 20px; display: flex; justify-content: space-between; align-items: start; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 7px 0 0; font-size: 23px; }
.icon-button { width: 38px; height: 38px; border-radius: 11px; background: rgba(255,255,255,.05); color: #aab4af; font-size: 23px; }
.icon-button:hover { background: var(--danger-dim); color: var(--danger); }
.inquiry-form { padding: 24px 27px 27px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 7px; }
.secondary-button { min-height: 45px; padding: 0 22px; border-radius: 12px; background: rgba(255,255,255,.05); color: #b1bbb6; }
.secondary-button:hover { background: rgba(255,255,255,.08); }
.result-panel { margin: 0 27px 27px; border: 1px solid var(--line-strong); border-radius: 16px; background: #090a16; overflow: hidden; }
.result-heading { padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.result-heading > div:first-child { display: flex; align-items: center; gap: 10px; }
.result-heading span span { display: grid; gap: 4px; }
.result-heading strong { font-size: 13px; }
.result-heading small { color: var(--muted); font-size: 10px; }
.result-check { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 9px; color: var(--green); background: var(--green-dim); }
.result-actions { display: flex; gap: 7px; }
.mini-button { padding: 7px 10px; border-radius: 8px; background: rgba(255,255,255,.055); color: #aeb8b3; font-size: 10px; }
.mini-button:hover { color: var(--green); }
#resultOutput { direction: ltr; text-align: left; unicode-bidi: plaintext; margin: 0; padding: 18px; max-height: 380px; overflow: auto; color: #d7dbff; font: 12px/1.85 Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.modal-panel > .message { margin: 0 27px 27px; }

noscript { position: fixed; inset: auto 20px 20px; padding: 12px 18px; border-radius: 10px; background: var(--danger); color: #190307; }

@media (max-width: 980px) {
  .service-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 760px) {
  .topbar { height: 67px; padding: 0 18px; }
  .brand-mark { width: 37px; height: 37px; }
  .connection-state span:last-child { display: none; }
  .page-shell { min-height: calc(100vh - 67px); }
  .auth-layout { min-height: calc(100vh - 67px); padding: 44px 18px; }
  .auth-card { padding: 26px 21px; }
  .dashboard { display: block; }
  .sidebar { position: static; height: auto; padding: 16px 18px; border: 0; border-bottom: 1px solid var(--line); flex-direction: row; align-items: center; gap: 12px; }
  .sidebar-label, .side-nav { display: none; }
  .user-card { flex: 1; padding: 8px; border: 0; background: transparent; }
  .logout-button { margin: 0; }
  .logout-button span:first-child { display: none; }
  .workspace { padding: 32px 18px 55px; }
  .workspace-header { display: grid; align-items: initial; }
  .search-box { width: 100%; }
}

@media (max-width: 520px) {
  .service-grid { grid-template-columns: 1fr; }
  .service-card { min-height: 132px; }
  .modal { padding: 0; align-items: end; }
  .modal-panel { width: 100%; max-height: 92vh; border-radius: 22px 22px 0 0; }
  .modal-header, .inquiry-form { padding-inline: 20px; }
  .result-panel, .modal-panel > .message { margin-inline: 20px; }
  .result-heading { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
