:root {
  /* Light palette */
  --bg: #f3f4f6;
  --panel: #ffffff;
  --soft: #f9fafb;
  --muted: #6b7280;
  --text: #111827;
  --brand: #6366f1;
  /* indigo-500 */
  --brand-2: #06b6d4;
  /* cyan-500 */
  --ok: #10b981;
  --warn: #f59e0b;
  --bad: #ef4444;
  --shadow: 0 4px 14px rgba(0, 0, 0, .08);
  --radius: 12px;

  /* Sidebar */
  --sidebar-bg: #f8fafc;
  --sidebar-border: #e5e7eb;

  /* Focus ring */
  --ring: #93c5fd;
  --ring-shadow: 0 0 0 3px rgba(147, 197, 253, .6);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

/* --------------------------------
   Layout
-----------------------------------*/
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* --------------------------------
   Sidebar (Accordion + Off-canvas)
-----------------------------------*/
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--sidebar-border);
}

.logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 4px 12px rgba(99, 102, 241, .25);
}

.brand h1 {
  font-size: 16px;
  margin: 0;
}

.hamburger {
  margin-left: auto;
  display: none;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
}

/* Sidebar backdrop (mobile) */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, .45);
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s ease;
}

.sidebar-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.nav {
  padding: 10px;
}

.nav-group {
  margin: 8px 0;
}

.nav-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border: 1px solid var(--sidebar-border);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 600;
  color: #374151;
  transition: background .2s ease, border-color .2s ease;
}

.nav-toggle:hover {
  background: #f8fafc;
}

.nav-toggle:focus-visible {
  outline: none;
  border-color: var(--ring);
  box-shadow: var(--ring-shadow);
}

.nav .chev {
  opacity: .8;
  transition: transform .2s ease;
}

.nav-toggle[aria-expanded="true"] .chev {
  transform: rotate(90deg);
}

/* Accordion submenu (animated) */
.submenu {
  list-style: none;
  margin: 6px 0 0;
  padding: 0 6px 0 8px;
  display: grid;
  gap: 6px;

  /* accordion animation */
  max-height: 0;
  overflow: hidden;
  transition: max-height .28s ease, margin .2s ease, padding .2s ease;
}

.submenu.open {
  max-height: 480px;
  /* yeterli büyük bir değer */
  padding-bottom: 6px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px;
  border-radius: 10px;
  color: #374151;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.nav a:hover {
  background: #eef2ff;
}

.nav a:focus-visible {
  outline: none;
  box-shadow: var(--ring-shadow);
}

.nav a.active {
  background: #e0e7ff;
  border: 1px solid #c7d2fe;
  color: #4338ca;
}

.badge {
  margin-left: auto;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 999px;
  color: #2563eb;
  font-size: 11px;
}

/* --------------------------------
   Main / Topbar
-----------------------------------*/
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  background: #ffffffcc;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  z-index: 35;
}

.search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--soft);
  border: 1px solid var(--sidebar-border);
  padding: 10px 12px;
  border-radius: 12px;
}

.search:focus-within {
  border-color: var(--ring);
  box-shadow: var(--ring-shadow);
}

.search input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--soft);
  border: 1px solid var(--sidebar-border);
  cursor: pointer;
}

.icon-btn:focus-visible {
  outline: none;
  box-shadow: var(--ring-shadow);
}

.avatar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px;
  border-radius: 12px;
  border: 1px solid var(--sidebar-border);
  background: var(--soft);
}

.avatar .dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--ok);
}

/* --------------------------------
   Content
-----------------------------------*/
.content {
  padding: 18px;
  display: grid;
  gap: 18px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 6px;
  font-weight: 600;
  font-size: 13px;
  color: #4f46e5;
}

.card .big {
  font-size: 24px;
  font-weight: 700;
}

.spark {
  height: 36px;
  width: 100%;
  background: linear-gradient(90deg, rgba(99, 102, 241, .15), transparent 50%, rgba(6, 182, 212, .15));
  border-radius: 10px;
}

.grid {
  display: grid;
  grid-template-columns: 2fr 1.5fr 1fr;
  gap: 16px;
}

/* --------------------------------
   Table
-----------------------------------*/
.table {
  background: var(--panel);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius);
  overflow-x: auto;
  /* responsive tablolar için */
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
}

thead th {
  font-size: 12px;
  color: #374151;
  position: sticky;
  top: 0;
  background: var(--panel);
}

tbody tr:hover {
  background: #f9fafb;
}

.status {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid;
}

.status.open {
  background: #ecfdf5;
  color: #065f46;
  border-color: #34d399;
}

