:root {
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --primary-500: #6366f1;
  --primary-600: #4f46e5;
  --primary-700: #4338ca;
  --primary-900: #312e81;

  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  --surface-50: #fafafa;
  --surface-100: #f4f4f5;
  --surface-200: #e4e4e7;
  --surface-300: #d4d4d8;
  --border-100: #f4f4f5;
  --border-200: #e4e4e7;
  --border-300: #d4d4d8;
  --text-300: #d4d4d8;
  --text-400: #a1a1aa;
  --text-500: #71717a;
  --text-600: #52525b;
  --text-700: #3f3f46;
  --text-800: #27272a;
  --text-900: #18181b;

  --success-50: #f0fdf4;
  --success-100: #d1fae5;
  --success-500: #10b981;
  --success-600: #059669;
  --success-700: #15803d;
  --warning-50: #fffbeb;
  --warning-500: #f59e0b;
  --warning-600: #d97706;
  --warning-700: #b45309;
  --error-50: #fef2f2;
  --error-100: #fee2e2;
  --error-500: #ef4444;
  --error-600: #dc2626;
  --error-800: #991b1b;

  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 10px 24px -18px rgb(15 23 42 / 0.45), 0 2px 8px -6px rgb(15 23 42 / 0.18);
  --shadow-lg: 0 18px 45px -28px rgb(15 23 42 / 0.55), 0 10px 20px -18px rgb(15 23 42 / 0.25);
  --shadow-xl: 0 28px 70px -38px rgb(15 23 42 / 0.6), 0 18px 28px -24px rgb(15 23 42 / 0.3);
  --focus-ring: 0 0 0 4px rgb(99 102 241 / 0.14);
  --transition-fast: 150ms ease;
  --font-primary: "Tajawal", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "SF Mono", "Monaco", ui-monospace, monospace;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  font-family: var(--font-primary);
  color: var(--text-800);
  background-color: var(--slate-50);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--text-800);
  font-family: var(--font-primary);
  font-size: 14px;
  line-height: 1.5;
  background:
    radial-gradient(circle at 10% 0%, rgba(99, 102, 241, 0.06), transparent 30%),
    linear-gradient(180deg, #fbfdff 0%, var(--slate-50) 42%, #f8fafc 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--primary-600);
  text-decoration: none;
}

a:hover {
  color: var(--primary-700);
  text-decoration: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.login-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  background-color: var(--surface-100);
  background-image: radial-gradient(circle at top right, var(--primary-100) 0%, var(--surface-50) 100%);
  overflow-x: hidden;
}

.login-panel {
  width: min(400px, 100%);
  margin: auto;
  padding: 2.5rem;
  background: #fff;
  border: 1px solid var(--border-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 1.5rem;
  min-width: 0;
}

.login-panel .brand-mark {
  flex-direction: column;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  text-align: center;
}

.brand-logo {
  width: auto;
  height: 60px;
  max-width: 180px;
  object-fit: contain;
}

.login-panel .brand-logo {
  height: 100px;
  max-width: 200px;
  animation: logo-pulse 3s ease-in-out infinite;
}

.login-panel .button {
  width: 100%;
  min-height: 46px;
  margin-top: 0.25rem;
  font-size: 1rem;
}

@keyframes logo-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.brand-title {
  color: var(--text-900);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
}

.brand-subtitle {
  margin-top: 0.15rem;
  color: var(--text-500);
  font-size: 0.8125rem;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  background:
    radial-gradient(circle at top left, rgba(99, 102, 241, 0.06), transparent 30%),
    var(--surface-50);
}

.sidebar {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border-inline-end: 1px solid var(--border-200);
  overflow: hidden;
}

.sidebar .brand-mark {
  min-height: 88px;
  margin-bottom: 0;
  padding: 12px 1rem;
  border-bottom: 1px solid var(--border-200);
  background: rgba(255, 255, 255, 0.76);
}

.nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 1rem 0.75rem 1.25rem;
  overflow-y: auto;
}

