/* ==========================================================================
   Mekanim Stylesheet (design tokens + admin layout, both carried over from
   the Erikli Pide admin panel design system)
   ========================================================================== */

/* Design Tokens & Theme Variables — carried over exactly from Erikli Pide's
   admin panel (style.css :root + admin.css's additions), light theme only.
   Mekanim previously ran its own dark Google-Material palette; per explicit
   instruction the interface must now match Erikli Pide's admin panel with
   no exceptions, so that palette is gone. */
:root {
  color-scheme: light;
  --brand-navy: #1f345d;
  --brand-navy-light: #2c477d;
  --brand-gold: #d4af37;
  --brand-gold-light: #f3cf65;
  --brand-gold-dark: #b8860b;
  --success-color: #2e7d32;
  --success-bg: rgba(46, 125, 50, 0.1);

  --font-sans: 'Plus Jakarta Sans', sans-serif;

  --radius-sm: 8px;

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

  --bg-primary: #fbfbf9;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f3f3f0;
  --sidebar-bg: #ffffff;
  --box-bg: #ffffff;
  --text-primary: #1f345d;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --border-color: rgba(31, 52, 93, 0.08);
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.4);
  --scrollbar-thumb: rgba(31, 52, 93, 0.2);
  --scrollbar-track: rgba(31, 52, 93, 0.05);
  --card-hover-border: rgba(212, 175, 55, 0.4);
  --on-brand: #ffffff;
  --hover-tertiary: #f3f3f0;
  --hover-icon: rgba(31, 52, 93, 0.05);
  --status-active: #2e7d32;
  --status-pending: #e3a008;
  --toast-bg: #1f345d;
  --toast-success-bg: #2e7d32;
  --toast-error-bg: #c62828;

  --overlay-navy-xxs: rgba(31, 52, 93, 0.01);
  --overlay-navy-xs: rgba(31, 52, 93, 0.035);
  --overlay-navy-sm: rgba(31, 52, 93, 0.12);
  --overlay-navy-md: rgba(31, 52, 93, 0.25);
  --overlay-navy-lg: rgba(31, 52, 93, 0.4);
  --overlay-danger-xs: rgba(198, 40, 40, 0.05);
  --overlay-danger-sm: rgba(198, 40, 40, 0.12);
  --overlay-danger-border: rgba(198, 40, 40, 0.25);
  --overlay-success-xs: rgba(46, 125, 50, 0.08);
  --overlay-success-sm: rgba(46, 125, 50, 0.12);
  --overlay-success-border: rgba(46, 125, 50, 0.25);
  --overlay-white-xs: rgba(255, 255, 255, 0.08);
  --overlay-white-lg: rgba(255, 255, 255, 0.55);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* Safety net: no input/select/textarea/button may ever show a border or
   focus outline, in any state, including ones added later. Do not rely on
   per-component :focus rules alone for this — this catch-all is why. */
input, select, textarea, button,
input:focus, select:focus, textarea:focus, button:focus,
input:hover, select:hover, textarea:hover, button:hover,
input:active, select:active, textarea:active, button:active {
  border: none;
  outline: none;
  box-shadow: none;
}

html {
  touch-action: manipulation;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* old Edge/IE */
  overscroll-behavior-y: none;
}