.status.hold {
  background: #fffbeb;
  color: #92400e;
  border-color: #fbbf24;
}

.status.closed {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fca5a5;
}

.pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: #f3f4f6;
  color: #4338ca;
  border: 1px solid #c7d2fe;
}

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

/* --------------------------------
   Buttons
-----------------------------------*/
.btn {
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  transition: box-shadow .15s ease, border-color .15s ease, background .15s ease;
}

.btn:hover {
  background: #f3f4f6;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--ring-shadow);
  border-color: var(--ring);
}

.btn.primary {
  background: linear-gradient(90deg, rgba(99, 102, 241, .25), rgba(6, 182, 212, .25));
  border-color: #a5b4fc;
}

/* --------------------------------
   Kanban
-----------------------------------*/
.kanban {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.col {
  background: var(--panel);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 240px;
}

.col h4 {
  margin: 0 0 10px;
  font-size: 12px;
  color: #4f46e5;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ticket {
  background: var(--soft);
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 10px;
}

.ticket .meta {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* --------------------------------
   Activity
-----------------------------------*/
.activity {
  background: var(--panel);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius);
  padding: 12px;
}

.act-title {
  margin: 0 0 10px;
  color: #4f46e5;
}

.timeline {
  display: grid;
  gap: 12px;
}

.event {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--brand-2);
  margin-top: 6px;
}

.dot.blue {
  background: var(--brand);
}

.dot.ok {
  background: var(--ok);
}

.event small {
  color: #6b7280;
}

/* --------------------------------
   Drawer
-----------------------------------*/
.drawer {
  position: fixed;
  right: -430px;
  top: 0;
  width: 420px;
  height: 100vh;
  background: var(--panel);
  border-left: 1px solid var(--sidebar-border);
  box-shadow: var(--shadow);
  transition: right .28s ease;
  z-index: 50;
  display: flex;
  flex-direction: column;
}

.drawer.open {
  right: 0;
}

.drawer header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border-bottom: 1px solid var(--sidebar-border);
}

.drawer .body {
  padding: 14px;
  overflow: auto;
  display: grid;
  gap: 12px;
}

.drawer .body hr {
  border: 0;
  border-top: 1px solid #e5e7eb;
}

.kv {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 6px;
  font-size: 13px;
}

.drawer-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

/* --------------------------------
   Footer
-----------------------------------*/
.footer {
  padding: 14px;
  color: #6b7280;
  font-size: 12px;
  text-align: center;
}

/* --------------------------------
   Drawer > Geçmiş scroll
-----------------------------------*/
.drawer .timeline {
  max-height: 320px;
  overflow: auto;
  padding-right: 6px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: var(--soft);
}

.drawer .timeline::-webkit-scrollbar {
  width: 8px;
}

.drawer .timeline::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 999px;
}

.drawer .timeline::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.drawer .timeline::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* --------------------------------
   Media Queries (Responsive)
-----------------------------------*/
@media (max-width:1100px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .kanban {
    grid-template-columns: repeat(2, 1fr);
  }

  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

  .sidebar {
    position: fixed;
    left: -270px;
    width: 260px;
    transition: left .28s ease;
    height: 100vh;
    top: 0;
  }

  .sidebar.open {
    left: 0;
  }

  .hamburger {
    display: inline-grid;
  }

  .cards,
  .kanban {
    grid-template-columns: 1fr;
  }

  .main {
    min-width: 0;
  }
}

@media (max-width:640px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .topbar .search {
    order: 2;
  }

  .topbar .actions {
    order: 3;
    justify-content: flex-end;
  }

  .cards,
  .kanban,
  .grid {
    grid-template-columns: 1fr;
  }

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

  table {
    min-width: 600px;
  }
}

/* --------------------------------
   Login Page
-----------------------------------*/
body.login .app {
  grid-template-columns: 1fr;
}

body.login .sidebar,
body.login .topbar,
body.login .drawer {
  display: none !important;
}

body.login .content {
  padding: 0;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-box {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-box h2 {
  margin: 0 0 10px;
  text-align: center;
  color: var(--brand);
}

.login-box p {
  margin-top: 0;
  text-align: center;
  color: var(--muted);
}

/* --------------------------------
   Media: Images & Forms
-----------------------------------*/
img,
video,
canvas,
svg {
  max-width: 100%;
  height: auto;
}

input,
select,
textarea,
button {
  max-width: 100%;
  box-sizing: border-box;
}

/* --------------------------------
   Reduced Motion
-----------------------------------*/
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* --------------------------------
   Utility
-----------------------------------*/
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}