.nav::before {
  content: "SaaS Admin";
  color: var(--text-400);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  padding: 0.75rem 0.75rem 0.25rem;
  text-transform: uppercase;
}

html.locale-ar .nav::before {
  content: "إدارة SaaS";
}

.nav a,
.logout-button {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border: 0;
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--text-500);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-align: start;
  transition: background-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  color: currentColor;
}

.nav a span,
.logout-button span {
  min-width: 0;
}

.nav a:hover,
.logout-button:hover {
  background-color: var(--surface-100);
  color: var(--text-900);
  transform: translateX(1px);
}

.nav a.active {
  background: linear-gradient(180deg, var(--primary-50) 0%, #ffffff 100%);
  color: var(--primary-700);
  box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.12), 0 8px 18px -18px rgba(79, 70, 229, 0.7);
}

.nav form {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-200);
}

.logout-button:hover {
  color: var(--error-600);
}

.content {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 64px;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--border-200);
  backdrop-filter: blur(12px);
}

.topbar-title {
  color: var(--text-900);
  font-size: 1rem;
  font-weight: 600;
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  min-width: 0;
}

.admin-lang-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 32px;
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--border-200);
  border-radius: var(--radius-full);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.login-panel .admin-lang-switch {
  width: fit-content;
  margin: 1.25rem auto 0;
}

.lang-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-full);
  color: var(--text-400);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.lang-button:hover,
.lang-button.active {
  background: var(--primary-50);
  color: var(--primary-700);
}

.lang-separator {
  color: var(--text-300);
  font-size: 0.75rem;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--border-200);
  border-radius: var(--radius-full);
  background: #fff;
  color: var(--text-500);
  font-size: 0.8125rem;
  box-shadow: var(--shadow-sm);
}

.topbar-logout-form {
  margin: 0;
}

.topbar-logout-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 32px;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--border-200);
  border-radius: var(--radius-full);
  background: #fff;
  color: var(--text-500);
  box-shadow: var(--shadow-sm);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

.topbar-logout-button .nav-icon {
  width: 18px;
  height: 18px;
  flex-basis: 18px;
}

.topbar-logout-button:hover {
  border-color: var(--error-100);
  background: var(--error-50);
  color: var(--error-600);
}

.main {
  flex: 1;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid rgba(226, 232, 240, 0.85);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(248, 250, 252, 0.9) 100%);
  box-shadow: var(--shadow-sm);
}

