:root {
  color-scheme: dark;
  --bg: #0d1117;
  --panel: #151b23;
  --panel-2: #1d2630;
  --field: #0f151c;
  --line: #2a3542;
  --text: #edf3f8;
  --muted: #98a6b5;
  --accent: #2f80ed;
  --accent-2: #66a6ff;
  --ok: #41d196;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.topbar,
.section-head,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.paste-panel,
.form-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .18);
}

.paste-panel {
  position: sticky;
  top: 16px;
  padding: 16px;
}

.form-panel {
  padding: 16px;
}

textarea {
  width: 100%;
  min-height: 360px;
  margin-top: 14px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--text);
  padding: 14px;
  outline: none;
  line-height: 1.45;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 128, 237, .16);
}

.control-grid,
.field-grid {
  display: grid;
  gap: 12px;
}

.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.phone-toggle {
  grid-column: 1 / -1;
}

.inline-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  color: var(--text);
}

.inline-check input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.inline-check-label {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 6px;
}

label span {
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--text);
  padding: 8px 10px;
  outline: none;
}

input[readonly] {
  color: var(--muted);
}

.settings {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

summary {
  cursor: pointer;
  color: var(--accent-2);
  font-weight: 700;
}

.settings-grid {
  margin-top: 14px;
}

.settings-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.actions {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  padding: 0 14px;
  font-weight: 700;
}

.primary {
  background: var(--accent);
  color: #fff;
}

.secondary {
  background: var(--panel-2);
}

.ghost {
  border: 1px solid var(--line);
  background: transparent;
}

button:hover {
  filter: brightness(1.12);
}

[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .paste-panel {
    position: static;
  }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.app-switch {
  display: flex;
  gap: 6px;
  padding: 4px;
  margin-bottom: 18px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.app-switch-item {
  flex: 1 1 0;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--muted);
  text-align: center;
  transition: background 0.15s, color 0.15s;
}

.app-switch-item:hover {
  color: var(--text);
  background: var(--panel-2);
}

.app-switch-item.is-active {
  background: rgba(47, 128, 237, 0.15);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(47, 128, 237, 0.4);
}

.app-switch-title {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.25;
}

.app-switch-desc {
  display: block;
  font-size: 0.68rem;
  opacity: 0.9;
}

.login-page .app-switch {
  margin-bottom: 14px;
}

@media (max-width: 560px) {
  .app-switch-desc {
    display: none;
  }
}

.logout-form {
  margin: 0;
}

.user-badge {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 30% 15%, #1a2d4a 0%, var(--bg) 55%);
}

.login-wrap {
  width: min(400px, calc(100% - 32px));
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 24px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

.login-brand {
  text-align: center;
  margin-bottom: 24px;
}

.login-brand h1 {
  margin: 6px 0 0;
  font-size: 1.5rem;
}

.login-form label {
  display: block;
  margin-bottom: 14px;
}

.login-form label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.login-form input[type="text"],
.login-form input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--text);
}

.login-form .remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.login-form .remember span {
  margin: 0;
  color: var(--text);
}

.login-btn {
  width: 100%;
}

.flash-messages {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
}

.flash-error {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(220, 80, 80, 0.15);
  color: #f5a5a5;
  font-size: 0.9rem;
}

.flash-ok {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(65, 209, 150, 0.12);
  color: var(--ok);
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding: 14px 0;
  }

  .topbar,
  .section-head,
  .settings-actions,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .compact,
  .field-grid {
    grid-template-columns: 1fr;
  }

  textarea {
    min-height: 260px;
  }
}

/* Premium operations workspace layer */
:root {
  --bg: #091119;
  --panel: #111c27;
  --panel-2: #192735;
  --field: #0c151e;
  --line: #293b4c;
  --line-strong: #3b5267;
  --text: #f1f5f8;
  --muted: #9aaab8;
  --accent: #5ba7f7;
  --accent-2: #a8d3ff;
  --ok: #55d6a0;
}

html {
  background: var(--bg);
}

body {
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(91, 167, 247, .28);
  color: var(--text);
}

.shell {
  width: min(1240px, calc(100% - 48px));
  padding: 30px 0 56px;
}

.topbar {
  align-items: flex-end;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 20px;
}

.topbar h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.15;
}

.eyebrow {
  color: var(--accent-2);
  font-size: 11px;
  letter-spacing: .14em;
}

.topbar-actions {
  gap: 8px;
}

.app-switch {
  gap: 3px;
  margin: 0 0 22px;
  padding: 4px;
  border-color: var(--line);
  border-radius: 8px;
  background: #0d1721;
}

.app-switch-item {
  min-height: 48px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 8px 14px;
  border-radius: 6px;
  text-align: left;
}

.app-switch-item:hover {
  background: var(--panel-2);
}

.app-switch-item.is-active {
  background: var(--accent-soft, rgba(91, 167, 247, .14));
  box-shadow: inset 0 -2px 0 var(--accent);
}

.app-switch-title {
  font-size: 13px;
  font-weight: 700;
}

.app-switch-desc {
  color: var(--muted);
  font-size: 11px;
}

.workspace {
  gap: 20px;
}

.paste-panel,
.form-panel {
  border-color: var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .22), 0 1px 0 rgba(255, 255, 255, .025) inset;
}

.paste-panel {
  top: 20px;
  padding: 20px;
}

