:root {
  --ink: #16233b;
  --muted: #65738c;
  --line: #dce3ed;
  --surface: #ffffff;
  --surface-soft: #f5f7fb;
  --navy: #102a56;
  --navy-deep: #091b3b;
  --teal: #137c78;
  --teal-soft: #e6f5f3;
  --blue: #2463d4;
  --warning: #a45b05;
  --warning-soft: #fff3dc;
  --danger: #a52d3c;
  --danger-soft: #fff0f2;
  --shadow: 0 18px 50px rgba(16, 42, 86, 0.10);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; overflow-x: hidden; }

body {
  margin: 0;
  color: var(--ink);
  background: #eef2f7;
}
body.workflow-open { overflow: hidden; }

button, textarea, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled, textarea:disabled { cursor: not-allowed; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  direction: ltr;
}

[dir="rtl"] .app-shell { grid-template-columns: 292px minmax(0, 1fr); }

.sidebar {
  direction: rtl;
  display: flex;
  flex-direction: column;
  gap: 26px;
  min-height: 100vh;
  padding: 28px 22px 18px;
  color: #f4f7ff;
  background:
    radial-gradient(circle at 20% 12%, rgba(47, 127, 216, 0.24), transparent 28%),
    linear-gradient(155deg, var(--navy) 0%, var(--navy-deep) 72%);
}