.page-title {
  margin: 0;
  color: var(--text-900);
  font-size: 1.75rem;
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.page-kicker {
  margin: 0.375rem 0 0;
  color: var(--text-500);
  font-size: 0.95rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.stat-card,
.panel {
  background: linear-gradient(180deg, #ffffff 0%, #fcfdff 100%);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.stat-card:hover,
.panel:hover {
  border-color: rgba(203, 213, 225, 0.9);
  box-shadow: var(--shadow-md);
}

.stat-card {
  position: relative;
  min-height: 118px;
  padding: 1.25rem;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  inset-inline-end: -24px;
  top: -24px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.08);
}

.stat-label {
  position: relative;
  z-index: 1;
  color: var(--text-500);
  font-size: 0.8125rem;
  font-weight: 600;
}

.stat-value {
  position: relative;
  z-index: 1;
  margin-top: 0.55rem;
  color: var(--text-900);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.panel {
  margin-top: 1.5rem;
  overflow: hidden;
}

.panel-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.panel-title {
  margin: 0;
  color: var(--text-900);
  font-size: 1rem;
  font-weight: 600;
}

.panel > .actions {
  margin-top: 0;
  padding: 1.25rem 1.5rem;
}

.panel > .detail-grid + .actions,
.panel > .form-grid + .actions,
.panel > .readiness-grid + .actions,
.panel > .status-help-grid + .actions,
.panel > .table-wrap + .actions {
  padding-top: 0;
}

.panel > .field-hint {
  display: block;
  margin-top: 0;
  padding: 0 1.5rem 1.5rem;
}

.panel > .support-thread {
  padding: 1.5rem;
}

.panel > .support-notes {
  margin-top: 0;
  padding: 0 1.5rem 1.5rem;
}

.settings-wrapper {
  max-width: 1100px;
}

.tabs-nav {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  padding-bottom: 4px;
}

.tab-btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border: 1px solid var(--border-200);
  border-radius: var(--radius-lg);
  background: #fff;
  color: var(--text-600);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

.tab-btn:hover {
  background: var(--surface-50);
  border-color: var(--border-300);
  color: var(--primary-600);
}

.tab-btn.active {
  background: var(--primary-600);
  border-color: var(--primary-600);
  box-shadow: 0 10px 22px -18px rgba(79, 70, 229, 0.75);
  color: #fff;
}

.tab-content .panel {
  margin-top: 0;
}

.fade-in {
  animation: fade-in 0.3s ease-out;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: white;
  text-align: center;
}

th,
td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-100);
  color: var(--slate-800);
  font-size: 0.9375rem;
  vertical-align: middle;
  text-align: center;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, #ffffff 0%, var(--slate-50) 100%);
  border-bottom: 1px solid var(--border-200);
  color: var(--slate-600);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

td.wrap {
  min-width: 220px;
  white-space: normal;
}

tbody tr {
  transition: background-color var(--transition-fast), transform var(--transition-fast);
}

tbody tr:hover {
  background: rgba(99, 102, 241, 0.03);
}

tr:last-child td {
  border-bottom: 0;
}

.actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
  min-width: max-content;
}

.button,
button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0.625rem 1rem;
  border: 1px solid var(--border-300);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #ffffff 0%, var(--slate-50) 100%);
  box-shadow: 0 1px 1px rgba(15, 23, 42, 0.03);
  color: var(--text-700);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.button:hover {
  border-color: var(--slate-300);
  background: #fff;
  color: var(--text-900);
  text-decoration: none;
  transform: translateY(-1px);
}

.button.primary {
  border-color: transparent;
  background: linear-gradient(180deg, var(--primary-500) 0%, var(--primary-600) 100%);
  color: #fff;
  box-shadow: 0 10px 22px -16px rgba(79, 70, 229, 0.75);
}

.button.primary:hover {
  background: linear-gradient(180deg, var(--primary-600) 0%, var(--primary-700) 100%);
  color: #fff;
}

.button.danger {
  border-color: #fecaca;
  background: #fff1f2;
  color: #dc2626;
}

.button.danger:hover {
  background: #ffe4e6;
  color: #b91c1c;
}

.button.success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #059669;
}

.button.success:hover {
  background: #dcfce7;
  color: #047857;
}

.button.info {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #2563eb;
}

.button.info:hover {
  background: #dbeafe;
  color: #1d4ed8;
}

.button.warning {
  border-color: #fde68a;
  background: #fffbeb;
  color: #d97706;
}

.button.warning:hover {
  background: #fef3c7;
  color: #b45309;
}

.button.teal {
  border-color: #99f6e4;
  background: #f0fdfa;
  color: #0f766e;
}

.button.teal:hover {
  background: #ccfbf1;
  color: #0f5f59;
}

.button.purple {
  border-color: #ddd6fe;
  background: #f5f3ff;
  color: #6d28d9;
}

.button.purple:hover {
  background: #ede9fe;
  color: #5b21b6;
}

.button.danger-strong {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #be123c;
}

.button.danger-strong:hover {
  background: #ffe4e6;
  color: #9f1239;
}

.button.neutral {
  border-color: var(--border-300);
  background: #f8fafc;
  color: var(--slate-600);
}

.button.icon-button,
button.button.icon-button {
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: var(--radius-lg);
}

.button.icon-button .nav-icon {
  width: 18px;
  height: 18px;
}

.button[disabled] {
  opacity: 0.48;
  cursor: not-allowed;
  filter: saturate(0.4);
  transform: none;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  padding: 1.5rem;
}

.single-form {
  display: grid;
  gap: 1rem;
  padding: 1.5rem;
}

.narrow-panel {
  max-width: 620px;
}

.form-section {
  display: grid;
  align-content: start;
  gap: 1rem;
}

.form-section.full {
  grid-column: 1 / -1;
}

.section-title {
  margin: 0 0 0.15rem;
  color: var(--text-900);
  font-size: 1rem;
  font-weight: 600;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  color: var(--text-700);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.35;
}

.field-hint {
  color: var(--text-500);
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.45;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border-300);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--text-900);
  font-size: 0.9375rem;
  font-weight: 400;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 0.75rem center;
  background-repeat: no-repeat;
  background-size: 1.25rem;
  padding-right: 2.5rem;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-400);
  font-style: italic;
}