body {
  overscroll-behavior-y: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
*::-webkit-scrollbar {
  display: none; /* Chrome/Safari/Edge */
  width: 0;
  height: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* Browsers default <pre>/<code> to a monospace UA stylesheet — Mekanim never
   wants that look (proje durumu JSON, Firebase Proje ID, Belge ID, UID vb.
   hepsi normal metin fontuyla görünür), so it's overridden globally here
   instead of per-element. */
pre, code {
  font-family: var(--font-sans);
}

/* Admin layout constants (on top of the base tokens above) */
:root {
  --admin-sidebar-width: 260px;
  --assistant-panel-width: 260px;
  --danger-color: #c62828;
  --danger-hover: #b71c1c;
}

/* ==========================================================================
   Dark Mode — full token overrides, same names, dark values. Every color in
   this file is a var(--...) (see CLAUDE.md rule 1), so switching theme is
   entirely a matter of redefining these on :root; no component rule below
   ever needs to know which theme is active.

   Two triggers, same values, applied in both directions per the standard
   guarded pattern:
   - No explicit choice saved yet: follows the OS/browser's own
     prefers-color-scheme (guarded with :not([data-theme="light"]) so an
     explicit "light" choice can still win over a dark OS preference).
   - Explicit choice saved (Ayarlar → Renk Paleti): :root[data-theme="dark"]
     wins regardless of OS preference, in either direction.
   ========================================================================== */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --brand-navy: #a9c2f5;
    --brand-navy-light: #c3d6fa;
    --brand-gold: #e8c766;
    --brand-gold-light: #f3d98a;
    --brand-gold-dark: #c9971f;
    --success-color: #4caf50;
    --success-bg: rgba(76, 175, 80, 0.15);

    --bg-primary: #12161f;
    --bg-secondary: #161b28;
    --bg-tertiary: #232a3d;
    --sidebar-bg: #161b28;
    --box-bg: #161b28;
    --text-primary: #e8ecf5;
    --text-secondary: #a8b3c9;
    --text-muted: #6b7690;
    --border-color: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(26, 32, 48, 0.85);
    --glass-border: rgba(255, 255, 255, 0.12);
    --scrollbar-thumb: rgba(255, 255, 255, 0.2);
    --scrollbar-track: rgba(255, 255, 255, 0.05);
    --card-hover-border: rgba(232, 199, 102, 0.4);
    --on-brand: #0f1a33;
    --hover-tertiary: #232a3d;
    --hover-icon: rgba(255, 255, 255, 0.06);
    --status-active: #4caf50;
    --status-pending: #f2b705;
    --toast-bg: #a9c2f5;
    --toast-success-bg: #4caf50;
    --toast-error-bg: #ef5350;

    --overlay-navy-xxs: rgba(255, 255, 255, 0.02);
    --overlay-navy-xs: rgba(255, 255, 255, 0.06);
    --overlay-navy-sm: rgba(255, 255, 255, 0.12);
    --overlay-navy-md: rgba(255, 255, 255, 0.15);
    --overlay-navy-lg: rgba(0, 0, 0, 0.6);
    --overlay-danger-xs: rgba(239, 83, 80, 0.12);
    --overlay-danger-sm: rgba(239, 83, 80, 0.2);
    --overlay-danger-border: rgba(239, 83, 80, 0.35);
    --overlay-success-xs: rgba(76, 175, 80, 0.15);
    --overlay-success-sm: rgba(76, 175, 80, 0.22);
    --overlay-success-border: rgba(76, 175, 80, 0.35);
    --overlay-white-xs: rgba(255, 255, 255, 0.08);
    --overlay-white-lg: rgba(20, 25, 38, 0.75);

    --danger-color: #ef5350;
    --danger-hover: #e53935;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --brand-navy: #a9c2f5;
  --brand-navy-light: #c3d6fa;
  --brand-gold: #e8c766;
  --brand-gold-light: #f3d98a;
  --brand-gold-dark: #c9971f;
  --success-color: #4caf50;
  --success-bg: rgba(76, 175, 80, 0.15);

  --bg-primary: #12161f;
  --bg-secondary: #161b28;
  --bg-tertiary: #232a3d;
  --sidebar-bg: #161b28;
  --box-bg: #161b28;
  --text-primary: #e8ecf5;
  --text-secondary: #a8b3c9;
  --text-muted: #6b7690;
  --border-color: rgba(255, 255, 255, 0.08);
  --glass-bg: rgba(26, 32, 48, 0.85);
  --glass-border: rgba(255, 255, 255, 0.12);
  --scrollbar-thumb: rgba(255, 255, 255, 0.2);
  --scrollbar-track: rgba(255, 255, 255, 0.05);
  --card-hover-border: rgba(232, 199, 102, 0.4);
  --on-brand: #0f1a33;
  --hover-tertiary: #232a3d;
  --hover-icon: rgba(255, 255, 255, 0.06);
  --status-active: #4caf50;
  --status-pending: #f2b705;
  --toast-bg: #a9c2f5;
  --toast-success-bg: #4caf50;
  --toast-error-bg: #ef5350;

  --overlay-navy-xxs: rgba(255, 255, 255, 0.02);
  --overlay-navy-xs: rgba(255, 255, 255, 0.06);
  --overlay-navy-sm: rgba(255, 255, 255, 0.12);
  --overlay-navy-md: rgba(255, 255, 255, 0.15);
  --overlay-navy-lg: rgba(0, 0, 0, 0.6);
  --overlay-danger-xs: rgba(239, 83, 80, 0.12);
  --overlay-danger-sm: rgba(239, 83, 80, 0.2);
  --overlay-danger-border: rgba(239, 83, 80, 0.35);
  --overlay-success-xs: rgba(76, 175, 80, 0.15);
  --overlay-success-sm: rgba(76, 175, 80, 0.22);
  --overlay-success-border: rgba(76, 175, 80, 0.35);
  --overlay-white-xs: rgba(255, 255, 255, 0.08);
  --overlay-white-lg: rgba(20, 25, 38, 0.75);

  --danger-color: #ef5350;
  --danger-hover: #e53935;
}

/* Mekanim wordmark is a flat SVG with a hardcoded navy fill (brand asset,
   not a CSS color — can't be a var() token) — on a dark navy background it'd
   be nearly invisible, so it's flipped to white via filter instead. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .login-logo,
  :root:not([data-theme="light"]) .mobile-header-logo {
    filter: brightness(0) invert(1);
  }
}
:root[data-theme="dark"] .login-logo,
:root[data-theme="dark"] .mobile-header-logo {
  filter: brightness(0) invert(1);
}

/* Select dropdown ok işareti bir data-URI SVG (background-image) — inline
   stroke rengi var() kabul etmiyor, o yüzden koyu modda ayrı bir data-URI
   (aynı ok, ana metin rengiyle) ile değiştiriliyor. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .form-group select,
  :root:not([data-theme="light"]) .inline-form-row select,
  :root:not([data-theme="light"]) .apps-filter-bar select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23E8ECF5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  }
}
:root[data-theme="dark"] .form-group select,
:root[data-theme="dark"] .inline-form-row select,
:root[data-theme="dark"] .apps-filter-bar select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23E8ECF5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

/* Enable visibility of Admin app elements since FOUC handles body hiding */
html {
  visibility: visible !important;
  opacity: 1 !important;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex !important; /* Overrides style.css */
  flex-direction: column;
  background-color: var(--bg-primary);
  font-family: var(--font-sans);
  color: var(--text-primary);
}

.hidden {
  display: none !important;
}

/* --- Login Overlay --- */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: transparent;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 20px;
  z-index: 9999;
  padding: 20px;
}

