:root {
  --bg: #111820;
  --panel: #18212b;
  --panel-2: #202b37;
  --line: #31404f;
  --text: #edf2f7;
  --muted: #95a3b3;
  --soft: #c9d2dc;
  --red: #e32929;
  --red-2: #a80f14;
  --green: #22c55e;
  --yellow: #f7bf3a;
  --blue: #5aa7ff;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(227, 41, 41, 0.18), transparent 28rem),
    linear-gradient(145deg, #0c1117 0%, var(--bg) 55%, #151d27 100%);
  color: var(--text);
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(11, 16, 23, 0.78);
  backdrop-filter: blur(20px);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  padding: 10px;
}

.brand img {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.brand strong {
  display: block;
  color: #fff;
  font-size: 1.08rem;
}

.brand span,
.eyebrow,
.muted {
  color: var(--muted);
}

.brand span {
  display: block;
  font-size: 0.78rem;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  background: transparent;
  color: var(--soft);
  text-align: left;
}

.nav button:hover,
.nav button.active {
  background: linear-gradient(90deg, rgba(227, 41, 41, 0.28), rgba(255, 255, 255, 0.05));
  color: #fff;
}

.nav small {
  color: var(--muted);
}

.sidebar-card {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.pulse {
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.14);
}

.pulse.offline {
  background: var(--yellow);
  box-shadow: 0 0 0 8px rgba(247, 191, 58, 0.14);
}

.pulse.error {
  background: var(--red);
  box-shadow: 0 0 0 8px rgba(227, 41, 41, 0.14);
}

.main {
  min-width: 0;
  padding: 24px;
}

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

.topbar h1,
.modal h2 {
  margin: 0;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 300px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.05);
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.primary,
.secondary,
.danger,
.ghost,
.icon-button,
.menu-button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  color: #fff;
}

.primary {
  background: linear-gradient(135deg, var(--red), var(--red-2));
  box-shadow: 0 12px 26px rgba(227, 41, 41, 0.28);
}

.secondary {
  background: var(--panel-2);
  border-color: var(--line);
}

.danger {
  background: rgba(227, 41, 41, 0.16);
  border-color: rgba(227, 41, 41, 0.45);
}

.ghost,
.icon-button,
.menu-button {
  background: transparent;
  border-color: var(--line);
}

.menu-button {
  display: none;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 360px;
  gap: 18px;
  margin-bottom: 18px;
}

.hero-panel,
.panel,
.card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(24, 33, 43, 0.92);
  box-shadow: var(--shadow);
}

.hero-panel {
  min-height: 286px;
  padding: 28px;
  overflow: hidden;
  position: relative;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: auto -18% -45% 35%;
  height: 260px;
  background: linear-gradient(90deg, rgba(227, 41, 41, 0.28), rgba(255, 255, 255, 0.08));
  transform: rotate(-8deg);
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 720px;
}

.hero h2 {
  margin: 0;
  max-width: 680px;
  font-size: clamp(2rem, 4vw, 4.2rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero p {
  color: var(--soft);
  font-size: 1.05rem;
  line-height: 1.55;
  max-width: 650px;
}

.hero-actions,
.row-actions,
.toolbar,
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.status-board {
  display: grid;
  gap: 12px;
}

.status-lane {
  padding: 16px;
}

.status-lane strong {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.status-lane p {
  margin: 8px 0 0;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 16px;
}

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

.grid.two {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.72fr);
}

.card,
.panel {
  padding: 18px;
}

.kpi {
  min-height: 128px;
}

.kpi span {
  color: var(--muted);
  font-size: 0.86rem;
}

.kpi strong {
  display: block;
  margin: 10px 0 5px;
  font-size: 2rem;
}

.kpi small {
  color: var(--green);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 10px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td {
  color: var(--soft);
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
}

.tag.red {
  background: rgba(227, 41, 41, 0.18);
  color: #ffb4b4;
}

.tag.green {
  background: rgba(34, 197, 94, 0.15);
  color: #9ff0bd;
}

.tag.yellow {
  background: rgba(247, 191, 58, 0.16);
  color: #ffe09b;
}

.tag.blue {
  background: rgba(90, 167, 255, 0.16);
  color: #b8dcff;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.lane {
  min-height: 420px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.lane h3 {
  margin: 0 0 12px;
  font-size: 0.95rem;
}

.job-card {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 12px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.job-card strong {
  color: #fff;
}

.job-card span {
  color: var(--muted);
  font-size: 0.86rem;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 10px;
  overflow-x: auto;
}

.day {
  min-height: 180px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.day strong {
  display: block;
  margin-bottom: 8px;
}

.slot {
  display: block;
  margin-top: 8px;
  padding: 8px;
  border-left: 3px solid var(--red);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--soft);
  font-size: 0.84rem;
}

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

.field {
  display: grid;
  gap: 6px;
}

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

.field label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(9, 13, 19, 0.78);
  color: var(--text);
  outline: 0;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.list {
  display: grid;
  gap: 10px;
}

.list-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.price {
  color: #fff;
  font-weight: 800;
}

.progress {
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--yellow));
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.68);
  z-index: 20;
}

.modal.open {
  display: flex;
}

.modal-panel {
  width: min(760px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 18px;
  background: #121922;
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 16px;
}

.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 280px;
    transform: translateX(-110%);
    transition: transform 0.2s ease;
    z-index: 15;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .menu-button {
    display: inline-flex;
    align-items: center;
  }

  .hero,
  .grid.two,
  .grid.kpis {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .main {
    padding: 16px;
  }

  .topbar,
  .top-actions,
  .list-item {
    align-items: stretch;
    flex-direction: column;
  }

  .search {
    min-width: 0;
  }

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