input:hover:not(:disabled),
select:hover:not(:disabled),
textarea:hover:not(:disabled) {
  border-color: var(--text-400);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--surface-50);
  color: var(--text-500);
  cursor: not-allowed;
  opacity: 0.7;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--slate-200);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0.375rem 0.8rem;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.035);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  text-transform: capitalize;
  white-space: nowrap;
}

.badge.active,
.badge.connected,
.badge.configured,
.badge.trial,
.badge.paid,
.badge.ready,
.badge.read_only,
.badge.success,
.badge.healthy,
.badge.completed,
.badge.active_use,
.badge.go_live,
.badge.low,
.badge.full,
.badge.code,
.badge.database,
.badge.uploads,
.badge.private_files,
.badge.pre_restore,
.badge.healthy,
.badge.yes,
.badge.enabled {
  background: #dcfce7;
  color: #15803d;
}

.badge.pending_setup,
.badge.not_tested,
.badge.not_verified,
.badge.not_implemented,
.badge.medium,
.badge.overdue,
.badge.grace_period,
.badge.contract_signed,
.badge.payment_received,
.badge.setup,
.badge.data_preparation,
.badge.training,
.badge.first_quote,
.badge.first_order,
.badge.not_started,
.badge.pending,
.badge.watch,
.badge.unknown,
.badge.draft,
.badge.sent,
.badge.pending,
.badge.running,
.badge.manual,
.badge.pre_migration,
.badge.normal,
.badge.in_progress,
.badge.waiting_client,
.badge.warning,
.badge.never_backed_up {
  background: #fef3c7;
  color: #b45309;
}

.badge.suspended,
.badge.failed,
.badge.cancelled,
.badge.blocked,
.badge.overdue_blocked,
.badge.inactive,
.badge.at_risk,
.badge.high,
.badge.critical,
.badge.urgent,
.badge.resolved,
.badge.closed,
.badge.no,
.badge.disabled {
  background: #fee2e2;
  color: #991b1b;
}

.support-thread {
  display: grid;
  gap: 1rem;
}

.status-stat {
  margin-top: 0.75rem;
  font-size: 1rem;
}

.deployment-overview .muted {
  position: relative;
  z-index: 1;
  margin: 0.75rem 0 0;
  line-height: 1.55;
}

.deployment-list {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.25rem;
}

.deployment-list.compact {
  margin-top: 0.75rem;
  color: var(--text-600);
  font-size: 0.8125rem;
  font-weight: 500;
}

.deployment-list code {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--border-200);
  border-radius: var(--radius-sm);
  background: var(--slate-50);
  color: var(--slate-700);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
  white-space: normal;
}

.deployment-detail-wide {
  grid-column: 1 / -1;
}

.compact-stats {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin: 1.5rem 0;
}