.login-logo {
  height: 30.6px;
  width: auto;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-align: center;
}

.google-login-icon-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all var(--transition-fast);
}

.google-login-icon-btn:hover {
  background-color: var(--overlay-white-xs);
}

.google-login-icon-btn img {
  width: 32px;
  height: 32px;
}

.login-overlay.hidden {
  display: none !important;
}

/* --- Admin Core Layout --- */
.admin-app {
  display: flex;
  min-height: 100vh;
  width: 100%;
  position: relative;
  z-index: 1;
}

.admin-app.hidden {
  display: none !important;
}

/* --- Sidebar Style --- */
.admin-sidebar {
  width: var(--admin-sidebar-width);
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  transition: transform var(--transition-normal);
}

/* İstisna: sidebar linkleri 20px kuralına tabi değil, bilinçli olarak 12px
   — bkz. CLAUDE.md "Spacing İstisnaları". */
.sidebar-menu {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-grow: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background-color: var(--overlay-navy-xs);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.sidebar-link svg {
  color: var(--brand-navy);
  opacity: 0.7;
  transition: all var(--transition-fast);
}

.sidebar-link:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.sidebar-link:hover svg {
  opacity: 1;
}

.sidebar-link.active {
  background-color: var(--brand-navy);
  color: var(--on-brand);
}

.sidebar-link.active svg {
  color: var(--on-brand);
  opacity: 1;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--border-color);
}