[dir="ltr"] .sidebar { direction: ltr; }

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark, .welcome-symbol {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, #28a6a0, #2c6ed2);
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(26, 167, 161, 0.24);
}
.brand strong { display: block; font-size: 16px; letter-spacing: .01em; }
.brand span { display: block; margin-top: 4px; color: #aebbd1; font-size: 12px; }

.privacy-card {
  display: flex;
  gap: 11px;
  padding: 14px;
  border: 1px solid rgba(119, 215, 204, .24);
  border-radius: 15px;
  background: rgba(20, 133, 126, .13);
}
.privacy-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  color: #041e2d;
  background: #72d4c9;
  font-weight: 800;
}
.privacy-card h2, .examples h2 { margin: 0; font-size: 13px; }
.privacy-card p { margin: 5px 0 0; color: #bfd3da; font-size: 11px; line-height: 1.75; }

.examples { display: grid; gap: 8px; }
.examples h2 { margin-bottom: 5px; color: #9fadc5; font-weight: 600; }
.example-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #d8e0ee;
  background: transparent;
  text-align: start;
  font-size: 12px;
  transition: background .18s ease, border-color .18s ease;
}
.example-button:hover, .example-button:focus-visible {
  border-color: rgba(130, 170, 225, .24);
  background: rgba(255, 255, 255, .07);
  outline: none;
}
.example-button > span:first-child { width: 18px; color: #7fcfc8; text-align: center; font-size: 16px; }

.workflow-nav { display: grid; gap: 8px; }
.workflow-nav-button {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(114, 212, 201, .28);
  border-radius: 12px;
  color: #eefbfa;
  background: rgba(19, 124, 120, .2);
  text-align: start;
  font-size: 12px;
  font-weight: 800;
}
.workflow-nav-button:hover:not(:disabled), .workflow-nav-button:focus-visible {
  border-color: rgba(114, 212, 201, .62);
  background: rgba(19, 124, 120, .34);
  outline: 3px solid rgba(114, 212, 201, .1);
}
.workflow-nav-button:disabled { opacity: .48; cursor: not-allowed; }
.workflow-nav-button > span:first-child { color: #72d4c9; font-size: 16px; }
.workflow-badge {
  min-width: 23px;
  height: 23px;
  display: inline-grid;
  place-items: center;
  margin-inline-start: auto;
  padding: 0 6px;
  border-radius: 999px;
  color: #08203b;
  background: #72d4c9;
  font-size: 10px;
  font-weight: 900;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, .1);
  color: #9eabc0;
  font-size: 10px;
}
.sidebar-footer #version-label { margin-inline-start: auto; }
.environment-dot { width: 7px; height: 7px; border-radius: 50%; background: #45c7a4; box-shadow: 0 0 0 4px rgba(69, 199, 164, .12); }

.main-panel { direction: rtl; min-width: 0; display: flex; flex-direction: column; background: var(--surface-soft); }
[dir="ltr"] .main-panel { direction: ltr; }

.topbar {
  min-height: 86px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .94);
}
.topbar-title h1 { margin: 0; font-size: 20px; }
.topbar-title p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 9px; }

.language-control select, .secondary-button, .icon-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
}
.language-control select { padding: 0 11px; }
.secondary-button { padding: 0 14px; font-size: 12px; font-weight: 700; }
.secondary-button:hover, .secondary-button:focus-visible, .language-control select:focus-visible { border-color: #9db5db; outline: 3px solid rgba(36, 99, 212, .1); }
.secondary-button:disabled { opacity: .5; cursor: not-allowed; }
.learning-toggle.disabled-learning { color: #776f64; background: #f5f2ed; }
.icon-button { width: 38px; padding: 0; }
.menu-button { display: none; }

.conversation {
  width: min(980px, calc(100% - 48px));
  min-height: calc(100vh - 86px);
  margin: 0 auto;
  padding: 26px 0 22px;
  display: flex;
  flex-direction: column;
}

.status-banner {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid #d9e1ec;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, .8);
  font-size: 11px;
}
.status-banner.authenticated { color: #10625e; border-color: #bfe0dc; background: var(--teal-soft); }
.status-banner.error { color: var(--danger); border-color: #f0c5cb; background: var(--danger-soft); }
.status-indicator { width: 7px; height: 7px; border-radius: 50%; background: #9aa7b9; }
.authenticated .status-indicator { background: #1c9c91; }
.error .status-indicator { background: var(--danger); }

.messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 30px 8px;
  overflow-wrap: anywhere;
}
.welcome-card {
  max-width: 580px;
  align-self: center;
  margin: auto 0;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}
.welcome-symbol { margin: 0 auto 18px; }
.welcome-card h2 { margin: 0; font-size: 22px; }
.welcome-card p { margin: 12px 0 0; color: var(--muted); font-size: 13px; line-height: 1.85; }
.welcome-card .safety-note { color: #1b6b67; font-size: 11px; }

.message { max-width: 82%; display: grid; gap: 7px; }
.message.user { align-self: flex-start; }
[dir="ltr"] .message.user { align-self: flex-end; }
.message.assistant { align-self: flex-end; }
[dir="ltr"] .message.assistant { align-self: flex-start; }
.message-bubble { padding: 13px 16px; border-radius: 16px; line-height: 1.75; font-size: 13px; white-space: pre-wrap; }
.message.user .message-bubble { color: #fff; background: linear-gradient(145deg, #245fc5, #17458e); border-end-start-radius: 5px; }
[dir="ltr"] .message.user .message-bubble { border-end-start-radius: 16px; border-end-end-radius: 5px; }
.message.assistant .message-bubble { border: 1px solid var(--line); background: #fff; border-end-end-radius: 5px; }
[dir="ltr"] .message.assistant .message-bubble { border-end-end-radius: 16px; border-end-start-radius: 5px; }
.message-meta { color: #7a879a; font-size: 10px; }

.result-card {
  min-width: min(560px, 78vw);
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.result-card h3 { margin: 0 0 12px; font-size: 13px; }
.result-card .result-subheading { margin: 14px 0 8px; color: var(--muted); font-size: 10px; }
.result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.result-field { padding: 10px; border-radius: 9px; background: #f6f8fb; }
.result-field dt { color: var(--muted); font-size: 9px; }
.result-field dd { margin: 4px 0 0; font-size: 12px; font-weight: 700; }
.result-list { display: grid; gap: 8px; }
.result-item { padding: 11px; border: 1px solid #e4e9f1; border-radius: 10px; }
.result-item strong { display: block; font-size: 12px; }
.result-item span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.communication-result-item { border-inline-start: 3px solid var(--teal); }
.communication-reply-review { margin-top: 11px; padding: 11px; border: 1px solid #eed39f; border-radius: 10px; background: var(--warning-soft); }
.communication-reply-review > strong { color: #71430c; }
.communication-reply-review > span { white-space: pre-wrap; overflow-wrap: anywhere; }
.communication-reply-review.communication-reply-sent { border-color: #9bd4ca; background: #f1fbf8; }
.communication-reply-review.communication-reply-sent > strong { color: #176963; }
.safety-result { border-color: #f0d29c; background: var(--warning-soft); }
.safety-result h3 { color: var(--warning); }
.approval-reference { margin-top: 11px; padding-top: 11px; border-top: 1px solid rgba(113, 67, 12, .18); }
.approval-reference .result-field { background: rgba(255, 255, 255, .68); }
.approval-reference dd { overflow-wrap: anywhere; }
.safety-strip { margin-top: 11px; padding: 9px; border-radius: 9px; color: #71430c; background: rgba(255, 255, 255, .65); font-size: 10px; line-height: 1.7; }
.result-actions { display: flex; justify-content: flex-end; margin-top: 11px; }
.confirm-order-button { min-height: 38px; padding: 0 15px; border: 0; border-radius: 10px; color: #fff; background: var(--blue); font-size: 11px; font-weight: 800; }
.confirm-order-button:hover:not(:disabled), .confirm-order-button:focus-visible { background: #174fab; outline: 3px solid rgba(36, 99, 212, .15); }
.confirm-order-button:disabled { background: #8091a9; }
.confirmed-result { border-color: #9bd4ca; background: #f1fbf8; }
.confirmed-result h3 { color: #176963; }
.evidence-line { margin-top: 10px; color: #7c8798; font-size: 9px; direction: ltr; text-align: start; }
.conversation-feedback { display: flex; align-items: center; gap: 7px; margin-top: 9px; }
.conversation-feedback-button { min-height: 30px; padding: 0 10px; border: 1px solid #d4deeb; border-radius: 999px; color: var(--muted); background: #fff; font-size: 9px; font-weight: 700; }
.conversation-feedback-button:hover:not(:disabled), .conversation-feedback-button:focus-visible { color: var(--blue); border-color: #98b2dc; outline: 2px solid rgba(36, 99, 212, .1); }
.conversation-feedback-button:disabled { opacity: .55; }
.conversation-feedback-status { color: var(--teal); font-size: 9px; }
.conversation-suggestion { margin-top: 11px; padding: 12px; border: 1px solid #bed9d4; border-radius: 12px; background: #f1faf8; }
.conversation-suggestion p { margin: 0; color: #245e59; font-size: 11px; line-height: 1.75; }
.conversation-suggestion-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.conversation-suggestion-primary, .conversation-suggestion-secondary { min-height: 32px; padding: 0 11px; border-radius: 9px; font-size: 9px; font-weight: 800; }
.conversation-suggestion-primary { border: 0; color: #fff; background: var(--teal); }
.conversation-suggestion-secondary { border: 1px solid #b7cec9; color: #35625e; background: #fff; }
.conversation-suggestion-primary:focus-visible, .conversation-suggestion-secondary:focus-visible { outline: 3px solid rgba(19, 124, 120, .13); }
.loading-dots { display: inline-flex; gap: 4px; padding: 3px 0; }
.loading-dots span { width: 6px; height: 6px; border-radius: 50%; background: #8796aa; animation: pulse 1.2s infinite ease-in-out; }
.loading-dots span:nth-child(2) { animation-delay: .15s; }
.loading-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 0%, 70%, 100% { opacity: .28; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }

.composer {
  padding: 12px;
  border: 1px solid #ccd6e3;
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 12px 35px rgba(16, 42, 86, .08);
}
.composer:focus-within { border-color: #7f9fd3; box-shadow: 0 0 0 4px rgba(36, 99, 212, .08), 0 12px 35px rgba(16, 42, 86, .08); }
.composer textarea { width: 100%; min-height: 60px; max-height: 150px; resize: vertical; padding: 6px 8px; border: 0; outline: 0; color: var(--ink); background: transparent; line-height: 1.7; }
.composer textarea::placeholder { color: #96a2b3; }
.composer textarea:disabled { opacity: .58; }
.voice-status { margin: 2px 8px 9px; color: var(--muted); font-size: 10px; line-height: 1.65; }
.voice-status.recording { color: var(--danger); }
.voice-status.busy { color: var(--blue); }
.voice-status.ready { color: var(--teal); }
.voice-status.error { color: var(--danger); }
.composer-footer { display: flex; align-items: center; gap: 12px; padding-top: 8px; border-top: 1px solid #edf0f5; }
.composer-meta { display: flex; gap: 7px; color: #8995a6; font-size: 9px; }
.composer-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.microphone-button { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid #b9c8dc; border-radius: 50%; color: var(--teal); background: #fff; }
.microphone-button > span[aria-hidden="true"] { width: 10px; height: 10px; border-radius: 50%; color: transparent; background: currentColor; }
.microphone-button:hover:not(:disabled), .microphone-button:focus-visible { border-color: var(--teal); outline: 3px solid rgba(19, 124, 120, .12); }
.microphone-button.recording { color: #fff; border-color: var(--danger); background: var(--danger); animation: recordingPulse 1.3s ease-in-out infinite; }
.microphone-button:disabled { opacity: .45; cursor: not-allowed; }
@keyframes recordingPulse { 50% { box-shadow: 0 0 0 8px rgba(165, 45, 60, .12); } }
.send-button { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 16px; border: 0; border-radius: 10px; color: #fff; background: var(--blue); font-size: 12px; font-weight: 800; }
.send-button:hover:not(:disabled), .send-button:focus-visible { background: #174fab; outline: 3px solid rgba(36, 99, 212, .15); }
.send-button:disabled { background: #a7b4c8; }

.consent-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(7, 22, 48, .74);
}
.consent-dialog {
  width: min(560px, 100%);
  padding: 26px;
  border: 1px solid #d7dfeb;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(3, 15, 35, .32);
}
.consent-symbol {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #754407;
  background: var(--warning-soft);
  font-weight: 900;
}
.consent-dialog h2 { margin: 16px 0 10px; font-size: 19px; }
.consent-dialog p { margin: 9px 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.consent-dialog .consent-privacy { padding: 11px; border-radius: 10px; color: #754407; background: var(--warning-soft); }
.consent-dialog .consent-safety { color: #176963; }
.consent-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.consent-accept-button { min-height: 38px; padding: 0 15px; border: 0; border-radius: 10px; color: #fff; background: var(--blue); font-weight: 800; }
.consent-accept-button:hover, .consent-accept-button:focus-visible { background: #174fab; outline: 3px solid rgba(36, 99, 212, .15); }

.workflow-overlay {
  position: fixed;
  inset: 0;
  z-index: 28;
  display: flex;
  justify-content: flex-end;
  background: rgba(7, 22, 48, .6);
}
[dir="ltr"] .workflow-overlay { justify-content: flex-start; }
.workflow-panel {
  width: min(560px, 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 24px;
  border-inline-start: 1px solid #d7dfeb;
  background: #f7f9fc;
  box-shadow: -24px 0 70px rgba(3, 15, 35, .25);
  overflow-y: auto;
}
[dir="ltr"] .workflow-panel {
  border-inline-start: 0;
  border-inline-end: 1px solid #d7dfeb;
  box-shadow: 24px 0 70px rgba(3, 15, 35, .25);
}
.workflow-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.workflow-header h2 { margin: 0; font-size: 20px; }
.workflow-header p { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.workflow-header-actions { margin-inline-start: auto; display: flex; gap: 8px; }
.workflow-status { min-height: 24px; padding: 14px 2px 4px; color: var(--muted); font-size: 11px; }
.workflow-status.error { color: var(--danger); }
.workflow-status.success { color: var(--teal); }
.workflow-list { display: grid; gap: 12px; padding-top: 10px; }
.operations-panel { width: min(680px, 100%); }
.identity-administration-panel { width: min(820px, 100%); }
.instagram-administration-panel,
.security-center-panel { width: min(920px, 100%); }
.security-connection-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.security-connection-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 7px 10px;
  min-height: 150px;
  padding: 18px;
  border: 1px solid #bcd8d4;
  border-radius: 16px;
  color: var(--ink);
  background: linear-gradient(145deg, #fff, #f2faf8);
  text-align: start;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease,
    box-shadow .16s ease;
}
.security-connection-card:hover,
.security-connection-card:focus-visible {
  transform: translateY(-2px);
  border-color: #5fa79f;
  outline: none;
  box-shadow: 0 12px 28px rgba(8, 52, 75, .09);
}
.security-card-icon {
  grid-row: 1 / span 3;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: #0f665f;
  background: #d9f4ef;
  font-size: 19px;
}
.security-connection-card strong {
  font-size: 13px;
  overflow-wrap: anywhere;
}
.security-connection-card > span:not(.security-card-icon) {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}
.security-connection-card small {
  align-self: end;
  color: var(--teal);
  font-size: 9px;
  font-weight: 800;
}
.security-detail-view { padding-top: 16px; }
.security-detail-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0 2px;
}
.security-detail-heading > div { flex: 1; }
.security-detail-heading h3 {
  margin: 0 0 5px;
  color: var(--ink);
  font-size: 17px;
}
.security-detail-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.8;
}
.security-overview-list { display: grid; gap: 9px; }
.security-overview-row,
.security-api-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #d9e7e4;
  border-radius: 11px;
  color: var(--ink);
  background: #f8fcfb;
  text-align: start;
}
.security-api-row {
  cursor: pointer;
}
.security-api-row:hover,
.security-api-row:focus-visible {
  border-color: #5fa79f;
  outline: none;
}
.security-overview-row > div,
.security-api-row > div {
  display: grid;
  gap: 4px;
}
.security-overview-row strong,
.security-api-row strong { font-size: 11px; }
.security-overview-row span,
.security-api-row span {
  color: var(--muted);
  font-size: 9px;
}
.security-state-pill {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  color: #176b63;
  background: #e0f4f0;
  font-size: 8px;
  font-weight: 900;
}
.instagram-security-note {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid #e8c875;
  border-radius: 12px;
  color: #664b16;
  background: #fff8e5;
  font-size: 11px;
  line-height: 1.8;
}
.instagram-administration-section {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.instagram-administration-section > h3 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
}
.instagram-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.instagram-form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}
.instagram-form-grid input,
.instagram-form-grid select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #c9ddd9;
  border-radius: 9px;
  color: var(--ink);
  background: #f8fcfb;
}
.instagram-form-grid input:focus,
.instagram-form-grid select:focus {
  border-color: #5fa79f;
  outline: 3px solid rgba(23, 120, 111, .1);
}
.security-checkbox-label {
  grid-template-columns: auto 1fr !important;
  align-items: center;
  justify-content: start;
  padding: 9px 11px;
  border: 1px solid #d9e7e4;
  border-radius: 9px;
  background: #f8fcfb;
}
.security-checkbox-label input {
  width: 18px;
  min-height: 18px;
  margin: 0;
}
.instagram-form-wide { grid-column: 1 / -1; }
.instagram-form-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 12px;
}
.security-form-actions { gap: 10px; }
.instagram-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.instagram-status-item {
  min-width: 0;
  padding: 10px;
  border-radius: 10px;
  background: #f6faf9;
}
.instagram-status-item strong {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 9px;
}
.instagram-status-item span {
  color: var(--ink);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.instagram-url-list { display: grid; gap: 9px; }
.instagram-url-item {
  display: grid;
  grid-template-columns: minmax(120px, .35fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid #dbe7e4;
  border-radius: 10px;
  background: #f8fcfb;
  font-size: 10px;
}
.instagram-url-item code {
  direction: ltr;
  overflow-wrap: anywhere;
  color: #176963;
  text-align: left;
}
.instagram-url-state {
  padding: 4px 7px;
  border-radius: 999px;
  color: #76500f;
  background: var(--warning-soft);
  font-size: 9px;
  font-weight: 800;
}
.identity-administration-section {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.identity-administration-section > h3 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
}
.identity-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.identity-form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}
.identity-form-grid input {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #d5dde8;
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
}
.identity-form-grid input:focus {
  border-color: #9db5db;
  outline: 3px solid rgba(36, 99, 212, .08);
}
.identity-form-wide { grid-column: 1 / -1; }
.identity-helper {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}
.identity-option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 10px;
}
.identity-option {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid #e0e6ef;
  border-radius: 8px;
  color: var(--ink);
  background: #fafcff;
  font-size: 9px;
  overflow-wrap: anywhere;
}
.identity-option input { flex: 0 0 auto; accent-color: var(--blue); }
.identity-option:has(input:disabled) { opacity: .65; }
.identity-impact .safety-note {
  margin: 10px 0 0;
  padding: 10px;
  border-radius: 9px;
  color: #176963;
  background: var(--teal-soft);
  font-size: 10px;
  line-height: 1.7;
}
.operations-section { display: grid; gap: 10px; }
.operations-section > h3 {
  margin: 8px 2px 0;
  color: var(--ink);
  font-size: 13px;
}
.operations-section > .operations-subheading { margin-top: 16px; }
.operations-section .safety-note {
  margin: 12px 0 0;
  padding: 10px;
  border-radius: 9px;
  color: #176963;
  background: var(--teal-soft);
  font-size: 10px;
  line-height: 1.7;
}
.workflow-empty {
  padding: 30px 20px;
  border: 1px dashed #cbd5e2;
  border-radius: 14px;
  color: var(--muted);
  background: #fff;
  text-align: center;
  font-size: 12px;
}
.workflow-task {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(16, 42, 86, .06);
}
.workflow-task.actionable { border-color: #b8dcd7; }
.workflow-task.completed { border-color: #a6d8cf; background: #f5fcfa; }
.workflow-task.rejected { border-color: #efc2c8; background: #fff8f9; }
.workflow-task-header { display: flex; align-items: flex-start; gap: 10px; }
.workflow-task-header h3 { margin: 0; font-size: 13px; }
.workflow-task-header p { margin: 5px 0 0; color: var(--muted); font-size: 9px; }
.workflow-state {
  margin-inline-start: auto;
  padding: 5px 8px;
  border-radius: 999px;
  color: #76500f;
  background: var(--warning-soft);
  font-size: 9px;
  font-weight: 800;
}
.workflow-task.completed .workflow-state { color: #176963; background: var(--teal-soft); }
.workflow-task.rejected .workflow-state { color: var(--danger); background: var(--danger-soft); }
.workflow-payload { margin-top: 12px; }
.workflow-role {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 10px;
}
.workflow-reason {
  width: 100%;
  min-height: 58px;
  margin-top: 11px;
  padding: 9px 10px;
  resize: vertical;
  border: 1px solid #d5dde8;
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
  line-height: 1.6;
}
.workflow-reason:focus { border-color: #9db5db; outline: 3px solid rgba(36, 99, 212, .08); }
.workflow-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.workflow-action {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #b8c7db;
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
  font-size: 10px;
  font-weight: 800;
}
.workflow-action.primary { border-color: var(--blue); color: #fff; background: var(--blue); }
.workflow-action.danger { border-color: #e1a8b0; color: var(--danger); background: var(--danger-soft); }
.workflow-action:hover:not(:disabled), .workflow-action:focus-visible { outline: 3px solid rgba(36, 99, 212, .1); }
.workflow-action:disabled { opacity: .55; cursor: wait; }

.voice-response-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 9px;
}
.voice-response-button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #9fb8d8;
  border-radius: 999px;
  color: var(--blue);
  background: #f7faff;
  font-size: 10px;
  font-weight: 800;
}
.voice-response-button:hover:not(:disabled),
.voice-response-button:focus-visible {
  outline: 3px solid rgba(36, 99, 212, .1);
}
.voice-response-button-primary {
  border-color: #17786f;
  color: #fff;
  background: #17786f;
}
.voice-response-button:disabled { opacity: .55; cursor: wait; }
.voice-response-status { color: var(--muted); font-size: 9px; }

.busy-overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-content: center; justify-items: center; gap: 14px; color: #fff; background: rgba(7, 22, 48, .82); font-size: 13px; }
.spinner { width: 34px; height: 34px; border: 3px solid rgba(255, 255, 255, .3); border-top-color: #64d2c8; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.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; }

@media (max-width: 860px) {
  .app-shell, [dir="rtl"] .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset-block: 0; left: 0; right: auto; z-index: 15; width: min(292px, 86vw); transform: translateX(-105%); transition: transform .2s ease; box-shadow: 20px 0 50px rgba(3, 15, 35, .25); }
  [dir="rtl"] .sidebar { left: auto; right: 0; transform: translateX(105%); box-shadow: -20px 0 50px rgba(3, 15, 35, .25); }
  .sidebar.open { transform: translateX(0); }
  .menu-button { display: block; }
  .topbar { padding: 14px 18px; }
  .topbar-title p { display: none; }
  .conversation { width: min(100% - 26px, 760px); }
}

@media (max-width: 580px) {
  .topbar { flex-wrap: wrap; gap: 10px; }
  .topbar-title h1 { font-size: 17px; }
  .topbar-actions { flex: 1 0 100%; width: 100%; justify-content: flex-start; }
  .topbar-actions .secondary-button { padding-inline: 9px; font-size: 10px; }
  .language-control { margin-inline-start: auto; }
  .conversation { min-height: calc(100vh - 126px); padding-top: 16px; }
  .messages { padding-inline: 0; }
  .welcome-card { padding: 24px 18px; }
  .welcome-card h2 { font-size: 19px; }
  .message { max-width: 94%; }
  .result-card { min-width: min(88vw, 480px); }
  .result-grid { grid-template-columns: 1fr; }
  .composer-meta .separator, .composer-meta span:last-child { display: none; }
  .consent-actions { flex-direction: column-reverse; }
  .consent-actions button { width: 100%; }
  .workflow-panel { padding: 18px; }
  .workflow-header { align-items: stretch; flex-direction: column; }
  .workflow-header-actions { width: 100%; margin-inline-start: 0; }
  .workflow-header-actions .secondary-button { flex: 1; }
  .identity-form-grid, .identity-option-grid,
  .instagram-form-grid, .instagram-status-grid,
  .security-connection-grid {
    grid-template-columns: 1fr;
  }
  .security-detail-heading { flex-direction: column; }
  .security-back-button { align-self: stretch; }
  .instagram-form-wide { grid-column: auto; }
  .instagram-url-item { grid-template-columns: 1fr; }
}

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