.small-stat {
  font-size: 1.35rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.deployment-log-box {
  margin-top: 1.5rem;
  padding: 1rem;
  border: 1px solid rgba(15, 23, 42, 0.22);
  border-radius: var(--radius-lg);
  background: #0f172a;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.55;
  max-height: 460px;
  overflow: auto;
  direction: ltr;
  text-align: left;
}

.deployment-log-line {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.muted-log {
  color: #94a3b8;
}

.compact-log {
  margin-top: 0.75rem;
  max-height: 220px;
  font-size: 0.75rem;
}

.deployment-center-page {
  padding-bottom: 380px;
}

.deployment-tabs-nav {
  margin-bottom: 1.5rem;
}

.operation-group {
  display: grid;
  gap: 0.9rem;
  margin-top: 1.5rem;
}

.operation-group:first-of-type {
  margin-top: 0;
}

.operation-group > h3 {
  margin: 0;
  color: var(--text-800);
  font-size: 1rem;
  font-weight: 700;
}

.operation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 1rem;
}

.operation-card {
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
  border: 1px solid var(--border-200);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.operation-card.disabled {
  background: var(--surface-50);
  opacity: 0.76;
}

.operation-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.operation-card h3 {
  margin: 0 0 0.35rem;
  color: var(--text-900);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.35;
}

.operation-card p {
  margin: 0;
  color: var(--text-600);
  font-size: 0.85rem;
  line-height: 1.55;
}

.operation-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  color: var(--text-600);
  font-size: 0.8125rem;
}

.operation-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.operation-form input {
  flex: 1 1 160px;
  min-width: 0;
}

.operation-form .button {
  min-height: 42px;
}

.deployment-sticky-log {
  position: fixed;
  bottom: 1rem;
  inset-inline-start: calc(260px + 2rem);
  inset-inline-end: 2rem;
  z-index: 45;
  margin-top: 0;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: var(--radius-lg);
  background: #0f172a;
  box-shadow: 0 24px 70px -32px rgba(15, 23, 42, 0.72), 0 0 0 1px rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  overflow: hidden;
}

.deployment-sticky-log summary {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
  cursor: pointer;
  list-style: none;
}

.deployment-sticky-log summary::-webkit-details-marker {
  display: none;
}

.sticky-log-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.sticky-log-title strong {
  color: #f8fafc;
}

.sticky-log-title span {
  color: #94a3b8;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

.sticky-log-toggle {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0.35rem 0.7rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: var(--radius-full);
  background: rgba(15, 23, 42, 0.62);
  color: #cbd5e1;
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
}

.deployment-sticky-log:not([open]) .when-open,
.deployment-sticky-log[open] .when-closed {
  display: none;
}

.sticky-log-body {
  padding: 0.6rem;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.sticky-log-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.sticky-log-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sticky-terminal-box {
  margin-top: 0.5rem;
  max-height: 280px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: var(--radius-md);
  background: #020617;
  box-shadow: none;
}

.readonly-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1.5rem;
}

@media (max-width: 760px) {
  .deployment-center-page {
    padding-bottom: 250px;
  }

  .deployment-sticky-log {
    inset-inline-start: 1rem;
    inset-inline-end: 1rem;
    bottom: 0.5rem;
    border-radius: var(--radius-md);
  }

  .deployment-sticky-log summary,
  .sticky-log-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .sticky-terminal-box {
    max-height: 220px;
  }
}

.readonly-actions .button {
  pointer-events: none;
}

.support-message {
  padding: 1rem;
  border: 1px solid var(--border-200);
  border-radius: var(--radius-lg);
  background: var(--surface-50);
}

.support-message.admin {
  background: #eef2ff;
  border-color: rgba(79, 70, 229, 0.2);
}

.support-message-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--text-500);
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.support-message-body {
  color: var(--text-900);
  line-height: 1.6;
}

.support-attachments {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  max-width: 100%;
}

.support-attachment {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: auto;
  min-width: 0;
  max-width: 100%;
  padding: 0.35rem;
  border: 1px solid rgba(79, 70, 229, 0.18);
  border-radius: 16px;
  background: #f8fafc;
  color: var(--primary-700);
  font-size: 0.8rem;
  overflow: hidden;
  text-decoration: none;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.support-attachment:hover {
  background: #f1f5ff;
  border-color: rgba(79, 70, 229, 0.34);
}

.support-attachment-status {
  flex: 0 0 auto;
  color: var(--warning-700);
  font-size: 0.7rem;
  font-weight: 600;
}

.support-attachment-preview {
  display: block;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  object-fit: cover;
  border: 0;
  border-radius: 12px;
  background: var(--slate-200);
}

.support-attachment-preview.video {
  flex-basis: 76px;
  width: 76px;
  height: 48px;
  background: var(--slate-900);
}

.support-attachment-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--slate-100);
  color: var(--primary-700);
}

