/* ==========================================================================
   Operator console — admin.drscribe.co
   Loaded after the Tailwind runtime. Adds the few things utilities cannot
   express (self-hosted type, elevation on the shell, the sign-in screen) and
   leaves the application markup and its 81 element ids untouched.
   ========================================================================== */

@font-face {
  font-family: "Figtree";
  src: url("/shared-assets/fonts/figtree-latin.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans";
  src: url("/shared-assets/fonts/noto-sans-latin.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --c-canvas: #fbfcfa;
  --c-surface: #ffffff;
  --c-surface-2: #f4f7f5;
  --c-line: #e4ebe8;
  --c-line-2: #eef3f1;
  --c-line-strong: #cfdcd8;
  --c-ink: #10201e;
  --c-ink-2: #3a5450;
  --c-ink-3: #5f7772;
  --c-brand: #103838;
  --c-brand-600: #215d57;
  --c-brand-50: #eff6f4;
  --c-font: "Figtree", "Noto Sans", system-ui, sans-serif;
  --c-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --c-sh-1: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 1px 2px rgba(10, 43, 41, 0.05);
  --c-sh-2: 0 1px 2px rgba(10, 43, 41, 0.05), 0 8px 20px -10px rgba(10, 43, 41, 0.16);
  --c-sh-3: 0 2px 4px rgba(10, 43, 41, 0.05), 0 20px 44px -20px rgba(10, 43, 41, 0.2);
  --c-sh-4: 0 6px 12px rgba(10, 43, 41, 0.06), 0 40px 80px -36px rgba(10, 43, 41, 0.32);
}

body.console {
  background: var(--c-canvas);
  color: var(--c-ink);
  font-family: var(--c-font);
  -webkit-font-smoothing: antialiased;
}

body.console :focus-visible {
  outline: 3px solid #2f7469;
  outline-offset: 2px;
}

/* ── Sign-in ────────────────────────────────────────────────────────────── */
.cx-login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
  background:
    radial-gradient(52% 42% at 50% 0%, rgba(78, 155, 140, 0.16), transparent 70%),
    var(--c-canvas);
}

.cx-login-inner {
  width: 100%;
  max-width: 420px;
  display: grid;
  gap: 22px;
}

.cx-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-self: center;
}

.cx-brand img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  box-shadow: var(--c-sh-2);
}

.cx-brand-name {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin: 0;
}

.cx-brand-sub {
  font-size: 0.78rem;
  color: var(--c-ink-3);
  margin: 2px 0 0;
}

.cx-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--c-brand-50);
  color: var(--c-brand-600);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: 2px;
}

.cx-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: 24px;
  padding: 30px 28px;
  box-shadow: var(--c-sh-4);
  animation: cx-in 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cx-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.cx-title {
  margin: 0;
  font-size: 1.42rem;
  font-weight: 700;
  letter-spacing: -0.035em;
}

.cx-sub {
  margin: 7px 0 0;
  font-size: 0.875rem;
  color: var(--c-ink-3);
  line-height: 1.5;
}

.cx-form {
  margin-top: 24px;
  display: grid;
  gap: 16px;
}

.cx-field {
  display: grid;
  gap: 7px;
}

.cx-field > label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--c-ink-2);
}

.cx-field input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--c-line-strong);
  border-radius: 12px;
  background: var(--c-surface);
  color: var(--c-ink);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.cx-field input::placeholder {
  color: var(--c-ink-3);
}

.cx-field input:focus {
  outline: none;
  border-color: #2f7469;
  box-shadow: 0 0 0 4px rgba(78, 155, 140, 0.18);
}

.cx-pw {
  position: relative;
}

.cx-pw input {
  padding-right: 50px;
}

.cx-pw-toggle {
  position: absolute;
  top: 50%;
  right: 5px;
  translate: 0 -50%;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--c-ink-3);
  cursor: pointer;
}

.cx-pw-toggle:hover {
  color: var(--c-brand-600);
  background: var(--c-brand-50);
}

.cx-pw-toggle svg {
  width: 18px;
  height: 18px;
}

.cx-error {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 13px;
  border-radius: 11px;
  background: #fdf1ef;
  border: 1px solid #f3d3cd;
  color: #b02a1c;
  font-size: 0.83rem;
  font-weight: 500;
}

.cx-error svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.cx-submit {
  margin-top: 4px;
  width: 100%;
  min-height: 48px;
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--c-brand);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 10px 24px -12px rgba(10, 43, 41, 0.6);
  transition: background-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.cx-submit:hover {
  background: #184848;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 16px 32px -14px rgba(10, 43, 41, 0.6);
}

.cx-submit:active {
  transform: scale(0.99);
}

.cx-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.cx-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0;
  font-size: 0.76rem;
  color: var(--c-ink-3);
  text-align: center;
}

.cx-foot svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
}

/* ── Application shell ──────────────────────────────────────────────────── */
body.console #dashboardApp > header {
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--c-line);
  box-shadow: none;
}

/* The "DS" tile becomes the real mark. */
body.console #dashboardApp > header .bg-gradient-to-tr {
  background: transparent !important;
  box-shadow: none !important;
  font-size: 0 !important;
  background-image: url("/icons/icon-192.png") !important;
  background-size: contain !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
}

body.console #dashboardApp main > div {
  background: var(--c-surface);
  border-color: var(--c-line);
  box-shadow: var(--c-sh-1);
}

body.console #dashboardApp table thead {
  background: #f7faf8;
  color: var(--c-ink-3);
}

