:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d9dee8;
  --primary: #2563eb;
  --danger: #dc2626;
  --shadow: 0 18px 45px rgba(15, 23, 42, .08);
}

html.dark {
  color-scheme: dark;
  --bg: #101318;
  --panel: #181d25;
  --text: #eef2f7;
  --muted: #a5adba;
  --line: #2b3340;
  --primary: #60a5fa;
  --danger: #f87171;
  --shadow: 0 18px 45px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: inherit; }

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

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
}

textarea { resize: vertical; }

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

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

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 800;
  text-decoration: none;
  margin-bottom: 28px;
}

.sidebar-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 8px;
}

nav {
  display: grid;
  gap: 8px;
}

nav a,
.theme-toggle {
  display: block;
  text-decoration: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
}

nav a:hover,
.theme-toggle:hover {
  background: rgba(37, 99, 235, .1);
  color: var(--text);
}

.theme-toggle {
  margin-top: 24px;
  width: 100%;
}

.main {
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(26px, 3vw, 38px);
}

.topbar p,
.muted {
  color: var(--muted);
}

.userbox {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.panel,
.stats-grid article,
.task-card,
.auth-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
  margin-bottom: 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stats-grid article {
  padding: 18px;
}

.stats-grid strong {
  display: block;
  font-size: 30px;
}

.stats-grid span {
  color: var(--muted);
}

.filters,
.task-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.task-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.span-2 {
  grid-column: span 2;
}

.button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: none;
}

.button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.button.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

.button.full {
  width: 100%;
}

.button.small {
  padding: 7px 10px;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.column {
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(100, 116, 139, .06);
}

.column h2 {
  margin: 0 0 12px;
  display: flex;
  justify-content: space-between;
  font-size: 18px;
}

.dropzone {
  display: grid;
  gap: 8px;
  min-height: 280px;
}

/* KOMPAKTNÍ TICKETY */

.task-card {
  padding: 10px 12px;
  cursor: grab;
  border-left-width: 6px !important;
  min-height: auto;
}

.task-card.dragging {
  opacity: .55;
}

.task-card h3 {
  margin: 4px 0;
  font-size: 14px;
  line-height: 1.3;
  font-weight: 600;
}

.task-card p {
  display: none;
}

.card-top,
.card-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 11px;
}

.project-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.card-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 11px;
}

.priority-high { color: #d97706; }
.priority-urgent { color: #dc2626; }
.priority-low { color: #16a34a; }

.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.list article {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

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

.project-list {
  display: grid;
  gap: 12px;
}

.project-edit {
  display: grid;
  grid-template-columns: 1fr 100px 90px auto auto;
  gap: 12px;
  align-items: end;
}

.project-item {
  display: flex;
  gap: 12px;
  align-items: end;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.flash {
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.flash.ok {
  background: rgba(22, 163, 74, .12);
  color: #15803d;
}

.flash.error {
  background: rgba(220, 38, 38, .12);
  color: #b91c1c;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-card {
  width: min(440px, 100%);
  padding: 28px;
}

.auth-card.wide {
  width: min(760px, 100%);
}

.auth-card form {
  display: grid;
  gap: 14px;
}

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

.center {
  text-align: center;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .stats-grid,
  .kanban,
  .filters,
  .task-form,
  .two-cols,
  .form-grid,
  .project-edit {
    grid-template-columns: 1fr;
  }

  .project-item {
    align-items: stretch;
    flex-direction: column;
  }

  .span-2 {
    grid-column: span 1;
  }

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

/* TOM SELECT */

.ts-wrapper,
.ts-control,
.ts-dropdown {
  font: inherit;
}

.ts-control {
  border: 1px solid var(--line) !important;
  background: var(--panel) !important;
  color: var(--text) !important;
  border-radius: 8px !important;
  min-height: 42px;
  box-shadow: none !important;
}

.ts-dropdown {
  background: var(--panel) !important;
  border: 1px solid var(--line) !important;
  color: var(--text) !important;
  border-radius: 8px !important;
}

.ts-dropdown .option {
  padding: 10px 12px;
}

.ts-dropdown .active {
  background: rgba(37, 99, 235, .12) !important;
}

#customer-search {
  display: none !important;
}

/* SELECT2 TASKPOOL STYLE */

.select2-container {
    width: 100% !important;
}

.select2-container .select2-selection--single {
    height: 42px !important;
    border: 1px solid var(--line) !important;
    background: var(--panel) !important;
    color: var(--text) !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    box-shadow: none !important;
}

.select2-container .select2-selection__rendered {
    color: var(--text) !important;
    line-height: 40px !important;
    padding-left: 12px !important;
    padding-right: 35px !important;
}

.select2-container .select2-selection__placeholder {
    color: var(--muted) !important;
}

.select2-container .select2-selection__arrow {
    height: 40px !important;
    right: 10px !important;
}

.select2-dropdown {
    background: var(--panel) !important;
    border: 1px solid var(--line) !important;
    border-radius: 8px !important;
    overflow: hidden;
}

.select2-search__field {
    border: 1px solid var(--line) !important;
    border-radius: 8px !important;
    padding: 8px 10px !important;
    background: var(--panel) !important;
    color: var(--text) !important;
}

.select2-results__option {
    padding: 10px 12px !important;
    color: var(--text) !important;
}

.select2-results__option--highlighted {
    background: rgba(37, 99, 235, .12) !important;
    color: var(--text) !important;
}

}