.form-panel {
  padding: 22px;
}

.section-head {
  gap: 20px;
}

.section-head h2 {
  font-size: 19px;
  letter-spacing: 0;
}

textarea,
input,
select {
  border-color: var(--line);
  border-radius: 6px;
  background: var(--field);
  color: var(--text);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

textarea {
  min-height: 390px;
  margin-top: 18px;
  padding: 16px;
  font-size: 14px;
}

input,
select {
  min-height: 44px;
  padding: 9px 12px;
  font-size: 15px;
}

textarea:hover,
input:hover,
select:hover {
  border-color: var(--line-strong);
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent);
  background: #0e1923;
  box-shadow: 0 0 0 3px rgba(91, 167, 247, .14);
}

label {
  gap: 7px;
}

label span {
  color: #b3c0ca;
  font-size: 12px;
  font-weight: 600;
}

.field-grid,
.control-grid {
  gap: 14px;
}

.compact {
  margin-bottom: 20px;
}

.settings {
  margin-top: 22px;
  padding-top: 18px;
  border-color: var(--line);
}

summary {
  color: var(--accent-2);
  font-size: 13px;
}

summary::marker {
  color: var(--accent);
}

.actions {
  margin-top: 22px;
  padding-top: 18px;
  border-color: var(--line);
}

.hint {
  color: var(--muted);
  font-size: 12px;
}

button {
  min-height: 44px;
  border-radius: 6px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 700;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

button:hover {
  filter: none;
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.primary {
  background: var(--accent);
  box-shadow: 0 8px 18px rgba(91, 167, 247, .18);
  color: #07111a;
}

.primary:hover {
  background: #78baff;
  box-shadow: 0 10px 22px rgba(91, 167, 247, .25);
}

.secondary {
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
}

.secondary:hover {
  border-color: var(--accent);
  background: #203346;
}

.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}

.ghost:hover {
  border-color: var(--line-strong);
  background: var(--panel-2);
  color: var(--text);
}

.user-badge {
  border-color: var(--line);
  border-radius: 6px;
  background: var(--field);
  padding: 7px 10px;
  font-size: 12px;
}

.login-page {
  background: var(--bg);
}

.login-wrap {
  width: min(440px, calc(100% - 32px));
}

.login-card {
  border-color: var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .3), 0 1px 0 rgba(255, 255, 255, .03) inset;
  padding: 32px;
}

.login-brand {
  margin-bottom: 28px;
  text-align: left;
}

.login-brand h1 {
  font-size: 26px;
  letter-spacing: 0;
}

.login-form label {
  margin-bottom: 16px;
}

.login-form input[type="text"],
.login-form input[type="password"] {
  min-height: 46px;
  border-radius: 6px;
  padding: 10px 12px;
}

.login-form .remember {
  align-items: center;
  margin: 4px 0 22px;
}

.login-btn {
  min-height: 46px;
}

.flash-error,
.flash-ok {
  border: 1px solid var(--line);
  border-radius: 6px;
}

@media (max-width: 900px) {
  .shell {
    width: min(100% - 32px, 760px);
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 24px, 600px);
    padding: 18px 0 32px;
  }

  .topbar {
    align-items: flex-start;
    gap: 18px;
  }

  .topbar h1 {
    font-size: 26px;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions .ghost,
  .topbar-actions .logout-form,
  .topbar-actions .user-badge {
    flex: 1 1 auto;
  }

  .app-switch-item {
    padding: 8px 10px;
  }

  .app-switch-title {
    font-size: 12px;
  }

  .paste-panel,
  .form-panel {
    padding: 16px;
  }

  textarea {
    min-height: 280px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }
}

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

/* Focused authentication surface */
.login-page {
  min-height: 100svh;
  padding: 32px 20px;
  align-items: center;
}

.login-shell {
  width: min(480px, 100%);
}

.login-card {
  margin: 0;
  padding: 36px;
  border-color: var(--line-strong);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .34), 0 1px 0 rgba(255, 255, 255, .035) inset;
}

.login-brand {
  margin: 0 0 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.login-brand h1 {
  font-size: 30px;
  line-height: 1.15;
}

.login-form {
  display: grid;
  gap: 18px;
}

.login-form label,
.login-form .remember {
  margin: 0;
}

.login-form .remember {
  width: fit-content;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.login-form .remember input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  flex: 0 0 18px;
}

.login-form .remember span {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.login-btn {
  margin-top: 2px;
}

.login-page .app-switch {
  margin: 30px 0 0;
  padding: 20px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.login-page .app-switch-item {
  min-height: 40px;
  padding: 8px 6px;
  border: 1px solid transparent;
  text-align: center;
}

.login-page .app-switch-item:hover {
  border-color: var(--line);
  background: var(--field);
}

.login-page .app-switch-item.is-active {
  border-color: var(--line-strong);
  background: var(--field);
  box-shadow: none;
}

.login-page .app-switch-title {
  font-size: 11px;
}

.login-page .app-switch-desc {
  display: none;
}

@media (max-width: 520px) {
  .login-page {
    align-items: flex-start;
    padding: 20px 14px;
  }

  .login-shell {
    margin-top: 24px;
  }

  .login-card {
    padding: 24px;
  }

  .login-brand {
    margin-bottom: 24px;
    padding-bottom: 20px;
  }

  .login-brand h1 {
    font-size: 28px;
  }
}