/* Saat/tarih widget'ı — kullanıcı adının 20px üzerinde kendi böleni var
   (sidebar-footer'ın üst kenarındaki bölenle aynı stil), o bölenin de 20px
   üzerinde flip-clock duruyor. */
.sidebar-clock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-clock-time {
  display: flex;
  align-items: center;
  gap: 4px;
}

.flip-group {
  display: flex;
  gap: 2px;
}

.flip-digit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 40px;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 22px;
  border-radius: var(--radius-sm);
  perspective: 60px;
}

@keyframes flip-digit-anim {
  0% { transform: rotateX(0deg); }
  50% { transform: rotateX(-90deg); opacity: 0.6; }
  100% { transform: rotateX(0deg); opacity: 1; }
}

.flip-digit.flipping {
  animation: flip-digit-anim 0.4s ease;
}

.flip-colon {
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 22px;
  padding: 0 2px;
}

.sidebar-clock-date {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-align: center;
}

.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--danger-color);
  padding: 12px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.logout-btn:hover {
  background-color: var(--overlay-danger-xs);
  border-color: var(--danger-color);
}

/* --- Main Layout Panel --- */
.admin-main-content {
  flex-grow: 1;
  margin-left: var(--admin-sidebar-width);
  margin-right: var(--assistant-panel-width);
  padding: 20px; /* 20px on Mobile/Tablet */
  background-color: var(--bg-primary);
  min-height: 100vh;
  position: relative;
}



/* --- Asistan (sağ panel, sidebar ile aynı genişlik) --- */
.assistant-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--assistant-panel-width);
  height: 100vh;
  background-color: var(--sidebar-bg);
  border-left: 1px solid var(--border-color);
  z-index: 100;
  flex-direction: column;
  overflow: hidden;
}

.assistant-panel-resize-handle {
  position: absolute;
  top: 0;
  left: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 101;
  background: transparent;
}

.assistant-panel-resize-handle:hover,
.assistant-panel-resize-handle.dragging {
  background-color: var(--brand-navy);
  opacity: 0.3;
}

body.assistant-panel-resizing {
  cursor: col-resize;
  user-select: none;
}

.assistant-panel-header {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.assistant-panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.assistant-panel-title {
  font-size: 1.1rem;
  margin: 0;
}

.assistant-panel-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.assistant-input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.assistant-input-row textarea {
  flex: 1;
  min-width: 0;
}

.assistant-send-icon-btn {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background-color: var(--brand-navy);
  color: var(--on-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.assistant-send-icon-btn:hover {
  opacity: 0.85;
}

.assistant-send-icon-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.assistant-panel-composer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border-top: 1px solid var(--border-color);
  background-color: var(--sidebar-bg);
}

.admin-mobile-header {
  display: none;
}

.admin-tab-content.hidden {
  display: none !important;
}

.tab-header {
  margin-bottom: 20px;
}



.tab-header h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--brand-navy);
  margin-bottom: 4px;
}

.tab-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.title-with-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-icon-wrap {
  position: relative;
  display: inline-flex;
}

