:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #eef3f8;
  --line: #c9d3e3;
  --text: #172033;
  --muted: #66728a;
  --primary: #2563eb;
  --primary-dark: #174cb6;
  --green: #17935c;
  --amber: #b87514;
  --red: #c43b48;
  --ink: #111827;
  --shadow: 0 18px 50px rgba(35, 48, 76, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 54px;
  margin-left: 18px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 24px;
  cursor: pointer;
}

.chevron {
  color: var(--muted);
  font-size: 18px;
}

.tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding: 0 14px;
}

.tab {
  min-width: max-content;
  height: 40px;
  padding: 0 18px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #2c3342;
  cursor: pointer;
}

.tab.active {
  border-color: var(--primary);
  color: var(--primary-dark);
}

main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) repeat(5, minmax(132px, 180px)) auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

select,
input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  padding: 0 10px;
}

.date-filter {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding-left: 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.date-filter input {
  min-height: 38px;
  border: 0;
  padding-left: 0;
}

button {
  border-radius: 5px;
}

.primary,
.outline {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--primary);
  cursor: pointer;
}

.primary {
  background: var(--primary);
  color: #fff;
}

.outline {
  background: var(--surface);
  color: var(--primary-dark);
}

.outline.danger {
  border-color: #d7a5ab;
  color: var(--red);
}

.view,
.operation {
  display: none;
}

.view.active,
.operation.active {
  display: block;
}

.hidden {
  display: none !important;
}

.section-head {
  margin-bottom: 16px;
}

.section-head h1 {
  font-size: 26px;
  font-weight: 650;
}

.section-head p {
  margin-top: 6px;
  color: var(--muted);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric,
.panel,
.form-shell {
  background: var(--surface);
  border: 1px solid #e2e7f0;
  box-shadow: 0 10px 30px rgba(24, 38, 68, 0.06);
}

.metric {
  min-height: 98px;
  padding: 16px;
  border-radius: 7px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
}

.metric small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.dashboard-grid,
.visual-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 14px;
}

.panel {
  border-radius: 7px;
  padding: 16px;
  overflow: hidden;
  margin-bottom: 14px;
}

.panel.wide {
  grid-row: span 2;
}

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

h1,
h2,
p {
  margin: 0;
}

h2 {
  font-size: 18px;
  font-weight: 650;
}

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

.list-item,
.ticket {
  border: 1px solid #e1e7f0;
  border-left: 4px solid var(--primary);
  border-radius: 6px;
  padding: 12px;
  background: #fff;
}

.list-item.high,
.ticket.high {
  border-left-color: var(--red);
}

.list-item.medium,
.ticket.medium {
  border-left-color: var(--amber);
}

.list-item.done,
.ticket.done {
  border-left-color: var(--green);
}

.row-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 650;
}

.row-title span:last-child {
  white-space: nowrap;
  color: var(--muted);
  font-weight: 500;
}

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

.compact .list-item {
  padding: 10px;
}

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

.rank-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.bar {
  height: 9px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.bar span {
  display: block;
  height: 100%;
  background: var(--primary);
}

.form-shell {
  width: min(100%, 760px);
  margin: 18px auto;
  border-radius: 8px;
  padding: 48px;
  box-shadow: var(--shadow);
}

.main-form {
  width: min(100%, 920px);
  margin: 0 auto 18px;
}

.form-title {
  margin-bottom: 28px;
}

.form-icon {
  color: #94989f;
  font-size: 34px;
  line-height: 1;
}

.image-icon {
  display: block;
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.form-title h1 {
  margin-top: 18px;
  font-size: 30px;
  font-weight: 500;
}

.form-title p {
  margin-top: 10px;
  color: #48546b;
}

.record-form label {
  display: grid;
  gap: 8px;
  color: #14213a;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

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

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

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 14px;
  align-items: start;
}

.lane {
  min-height: 220px;
  border: 1px solid #dce4ef;
  border-radius: 7px;
  background: #f9fbfe;
}

.lane h2 {
  padding: 14px;
  border-bottom: 1px solid #dce4ef;
  background: #fff;
}

.lane-body {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.ticket button,
td button {
  min-height: 32px;
  margin-top: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--primary-dark);
  cursor: pointer;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}

.asset-card {
  border: 1px solid #dfe6f0;
  border-radius: 7px;
  background: var(--surface);
  padding: 16px;
}

.asset-card h2 {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e9f0ff;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
}

.badge.red {
  background: #ffecef;
  color: var(--red);
}

.badge.green {
  background: #e8f7ef;
  color: var(--green);
}

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

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

.bars {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.bar-row {
  display: grid;
  grid-template-columns: 130px 1fr 44px;
  gap: 10px;
  align-items: center;
}

.bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.bar-fill {
  height: 100%;
  background: var(--primary);
}

.donut-wrap {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 22px;
  align-items: center;
  margin-top: 18px;
}

.compact-chart {
  grid-template-columns: 140px 1fr;
}

.donut {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: conic-gradient(var(--red) 0deg, var(--red) 180deg, var(--green) 180deg, var(--green) 360deg);
  position: relative;
}

.compact-chart .donut {
  width: 130px;
  height: 130px;
}

.compact-chart .donut::after {
  inset: 26px;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 32px;
  border-radius: 50%;
  background: var(--surface);
}

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

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

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
}

.table-wrap {
  overflow: auto;
  border: 1px solid #dce4ef;
  border-radius: 7px;
  background: var(--surface);
}

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

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid #e7edf5;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: #475067;
  font-size: 12px;
  text-transform: uppercase;
}

@media (max-width: 980px) {
  .toolbar,
  .metrics,
  .dashboard-grid,
  .visual-grid,
  .kanban {
    grid-template-columns: 1fr;
  }

  .panel.wide,
  .visual-grid .wide {
    grid-column: auto;
    grid-row: auto;
  }

  .form-shell {
    margin: 16px auto;
    padding: 28px 20px;
  }
}

@media (max-width: 620px) {
  main {
    padding: 12px;
  }

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

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

  .metrics {
    gap: 10px;
  }
}
