:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #18211f;
  --muted: #65706c;
  --line: #dfe4de;
  --steel: #314a55;
  --blue: #1f6feb;
  --green: #1c7c54;
  --amber: #a66300;
  --red: #b42318;
  --shadow: 0 14px 36px rgba(30, 41, 38, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  background: var(--bg);
  color: var(--ink);
}

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

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  padding: 0.66rem 0.9rem;
  cursor: pointer;
}

button:hover {
  border-color: #b9c2bd;
}

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

.sidebar {
  min-height: 100vh;
  padding: 1.25rem;
  background: #17211f;
  color: #f8fbf9;
}

.brand {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  margin-bottom: 2rem;
}

.brand-mark {
  width: 44px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #f1b434;
  color: #17211f;
  border-radius: 6px;
  font-weight: 800;
}

.brand small,
.sidebar-block p,
.topbar p,
.panel-header p {
  color: var(--muted);
}

.brand small,
.label,
.metric-label {
  display: block;
  font-size: 0.78rem;
}

.sidebar .brand small,
.sidebar-block p {
  color: #b9c7c1;
}

.nav {
  display: grid;
  gap: 0.45rem;
}

.nav-item {
  text-align: left;
  background: transparent;
  color: #dfe7e3;
  border-color: transparent;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.sidebar-block {
  margin-top: 2rem;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.label {
  color: #f1b434;
  font-weight: 700;
  text-transform: uppercase;
}

.workspace {
  min-width: 0;
  padding: 1.5rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.35rem;
  font-size: clamp(1.8rem, 3vw, 2.7rem);
  line-height: 1.05;
}

h2 {
  margin-bottom: 0.25rem;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.metrics article,
.panel,
.integration {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metrics article {
  padding: 1rem;
}

.metric-value {
  display: block;
  font-size: 1.8rem;
  font-weight: 800;
}

.panel {
  display: none;
  overflow: hidden;
}

.panel.active {
  display: block;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}

.filters {
  display: flex;
  gap: 0.6rem;
  min-width: min(100%, 520px);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.66rem 0.75rem;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

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

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

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

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

.file-name {
  font-weight: 750;
}

.meta {
  color: var(--muted);
  font-size: 0.83rem;
  margin-top: 0.18rem;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 750;
  background: #edf2f0;
}

.status.Released {
  color: var(--green);
  background: #eaf6ef;
}

.status.CheckedOut,
.status.Working {
  color: var(--amber);
  background: #fff3df;
}

.status.Obsolete {
  color: var(--red);
  background: #fff0ee;
}

.row-actions {
  display: flex;
  gap: 0.45rem;
  justify-content: flex-end;
}

.revision-list,
.audit-list,
.integration-grid {
  padding: 1rem;
}

.revision-list,
.audit-list {
  display: grid;
  gap: 0.65rem;
}

.revision-item,
.audit-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem;
}

.revision-item strong,
.audit-item strong {
  display: block;
}

.integration-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.integration {
  box-shadow: none;
  padding: 1rem;
}

.integration ul {
  padding-left: 1.1rem;
  margin-bottom: 0;
  color: var(--muted);
}

.tag {
  display: inline-block;
  margin-bottom: 0.8rem;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 800;
}

dialog {
  width: min(760px, calc(100vw - 2rem));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

dialog::backdrop {
  background: rgba(18, 27, 25, 0.48);
}

dialog header,
dialog footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  padding: 1rem;
}

dialog header {
  border-bottom: 1px solid var(--line);
}

dialog footer {
  border-top: 1px solid var(--line);
}

.icon-button {
  width: 36px;
  height: 36px;
  padding: 0;
}

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

label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.wide {
  grid-column: 1 / -1;
}

#checkoutForm {
  display: grid;
}

#checkoutForm > label {
  margin: 1rem;
}

@media (max-width: 920px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

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

  .topbar,
  .panel-header,
  .filters {
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .workspace {
    padding: 1rem;
  }

  .metrics,
  .integration-grid,
  .form-grid,
  .nav {
    grid-template-columns: 1fr;
  }
}