.info-icon-btn {
  width: 22px;
  height: 22px;
  border: none;
  background-color: transparent;
  color: var(--on-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all var(--transition-fast);
}

.info-icon-btn:hover {
  color: var(--brand-gold);
}

.info-popup {
  position: absolute;
  top: 130%;
  left: 0;
  min-width: 240px;
  max-width: 340px;
  background-color: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.4;
  color: var(--text-primary);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  z-index: 50;
  pointer-events: none;
}

.info-icon-wrap:hover .info-popup,
.info-icon-wrap.open .info-popup {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.flex-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.flex-header h1 {
  margin-bottom: 0;
}


/* --- Dashboard Section --- */
#tab-dashboard {
  position: relative;
  min-height: calc(100vh - 40px);
}

#tab-dashboard > .tab-header {
  position: relative;
  z-index: 2;
}

/* --- Cards and Tables --- */
.admin-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  padding: 0;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.admin-table th {
  background-color: var(--bg-tertiary);
  color: var(--brand-navy);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--brand-navy);
  vertical-align: middle;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table tr:hover {
  background-color: var(--overlay-navy-xxs);
}

.admin-table td a {
  color: var(--text-primary);
  text-decoration: none;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

.status-dot--danger {
  background-color: var(--danger-color);
}

.status-dot--warn {
  background-color: var(--status-pending);
}

.status-dot--active {
  background-color: var(--status-active);
}

.admin-table td a:hover {
  opacity: 0.8;
}


/* Actions Row Buttons */
.actions-cell-flex {
  display: flex;
  justify-content: flex-start;
  gap: 20px;
}

a.text-link-btn {
  color: var(--brand-navy) !important;
  text-decoration: none;
  cursor: pointer;
}

a.text-link-btn:hover {
  opacity: 0.8;
}

/* Any data value the user can click to copy — no underline, ever, but
   still visibly interactive via cursor + a subtle hover fade. Applies
   app-wide (see data-copy attributes throughout app.js). */
.copyable {
  cursor: pointer;
  text-decoration: none;
}

.copyable:hover {
  opacity: 0.75;
}

.btn-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm); /* 8px */
  border: 1px solid var(--border-color);
  background-color: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-icon:hover {
  background-color: var(--overlay-navy-xs);
  border-color: var(--text-primary);
  color: var(--text-primary);
}

.btn-icon.btn-toggle-on {
  color: var(--success-color);
  background-color: var(--overlay-success-xs);
  border-color: transparent;
}

.btn-icon.btn-toggle-off {
  color: var(--text-muted);
  background-color: var(--overlay-navy-xs);
  border-color: transparent;
}

/* Ensure all buttons in admin panel match input height (42px) */
.btn {
  height: 42px;
  box-sizing: border-box;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  border-radius: var(--radius-sm) !important; /* Matches input rounded corners */
  text-decoration: none !important;
}

/* Custom button overrides matching homepage category chips */
.btn-primary {
  background-color: var(--brand-navy) !important;
  color: var(--on-brand) !important;
  border: 1px solid transparent !important;
  font-weight: 600 !important;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--brand-navy-light) !important;
  color: var(--on-brand) !important;
}

.btn-secondary {
  background-color: var(--overlay-navy-xs) !important;
  color: var(--text-secondary) !important;
  border: 1px solid transparent !important;
  font-weight: 600 !important;
  box-shadow: none !important;
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border: 1px solid transparent !important;
}

.btn svg {
  stroke: currentColor;
}

.btn-edit {
  color: var(--brand-navy);
}

.btn-edit:hover {
  background-color: var(--hover-icon);
  border-color: var(--brand-navy);
}

.btn-delete {
  color: var(--danger-color);
}

.btn-delete:hover {
  background-color: var(--overlay-danger-xs);
  border-color: var(--danger-color);
}


/* Form Styles overrides */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand-navy);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  height: 42px;
  box-sizing: border-box;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--brand-navy);
  transition: border-color var(--transition-fast);
}

.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--brand-navy);
  transition: border-color var(--transition-fast);
  min-height: 42px;
  overflow: hidden;
  resize: none;
}