.support-attachment-placeholder .nav-icon {
  width: 20px;
  height: 20px;
  flex-basis: 20px;
}

.support-ticket-row.unread {
  background: #f8fbff;
}

.support-unread-pill {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-inline-start: 0.4rem;
  padding: 0 0.45rem;
  border-radius: var(--radius-full);
  background: #dc2626;
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
}

.support-notes {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.support-note {
  padding: 0.85rem;
  border: 1px solid var(--border-200);
  border-radius: var(--radius-md);
  background: #fffbeb;
}

.support-note span {
  margin-inline-start: 0.5rem;
  color: var(--text-500);
  font-size: 0.8rem;
}

.support-note p {
  margin: 0.5rem 0 0;
  color: var(--text-800);
  line-height: 1.6;
}

.progress-value {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 150px;
}

.progress-cell {
  min-width: 170px;
}

.progress-track {
  position: relative;
  width: 112px;
  height: 8px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: var(--slate-100);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.04);
}

.progress-track span {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary-500), var(--success-500));
}

.full-detail {
  grid-column: 1 / -1;
}

.form-section-title {
  margin-top: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-200);
  color: var(--text-900);
  font-weight: 800;
}

.flash {
  margin-bottom: 1rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border-200);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-sm);
  color: var(--text-700);
  font-weight: 500;
}

.flash.success {
  border-color: var(--success-100);
  background: var(--success-50);
  color: var(--success-700);
}

.mt-3 {
  margin-top: 1rem;
}

.mb-3 {
  margin-bottom: 1rem;
}

.full-span {
  grid-column: 1 / -1;
}

.text-end {
  text-align: end;
}

.compact-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.compact-edit-form {
  margin-top: 1rem;
  border-top: 1px solid var(--border-200);
}

.checkbox-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 0.75rem;
}

.checkbox-line input {
  width: auto;
}

.checkbox-line .field-hint {
  grid-column: 2;
}

.vertical-actions {
  align-items: flex-start;
  flex-direction: column;
}

.restore-form {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
  max-width: 430px;
}

.restore-form input {
  min-width: 0;
}

.saas-invoice-shell {
  max-width: 21cm;
  margin: 1.5rem auto;
  background: white;
  box-shadow: var(--shadow-lg);
}

.saas-invoice-page {
  min-height: 29.7cm;
  padding: 2.5cm;
  background: white;
  color: #1e293b;
}

.saas-invoice-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #f1f5f9;
}

