:root {
  --page: #ffffff;
  --text: #111827;
  --muted: #64748b;
  --border: #e5e7eb;
  --border-strong: #cbd5e1;
  --soft: #f8fafc;
  --brand: #1e3a8a;
  --brand-dark: #0f172a;
  --dark: #020c0c;
  --cyan: #00f5df;
  --line: #006a62;
  --jarvis-text: #bffff9;
  --orange: #ff7a38;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--page) !important;
  color: var(--text);
  font-family: "Segoe UI", Inter, system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  font-size: 15px;
}

body {
  overflow-x: hidden;
}

.site-shell {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 14px 24px 18px;
  background: #ffffff;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  min-height: 52px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.site-eyebrow {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.site-header h1 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: clamp(30px, 4vw, 46px);
  letter-spacing: 0;
}

.site-user {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #475569;
  font-weight: 700;
}

.site-user a,
.top-actions a {
  position: relative;
  color: var(--text);
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 9px 13px;
  text-decoration: none;
  background: #ffffff;
}

.admin-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #dc2626;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  padding: 0 7px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 0 12px;
  border-bottom: 1px solid #eef2f7;
}

button,
.nav-tab {
  font: inherit;
}

.nav-tab {
  min-width: 144px;
  border: 1px solid color-mix(in srgb, var(--nav-color, #cbd5e1) 34%, #cbd5e1);
  border-radius: 10px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--nav-color, #ffffff) 13%, #ffffff), #ffffff 54%),
    linear-gradient(180deg, #ffffff, #f8fafc);
  color: var(--nav-color, #334155);
  padding: 13px 20px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .01em;
  text-align: center;
  cursor: pointer;
  box-shadow:
    inset 0 4px 0 var(--nav-color, #cbd5e1),
    0 10px 22px color-mix(in srgb, var(--nav-color, #0f172a) 12%, transparent);
  transition: transform .15s ease, background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.nav-tab.active {
  background:
    radial-gradient(circle at 18% 20%, rgba(255,255,255,.22), transparent 24%),
    linear-gradient(135deg, var(--nav-color, var(--brand-dark)), var(--nav-dark, var(--brand-dark)));
  color: #ffffff;
  border-color: var(--nav-dark, var(--brand-dark));
  box-shadow: 0 14px 30px var(--nav-shadow, rgba(15, 23, 42, .18));
}

.nav-tab:hover {
  border-color: var(--nav-color, #64748b);
  transform: translateY(-1px);
  box-shadow:
    inset 0 4px 0 var(--nav-color, #64748b),
    0 14px 28px color-mix(in srgb, var(--nav-color, #0f172a) 18%, transparent);
}

.nav-home {
  --nav-color: #2563eb;
  --nav-dark: #1d4ed8;
  --nav-shadow: rgba(37, 99, 235, .26);
}

.nav-jarvis {
  --nav-color: #0891b2;
  --nav-dark: #0f766e;
  --nav-shadow: rgba(8, 145, 178, .26);
}

.nav-adem {
  --nav-color: #7c3aed;
  --nav-dark: #0f172a;
  --nav-shadow: rgba(124, 58, 237, .24);
}

.site-page {
  display: none !important;
  padding-top: 0;
}

.site-page.active {
  display: block !important;
}

.empty-access {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  padding: 28px;
  box-shadow: 0 14px 40px rgba(15, 23, 42, .06);
}

.empty-access h2 {
  margin: 0 0 8px;
}

.empty-access p {
  margin: 0;
  color: var(--muted);
}

.embed-card {
  min-height: calc(100vh - 180px);
  background: #ffffff;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
}

.embed-card-head {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
}

.embed-card-head span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.embed-card-head h2 {
  margin: 4px 0 0;
  color: var(--text);
}

.embed-card-head strong {
  color: #16a34a;
  font-size: 13px;
}

.embed-frame {
  display: block;
  width: 100%;
  border: 0;
  background: #ffffff;
}

.home-frame {
  height: calc(100vh - 104px);
  min-height: 760px;
}

.operations-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.operations-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: #ffffff;
  border: 0;
  border-radius: 0;
  padding: 0 0 16px;
  box-shadow: none;
}

.operations-menu h2 {
  flex: 0 0 100%;
  margin: 0 0 2px;
  color: #1e293b;
  font-size: 16px;
  font-weight: 750;
  letter-spacing: .01em;
}

.operation-btn {
  flex: 0 0 auto;
  min-width: 150px;
  border: 1px solid color-mix(in srgb, var(--module-color, #cbd5e1) 34%, #cbd5e1);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, color-mix(in srgb, var(--module-color, #f8fafc) 7%, #f8fafc));
  color: color-mix(in srgb, var(--module-color, #334155) 70%, #0f172a);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: .005em;
  padding: 10px 14px;
  text-align: center;
  box-shadow: inset 0 3px 0 var(--module-color, #cbd5e1), 0 1px 2px rgba(15, 23, 42, .04);
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.operation-btn.active,
.operation-btn:hover {
  background: linear-gradient(135deg, var(--module-color, var(--brand-dark)), var(--module-dark, var(--brand-dark)));
  border-color: var(--module-dark, var(--brand-dark));
  color: #ffffff;
  box-shadow: 0 10px 22px var(--module-shadow, rgba(15, 23, 42, .14));
}

.mod-proforma { --module-color: #2563eb; --module-dark: #1d4ed8; --module-shadow: rgba(37, 99, 235, .18); }
.mod-dashboard { --module-color: #0f766e; --module-dark: #115e59; --module-shadow: rgba(15, 118, 110, .18); }
.mod-deger { --module-color: #7c3aed; --module-dark: #5b21b6; --module-shadow: rgba(124, 58, 237, .18); }
.mod-depo { --module-color: #059669; --module-dark: #047857; --module-shadow: rgba(5, 150, 105, .18); }
.mod-turkiye { --module-color: #0891b2; --module-dark: #0e7490; --module-shadow: rgba(8, 145, 178, .18); }
.mod-borsa { --module-color: #d97706; --module-dark: #b45309; --module-shadow: rgba(217, 119, 6, .18); }
.mod-aktif { --module-color: #16a34a; --module-dark: #15803d; --module-shadow: rgba(22, 163, 74, .18); }
.mod-harita { --module-color: #0ea5e9; --module-dark: #0369a1; --module-shadow: rgba(14, 165, 233, .18); }
.mod-bakim { --module-color: #334155; --module-dark: #0f172a; --module-shadow: rgba(51, 65, 85, .18); }

.operation-frame-wrap {
  min-width: 0;
  background: #ffffff;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
}

.operation-frame {
  height: calc(100vh - 190px);
  min-height: 820px;
}

.auto-destek-only .site-shell {
  padding: 0;
}

.auto-destek-only .site-header,
.auto-destek-only .site-nav,
.auto-destek-only .operations-menu {
  display: none !important;
}

.auto-destek-only .operation-frame {
  height: 100vh;
  min-height: 100vh;
}

.auto-destek-only .operation-frame-wrap {
  min-height: 100vh;
}

.hidden-status,
[hidden] {
  display: none !important;
}

/* Login */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #f8fafc !important;
}

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

.wide-login {
  width: min(1040px, calc(100% - 32px));
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.login-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .08);
}

.login-card .eyebrow,
.auth-form label,
.auth-note {
  color: var(--muted);
}

.login-card h1,
.login-card h2 {
  color: var(--text);
  letter-spacing: 0;
}

.auth-form {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.auth-form input {
  background: #ffffff;
  border: 1px solid #d1d5db;
  color: var(--text);
  border-radius: 8px;
  padding: 13px;
  outline: none;
}

.auth-form button {
  border-radius: 8px;
  border: 1px solid #111827;
  background: #111827;
  color: #ffffff;
  padding: 13px;
  font-weight: 800;
  cursor: pointer;
}

.auth-error {
  border: 1px solid #ff3344;
  color: #991b1b;
  background: #fff1f2;
  padding: 10px;
  margin-top: 12px;
  border-radius: 8px;
}

.auth-success {
  border: 1px solid #16a34a;
  color: #166534;
  background: #f0fdf4;
  padding: 10px;
  margin-top: 12px;
  border-radius: 8px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding-top: 24px;
}

.admin-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 14px 40px rgba(15, 23, 42, .06);
}

.admin-card h2 {
  margin: 0 0 14px;
  color: var(--text);
}

.user-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border-top: 1px solid var(--border);
  padding: 14px 0;
}

.user-row strong,
.user-row span {
  display: block;
}

.user-row span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.user-row form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-row button {
  border: 1px solid #111827;
  background: #111827;
  color: #ffffff;
  border-radius: 8px;
  padding: 9px 12px;
  font-weight: 800;
  cursor: pointer;
}

.user-row button.danger {
  border-color: #dc2626;
  background: #dc2626;
}

.permission-admin {
  grid-template-columns: minmax(0, 1fr);
}

.admin-notice {
  margin: 0;
}

.permission-row {
  display: block !important;
  align-items: stretch;
  flex-direction: column;
  border-top: 1px solid var(--border);
  padding: 18px 0 22px;
}

.user-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.permission-form {
  display: grid !important;
  grid-template-columns: 240px minmax(520px, 1fr) 280px 190px;
  align-items: stretch !important;
  gap: 16px !important;
  justify-content: start !important;
  justify-items: stretch !important;
  align-self: stretch !important;
  width: 100%;
  max-width: none;
  margin-top: 16px;
  margin-left: 0;
  margin-right: 0;
}

.permission-block {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  padding: 14px;
  min-width: 0;
  width: 100%;
}

.permission-block h3 {
  margin: 0 0 10px;
  color: #0f172a;
  font-size: 14px;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
}

.permission-grid.modules {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.permission-check {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  color: #0f172a;
  font-weight: 750;
  padding: 10px 12px;
  cursor: pointer;
}

.permission-check input {
  width: 16px;
  height: 16px;
  accent-color: #111827;
}

.permission-actions {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 8px;
  justify-content: stretch;
  min-width: 170px;
  width: 100%;
}

.permission-actions button {
  min-height: 46px;
  width: 100%;
}

.password-block {
  display: grid;
  align-content: start;
  gap: 9px;
}

.password-block p,
.password-block small {
  margin: 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.4;
}

.password-block input {
  min-height: 40px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  color: #0f172a;
  padding: 9px 11px;
}

.password-block button.secondary {
  min-height: 40px;
  border: 1px solid #2563eb;
  border-radius: 9px;
  background: #2563eb;
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
}

@media (max-width: 1180px) {
  .permission-form {
    grid-template-columns: 1fr;
  }

  .permission-actions {
    flex-direction: row;
  }
}

/* Jarvis panel only */
.jarvis-workspace {
  min-height: 690px;
  background:
    radial-gradient(circle at center, rgba(0, 245, 223, .08), transparent 42%),
    linear-gradient(135deg, rgba(0, 245, 223, .04) 25%, transparent 25%) 0 0 / 34px 34px,
    var(--dark);
  border: 1px solid var(--line);
  color: var(--jarvis-text);
  padding: 16px;
}

.jarvis-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid rgba(0,245,223,.20);
  margin-bottom: 14px;
  padding-bottom: 12px;
}

.jarvis-head span {
  display: block;
  color: #5a9b96;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .18em;
}

.jarvis-head h2,
.panel-title h2 {
  margin: 4px 0 0;
  color: var(--cyan);
  letter-spacing: .08em;
}

.jarvis-head strong,
.panel-title span {
  color: #00ff88;
  font-size: 13px;
}

.jarvis-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(300px, 420px);
  gap: 14px;
}

.core {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 600px;
  border: 1px solid rgba(0, 245, 223, .25);
  background: radial-gradient(circle, rgba(0, 245, 223, .06), transparent 60%);
}

.orb {
  position: relative;
  width: min(58vh, 560px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.ring {
  position: absolute;
  inset: 4%;
  border: 2px solid rgba(0, 245, 223, .42);
  border-radius: 50%;
  animation: spin 16s linear infinite;
}

.ring-2 { inset: 11%; border-color: rgba(77,145,255,.35); animation-duration: 10s; animation-direction: reverse; }
.ring-3 { inset: 19%; border-color: rgba(0,255,136,.22); animation-duration: 7s; }
.ring-4 { inset: 28%; border-color: rgba(0,245,223,.16); animation-duration: 24s; border-style: dashed; }

.orb::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 45px rgba(0, 245, 223, .22), inset 0 0 70px rgba(0, 245, 223, .08);
}

.orb::after {
  content: "";
  position: absolute;
  inset: 15%;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 18deg, rgba(0,245,223,.35) 18deg 24deg, transparent 24deg 75deg, rgba(77,145,255,.30) 75deg 80deg, transparent 80deg 360deg);
  opacity: .65;
  animation: spin 8s linear infinite;
}

.orb-grid {
  position: absolute;
  inset: 24%;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(0,245,223,.08), transparent 62%),
    linear-gradient(rgba(0,245,223,.08) 1px, transparent 1px) 0 0 / 26px 26px,
    linear-gradient(90deg, rgba(0,245,223,.08) 1px, transparent 1px) 0 0 / 26px 26px;
  box-shadow: inset 0 0 90px rgba(0,0,0,.65);
}

.orb-core {
  position: absolute;
  width: 22%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(0,245,223,.20);
  background: radial-gradient(circle, rgba(0,245,223,.08), rgba(0,0,0,.08) 45%, transparent 72%);
}

.orb-dots { display: none; }

.controls {
  position: absolute;
  bottom: 22px;
  display: flex;
  gap: 16px;
}

.controls button,
.command button {
  background: linear-gradient(90deg, rgba(0,245,223,.08), rgba(0,245,223,.38), rgba(0,245,223,.08));
  border: 1px solid var(--cyan);
  color: var(--jarvis-text);
  padding: 12px 22px;
  font-weight: 800;
  cursor: pointer;
}

#stopBtn { border-color: var(--orange); color: #ffd4bf; }

.panel {
  background: rgba(2, 22, 24, .86);
  border: 1px solid var(--line);
  padding: 14px;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat {
  height: 478px;
  overflow: auto;
  border: 1px solid rgba(0,245,223,.22);
  padding: 12px;
  background: rgba(0,0,0,.18);
  white-space: pre-wrap;
}

.line { margin-bottom: 14px; line-height: 1.45; }
.line b { color: var(--cyan); }
.line.err b { color: #ff6673; }

.command {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.command input {
  flex: 1;
  background: rgba(0,0,0,.24);
  border: 1px solid var(--line);
  color: var(--jarvis-text);
  padding: 12px;
  outline: none;
}

.speaking .orb { animation: orbPulse .5s ease-in-out infinite; }
.listening .orb::before { box-shadow: 0 0 55px rgba(0,255,136,.25), inset 0 0 70px rgba(0,255,136,.08); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes orbPulse { 50% { transform: scale(1.025); filter: brightness(1.18); } }

@media (max-width: 900px) {
  .site-shell { padding: 16px; }
  .site-header { align-items: flex-start; flex-direction: column; }
  .jarvis-grid { grid-template-columns: 1fr; }
  .wide-login,
  .admin-layout,
  .operations-layout { grid-template-columns: 1fr; }
  .core { min-height: 460px; }
  .chat { height: 320px; }
  .site-nav { overflow-x: auto; }
  .operations-menu { position: static; }
}