.form-group select {
  width: 100%;
  height: 42px;
  box-sizing: border-box;
  padding: 10px 36px 10px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--brand-navy);
  transition: border-color var(--transition-fast);
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231F345D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  cursor: pointer;
}

.form-group input[type="date"]::-webkit-datetime-edit,
.form-group input[type="date"]::-webkit-datetime-edit-fields-wrapper,
.form-group input[type="date"]::-webkit-datetime-edit-text,
.form-group input[type="date"]::-webkit-datetime-edit-month-field,
.form-group input[type="date"]::-webkit-datetime-edit-day-field,
.form-group input[type="date"]::-webkit-datetime-edit-year-field {
  color: var(--brand-navy) !important;
  -webkit-text-fill-color: var(--brand-navy) !important;
  opacity: 1 !important;
  font-family: inherit;
  font-size: 0.9rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--border-color) !important;
  background-color: var(--overlay-navy-xs) !important;
  box-shadow: none !important;
}

/* Zorunlu ama henüz boş bırakılmış alanlar — bu doldurulmadan kayıt
   tamamlanamaz. Dolduruldukça (:invalid geçerliliğini yitirince) otomatik
   kayboluyor, kalıcı bir hata göstergesi gibi durmuyor. Kalıcı, tüm
   uygulama için geçerli bir kural — yeni bir zorunlu alan eklenince ek
   bir şey yapmaya gerek yok, sadece required koymak yeterli. */
input:required:invalid,
select:required:invalid,
textarea:required:invalid {
  background-color: var(--overlay-danger-xs);
}

.form-row {
  display: flex;
  gap: 20px;
}

.flex-1 {
  flex: 1;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

@media (min-width: 1400px) {
  .form-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* --- Toast Alerts Notification --- */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.toast {
  background-color: var(--overlay-white-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  width: fit-content;
  max-width: 90vw;
  display: flex;
  align-items: center;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--brand-navy);
  transform: translateY(-30px) scale(0.95);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1), opacity 0.3s ease;
}

.toast.show {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.toast-success {
  background-color: var(--overlay-success-sm);
  border-color: var(--overlay-success-border);
}

.toast-error {
  background-color: var(--overlay-danger-sm);
  border-color: var(--overlay-danger-border);
}

.toast-info {
  background-color: var(--overlay-navy-sm);
  border-color: var(--overlay-navy-md);
}

/* --- Settings Panel Layout --- */
.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-card h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--brand-navy);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
  margin: 0;
}

.settings-card .form-group {
  margin-bottom: 0 !important;
}