.saas-invoice-brand {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.saas-invoice-logo {
  width: 82px;
  height: 82px;
  object-fit: contain;
}

.saas-invoice-brand h1 {
  margin: 0;
  color: #0f172a;
  font-size: 1.7rem;
  font-weight: 800;
}

.saas-invoice-brand p {
  margin: 0.2rem 0 0;
  color: #64748b;
  font-size: 0.92rem;
}

.saas-invoice-doc {
  min-width: 180px;
  text-align: end;
}

.saas-invoice-title {
  color: var(--primary-600);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.saas-invoice-number {
  margin-top: 0.35rem;
  color: #0f172a;
  font-size: 1.2rem;
  font-weight: 700;
}

.saas-invoice-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.saas-invoice-info {
  padding: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.saas-invoice-info h3 {
  margin: 0 0 0.75rem;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.saas-invoice-info p {
  margin: 0.5rem 0 0;
  color: #475569;
  line-height: 1.7;
}

.saas-invoice-table {
  margin-top: 1rem;
  border-collapse: collapse;
  border: 1px solid #e2e8f0;
}

.saas-invoice-table th {
  position: static;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  color: #475569;
}

.saas-invoice-table td {
  border-bottom: 1px solid #e2e8f0;
  white-space: normal;
  text-align: start;
}

.saas-invoice-total-box {
  width: min(340px, 100%);
  margin: 2rem 0 0 auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}

.saas-invoice-total-box div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.saas-invoice-total-box div:last-child {
  border-bottom: 0;
  background: #f8fafc;
}

.saas-invoice-footer {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid #f1f5f9;
  color: #64748b;
  font-size: 0.9rem;
}

@media print {
  body {
    background: white;
  }

  .sidebar,
  .topbar,
  .no-print {
    display: none !important;
  }

  .app-shell,
  .content,
  .main {
    display: block;
    margin: 0;
    padding: 0;
    background: white;
  }

  .saas-invoice-shell {
    margin: 0;
    max-width: none;
    box-shadow: none;
  }

  .saas-invoice-page {
    min-height: auto;
    padding: 1.5cm;
  }
}

.flash.error {
  border-color: var(--error-100);
  background: var(--error-50);
  color: var(--error-600);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  padding: 1.5rem;
}

.readiness-grid,
.status-help-grid {
  display: grid;
  gap: 1rem;
  padding: 1.5rem;
}

.readiness-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.status-help-grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.status-note {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-height: 74px;
  padding: 1rem;
  border: 1px solid var(--border-200);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #fff 0%, var(--slate-50) 100%);
  color: var(--text-600);
}

.status-note span:last-child {
  padding-top: 0.25rem;
  line-height: 1.45;
}

.detail-item {
  display: grid;
  align-content: start;
  gap: 0.45rem;
  min-height: 86px;
  padding: 1rem;
  border: 1px solid var(--border-200);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #fff 0%, var(--slate-50) 100%);
}

.detail-label {
  color: var(--text-500);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.detail-value {
  color: var(--text-900);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.muted {
  color: var(--text-500);
  font-size: 0.875rem;
}

.muted-note {
  color: var(--text-500);
  font-size: 0.8125rem;
  font-weight: 500;
}

.audit-summary {
  max-width: 320px;
  color: var(--text-600);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.55;
  text-align: start;
  white-space: normal;
}

.empty-state {
  padding: 3.5rem 1.5rem;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.5), rgba(255, 255, 255, 0));
  color: var(--slate-500);
  text-align: center;
  white-space: normal;
}

.inline-form {
  display: inline-flex;
}

.plan-form {
  display: grid;
  grid-template-columns:
    minmax(150px, 0.85fr)
    minmax(320px, 2.25fr)
    minmax(120px, 0.7fr)
    minmax(120px, 0.7fr)
    minmax(150px, 0.75fr)
    minmax(120px, 0.65fr)
    minmax(130px, auto);
  gap: 1rem;
  align-items: end;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-200);
}

.plan-form > .button {
  min-height: 44px;
  align-self: end;
  white-space: nowrap;
}

.plan-form:last-child {
  border-bottom: 0;
}

.plan-card {
  border-bottom: 1px solid var(--border-200);
}

.plan-card:last-child {
  border-bottom: 0;
}

.compact-plan-form {
  border-bottom: 1px solid var(--border-100);
}

.feature-map-form {
  padding-bottom: 1.25rem;
}

.inline-panel-header {
  padding-top: 1rem;
  padding-bottom: 1rem;
  border-bottom: 0;
}

.feature-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
  padding: 0 1.5rem 1.25rem;
}

.check-row {
  min-height: 68px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem;
  border: 1px solid var(--border-200);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #fff 0%, var(--slate-50) 100%);
}

.check-row input {
  width: 18px;
  height: 18px;
  padding: 0;
}

.check-row strong,
.check-row small {
  display: block;
}

.check-row small {
  margin-top: 0.15rem;
  color: var(--text-500);
  font-size: 0.75rem;
  font-weight: 500;
}

.features-table input,
.features-table select {
  min-width: 160px;
}

code {
  display: inline-flex;
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-sm);
  background: var(--slate-100);
  color: var(--slate-700);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

html[dir="rtl"],
html[dir="rtl"] body {
  direction: rtl;
}

html[dir="rtl"] .sidebar {
  border-inline-end: 0;
  border-inline-start: 1px solid var(--border-200);
}

html[dir="rtl"] .nav::before,
html[dir="rtl"] .nav a,
html[dir="rtl"] .logout-button,
html[dir="rtl"] .topbar,
html[dir="rtl"] .page-head,
html[dir="rtl"] label,
html[dir="rtl"] .detail-label,
html[dir="rtl"] .detail-value {
  text-align: right;
}

html[dir="rtl"] .nav::before,
html[dir="rtl"] th,
html[dir="rtl"] .detail-label {
  letter-spacing: 0;
  text-transform: none;
}

html[dir="rtl"] .nav a:hover,
html[dir="rtl"] .logout-button:hover {
  transform: translateX(-1px);
}

html[dir="rtl"] input:not([type="number"]):not([type="date"]),
html[dir="rtl"] textarea,
html[dir="rtl"] select {
  text-align: right;
}

html[dir="rtl"] select {
  background-position: left 0.75rem center;
  padding-inline-start: 2.5rem;
  padding-inline-end: 1rem;
}

html[dir="rtl"] .actions,
html[dir="rtl"] .form-actions {
  direction: rtl;
}

html[dir="rtl"] .topbar-actions {
  direction: rtl;
  justify-content: flex-start;
}

html[dir="rtl"] .admin-lang-switch {
  direction: rtl;
}

@media (min-width: 1025px) {
  th {
    padding: 1.25rem 1.75rem;
    font-size: 0.8125rem;
  }

  td {
    padding: 1.5rem 1.75rem;
  }
}

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

  .plan-form > .button {
    grid-column: 1 / -1;
    justify-self: end;
    max-width: 220px;
    width: 100%;
  }
}

@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-inline-end: 0;
    border-bottom: 1px solid var(--border-200);
  }

  .sidebar .brand-mark {
    min-height: auto;
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    padding: 0.75rem 1rem 1rem;
    overflow: visible;
  }

  .nav::before {
    display: none;
  }

  .nav form {
    margin: 0;
    padding: 0;
    border-top: 0;
  }

  .topbar,
  .main {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .topbar-actions {
    flex-wrap: wrap;
  }

  .stats-grid,
  .detail-grid,
  .readiness-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .plan-form {
    grid-template-columns: 1fr;
  }

  .feature-check-grid {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 900px;
  }
}

@media (max-width: 768px) {
  .login-panel {
    padding: 2rem;
  }

  .brand-logo {
    height: 52px;
  }

  .login-panel .brand-logo {
    height: 88px;
  }

  .page-head,
  .topbar {
    align-items: stretch;
    flex-direction: column;
    height: auto;
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .admin-lang-switch,
  .user-chip,
  .topbar-logout-form,
  .topbar-logout-button {
    width: 100%;
  }

  .admin-lang-switch,
  .user-chip,
  .topbar-logout-button {
    justify-content: center;
  }

  .page-title {
    font-size: 1.5rem;
  }

  .button,
  button.button,
  input,
  select {
    min-height: 44px;
  }

  .form-actions,
  .actions {
    justify-content: stretch;
  }

  .button:not(.icon-button),
  .inline-form {
    width: 100%;
  }

  .inline-form .button:not(.icon-button) {
    width: 100%;
  }

  .actions {
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .actions .inline-form,
  .actions .button.icon-button {
    width: auto;
    flex: 0 0 auto;
  }

  .nav {
    grid-template-columns: 1fr 1fr;
  }
}