body.console #dashboardApp table tbody tr {
  transition: background-color 0.16s ease;
}

body.console #dashboardApp table tbody tr:hover {
  background: #f8fbf9;
}

body.console #dashboardApp table td,
body.console #dashboardApp table th {
  border-color: var(--c-line-2);
}

body.console #dashboardApp input,
body.console #dashboardApp select,
body.console #dashboardApp textarea {
  background: var(--c-surface);
  color: var(--c-ink);
  border-color: var(--c-line-strong);
  font-family: inherit;
}

body.console #dashboardApp input::placeholder,
body.console #dashboardApp textarea::placeholder {
  color: var(--c-ink-3);
  opacity: 1;
}

body.console #dashboardApp input:focus,
body.console #dashboardApp select:focus,
body.console #dashboardApp textarea:focus {
  outline: none;
  border-color: #2f7469;
  box-shadow: 0 0 0 4px rgba(78, 155, 140, 0.16);
}

body.console #dashboardApp .filter-tab {
  min-height: 32px;
  border-radius: 9px;
  font-weight: 600;
}

body.console [id^="modal"].fixed {
  background-color: rgba(6, 34, 32, 0.58);
  backdrop-filter: blur(3px);
}

body.console [id^="modal"] > div {
  border-radius: 22px;
  border-color: var(--c-line);
  box-shadow: var(--c-sh-4);
}

body.console [id^="modal"] h3 {
  letter-spacing: -0.028em;
}

body.console [id^="modal"] label {
  color: var(--c-ink-2);
  font-weight: 600;
}

/* A thin, quiet scrollbar for the table and the modals. */
body.console ::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

body.console ::-webkit-scrollbar-thumb {
  background: #d7e3df;
  border-radius: 999px;
  border: 3px solid var(--c-canvas);
}

body.console ::-webkit-scrollbar-track {
  background: transparent;
}

/* ── Requests inbox ─────────────────────────────────────────────────────── */
.inbox-count,
.inbox-badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #b02a1c;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
}

.inbox-badge {
  min-width: 22px;
  height: 22px;
  font-size: 0.72rem;
}

.inbox-filters {
  display: flex;
  gap: 3px;
  padding: 4px;
  border-radius: 11px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-line);
}

.inbox-filter {
  min-height: 32px;
  padding: 0 13px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--c-ink-3);
  cursor: pointer;
  transition: background-color 0.16s, color 0.16s;
}

.inbox-filter:hover {
  color: var(--c-brand-600);
}

.inbox-filter.is-active {
  background: var(--c-surface);
  color: var(--c-brand);
  box-shadow: 0 1px 2px rgba(10, 43, 41, 0.1);
}

.inbox-list {
  display: grid;
}

.inbox-row {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 15px 24px;
  border-bottom: 1px solid var(--c-line-2);
  transition: background-color 0.16s;
}

.inbox-row:last-child {
  border-bottom: 0;
}

.inbox-row:hover {
  background: #f8fbf9;
}

.inbox-row.is-busy {
  opacity: 0.55;
  pointer-events: none;
}

.inbox-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.inbox-line1 {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inbox-kind {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  background: var(--c-surface-2);
  color: var(--c-ink-2);
}

.inbox-kind.kind-trial {
  background: #eef4fd;
  color: #1d4f8c;
}

.inbox-kind.kind-topup {
  background: #eefaf3;
  color: #0f7a53;
}

.inbox-kind.kind-support {
  background: #fdf1ef;
  color: #b02a1c;
}

.inbox-who {
  font-size: 0.9rem;
  font-weight: 650;
  letter-spacing: -0.012em;
  color: var(--c-ink);
}

.inbox-meta {
  margin: 0;
  font-size: 0.76rem;
  color: var(--c-ink-3);
  line-height: 1.45;
}

.inbox-subject {
  margin: 2px 0 0;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--c-ink-2);
}

.inbox-body {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--c-ink-2);
  max-width: 70ch;
  white-space: pre-wrap;
}

.inbox-status {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.status-new {
  background: #fdf6e7;
  color: #9a5b06;
}

.status-in_progress {
  background: #eef4fd;
  color: #1d4f8c;
}

.status-done {
  background: #eefaf3;
  color: #0f7a53;
}

.status-rejected {
  background: #fdf1ef;
  color: #b02a1c;
}

.inbox-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.inbox-btn {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--c-line-strong);
  border-radius: 9px;
  background: var(--c-surface);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--c-ink-2);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.16s, color 0.16s, background-color 0.16s;
}

.inbox-btn:hover {
  border-color: #7fbcb0;
  color: var(--c-brand-600);
}

.inbox-btn-primary {
  background: var(--c-brand);
  border-color: transparent;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 6px 16px -10px rgba(10, 43, 41, 0.8);
}

.inbox-btn-primary:hover {
  background: #184848;
  color: #fff;
}

.inbox-btn-quiet {
  border-color: transparent;
  color: var(--c-ink-3);
}

.inbox-empty {
  margin: 0;
  padding: 34px 24px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--c-ink-3);
}

#inboxSection.is-flash {
  box-shadow: 0 0 0 3px rgba(78, 155, 140, 0.35), var(--c-sh-2);
  transition: box-shadow 0.3s;
}

@media (max-width: 760px) {
  .inbox-row {
    flex-direction: column;
    gap: 10px;
  }

  .inbox-actions {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.console *,
  body.console *::before,
  body.console *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