/* --- Color Palette (Settings) --- */
.color-group {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.color-group-title {
  font-size: 0.95rem;
  color: var(--text-primary);
  margin: 0;
}

.color-swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.color-swatch {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.color-swatch-preview {
  position: relative;
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--radius-sm);
  background-image:
    linear-gradient(45deg, var(--bg-tertiary) 25%, transparent 25%),
    linear-gradient(-45deg, var(--bg-tertiary) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--bg-tertiary) 75%),
    linear-gradient(-45deg, transparent 75%, var(--bg-tertiary) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
  background-color: var(--bg-secondary);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.color-swatch-preview:hover {
  transform: scale(1.06);
}

.color-swatch-preview-fill {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-sm);
}

/* Real, in-place <input type="color"> laid directly over the swatch —
   invisible but properly positioned/sized, so Safari/Android/etc. open
   their native picker anchored to it correctly. A detached, off-screen
   input triggered via .click() is what caused this (Safari refused to
   open it at all; Android anchored the picker to the top-right corner). */
.color-swatch-native-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

.color-swatch-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.color-swatch-name {
  font-size: 0.85rem;
  color: var(--text-primary);
}

.color-swatch-value {
  font-size: 0.75rem;
  font-family: var(--font-sans);
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  border-bottom: 1px dashed transparent;
}

.color-swatch-value:hover {
  color: var(--text-primary);
  border-bottom-color: var(--text-secondary);
}

.color-swatch-value-input {
  font-size: 0.75rem;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  border: none;
  outline: none;
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  width: 100%;
  min-width: 0;
}

.color-swatch-value-input:focus {
  border: none;
  outline: none;
  box-shadow: none;
}

.color-swatch-usage {
  font-size: 0.7rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- RESPONSIVE MOBILE MEDIA QUERIES --- */

@media (max-width: 991px) {
  #vm-status-details {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .admin-sidebar {
    transform: translateX(-100%);
  }
  
  .admin-sidebar.open {
    transform: translateX(0);
  }
  
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--overlay-navy-lg);
    z-index: 99;
    display: none;
    opacity: 0;
    transition: opacity var(--transition-normal);
  }
  
  .sidebar-overlay.open {
    display: block;
    opacity: 1;
  }
  
  .admin-main-content {
    margin-left: 0;
    margin-right: 0;
    padding: 20px; /* Aligned with Customer side padding */
    padding-top: 5.5rem; /* Space for mobile header bar */
  }

  .assistant-panel {
    display: none !important;
  }
  
  .admin-mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 64px;
    background-color: var(--bg-secondary);
    border-bottom: none;
    padding: 0 20px; /* Aligned with Customer side padding */
    z-index: 98;
  }
  
  .mobile-header-logo {
    height: 28px;
  }
  
  .sidebar-toggle-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .modal-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px;
  }
  
  .image-upload-zone {
    min-height: 180px;
  }
  
  .form-row {
    flex-direction: column;
    gap: 20px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .tab-header h1 {
    font-size: 22px;
  }
  
  .filters-bar {
    flex-direction: column;
    gap: 20px;
  }
  
  .admin-search-container,
  .admin-select-container {
    width: 100% !important;
  }
}

/* --- Breadcrumbs --- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.breadcrumb-link {
  color: var(--brand-navy);
  font-weight: 600;
  text-decoration: none;
  transition: opacity var(--transition-fast);
}

.breadcrumb-link:hover {
  opacity: 0.8;
}

.breadcrumb-separator {
  color: var(--text-secondary);
}

.breadcrumb-active {
  color: var(--text-secondary);
}

/* --- Responsive Cards for Tables on Mobile --- */
/* --- Card list (replaces classic table rows everywhere) --- */
.admin-table thead {
  display: none;
}

.admin-table,
.admin-table tbody,
.admin-table tr,
.admin-table td {
  display: block;
  width: 100%;
}

.admin-table {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.admin-table tbody {
  display: contents;
}

.admin-table tr {
  margin-bottom: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-secondary);
  padding: 12px 16px;
}

.admin-table td {
  border: none;
  border-bottom: none;
  padding: 10px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: right;
  font-size: 0.9rem;
  gap: 12px;
  min-width: 0;
}

.admin-table td::before {
  flex-shrink: 0;
}

.admin-table td > strong,
.admin-table td > code,
.admin-table td > a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  max-width: 100%;
  display: inline-block;
}

/* A colspan row (empty state / loading / error message) is the only item
   in the grid, but auto-fill still reserves a full 280px+ track for it —
   without this it stretches to that track's width no matter how short the
   text is. Spanning every column and shrinking to fit-content sizes it to
   the actual message instead. */
.admin-table tr:has(td[colspan]) {
  grid-column: 1 / -1;
  width: fit-content;
  max-width: 100%;
}

.admin-table td[colspan] {
  display: block;
  text-align: left !important;
  border-bottom: none;
  padding: 20px 0;
}

.admin-table td[colspan]::before {
  content: none;
}

.doc-data-cell {
  display: block !important;
  text-align: left !important;
}

.admin-table td:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.admin-table td:first-child {
  padding-top: 0;
}

.admin-table td::before {
  content: attr(data-label);
  font-weight: 600;
  color: var(--brand-navy);
  text-align: left;
  margin-right: 16px;
}

.actions-cell-flex {
  justify-content: flex-end;
}

/* --- App manage view --- */
/* .theme-mode-btn (Görünüm Modu) aynı görünümü paylaşır ama BİLEREK ayrı
   bir sınıf — openAppManage() querySelectorAll('.manage-subtab-link') ile
   Uygulamayı Yönet alt sekmelerini disabled=true/false yapıyor; aynı sınıfı
   paylaşsaydı Görünüm Modu butonları da (data-manage-section'ı olmadığı
   için "else" dalına düşüp) yanlışlıkla devre dışı kalırdı — bu gerçekten
   yaşandı, bir daha olmasın. */
.manage-subtab-link,
.theme-mode-btn {
  background-color: var(--bg-tertiary);
  border: none;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.manage-subtab-link:hover,
.theme-mode-btn:hover {
  background-color: var(--hover-tertiary);
  color: var(--text-primary);
}

.manage-subtab-link.active,
.theme-mode-btn.active {
  background-color: var(--brand-navy);
  border: none;
  color: var(--on-brand);
}

.manage-subtab-link:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.manage-subtab-link:disabled:hover {
  background-color: var(--bg-tertiary);
}


.inline-form-row {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-form-row input,
.inline-form-row textarea,
.inline-form-row select {
  padding: 9px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  background-color: var(--bg-secondary);
  color: var(--brand-navy);
  outline: none;
}

.inline-form-row input {
  height: 42px;
  box-sizing: border-box;
}

.inline-form-row textarea {
  min-height: 42px;
  overflow: hidden;
  resize: none;
}

.inline-form-row input:focus,
.inline-form-row textarea:focus,
.inline-form-row select:focus {
  outline: none;
}

.inline-form-row select {
  height: 42px;
  padding-right: 32px;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231F345D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  cursor: pointer;
}

/* Search + sort bar: two independent fields, 20px apart */
.apps-filter-bar {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
}

.apps-filter-bar input,
.apps-filter-bar select {
  height: 42px;
  box-sizing: border-box;
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-secondary);
  color: var(--brand-navy);
  font-family: inherit;
  font-size: 0.9rem;
}

.apps-filter-bar input:focus,
.apps-filter-bar select:focus {
  outline: none;
  box-shadow: none;
}

.apps-filter-bar select {
  min-width: 240px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231F345D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 40px;
}

@media (max-width: 991px) {
  .apps-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .apps-filter-bar input,
  .apps-filter-bar select,
  .apps-filter-bar button {
    width: 100%;
    flex: none;
  }
}

.activity-list {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--box-bg);
  overflow: hidden;
}

.activity-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
}

.activity-list-item:last-child {
  border-bottom: none;
}

.activity-list-main {
  min-width: 0;
}

.activity-list-action {
  color: var(--brand-navy);
  font-size: 0.9rem;
  font-weight: 600;
}

.activity-list-user {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 2px;
}

.activity-list-date {
  color: var(--text-muted);
  font-size: 0.85rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.activity-list-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.chat-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-bubble--user {
  align-self: flex-end;
  background-color: var(--brand-navy);
  color: var(--on-brand);
}

.chat-bubble--assistant {
  align-self: flex-start;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.chat-bubble--confirm {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-confirm-actions {
  display: flex;
  gap: 8px;
}

.chat-confirm-btn {
  height: 30px;
  padding: 0 12px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chat-confirm-btn--confirm {
  background-color: var(--brand-navy);
  color: var(--on-brand);
  border: 1px solid transparent;
}

.chat-confirm-btn--confirm:hover {
  background-color: var(--brand-navy-light);
}

.chat-confirm-btn--cancel {
  background-color: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.chat-confirm-btn--cancel:hover {
  background-color: var(--overlay-navy-xs);
  color: var(--text-primary);
}


.inline-edit-row textarea {
  width: 100%;
  min-height: 120px;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  resize: none;
}
