:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --ink: #111827;
  --text: #344054;
  --muted: #667085;
  --muted-2: #6b7280;
  --line: #e5e7eb;
  --soft: #f2f4f7;
  --soft-2: #f9fafb;
  --brand: #155e75;
  --brand-hover: #0f4f63;
  --brand-soft: #e6f4f1;
  --brand-selected: #c7ebe5;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --error: #dc2626;
  --error-soft: #fef2f2;
  --shadow: 0 18px 42px rgba(16, 24, 40, 0.08);
  --radius: 10px;
  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;
  color: var(--ink);
  background: var(--bg);
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 76px;
  padding: 10px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark,
.login-mark {
  display: block;
  width: 54px;
  height: 54px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 12px 24px rgba(23, 32, 51, 0.16);
  flex: 0 0 auto;
}

.brand strong {
  display: block;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.15;
  letter-spacing: 0;
}

.brand span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft-2);
}

.tabs button,
.ghost-btn,
.primary-btn,
.chip,
.rail-item,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  text-decoration: none;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.tabs button {
  padding: 0 16px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
}

.tabs button.active {
  color: #fff;
  background: var(--brand);
  box-shadow: 0 8px 18px rgba(21, 94, 117, 0.18);
}

.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.workspace {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  gap: 24px;
  padding: 24px 32px 40px;
}

.filter-rail {
  position: sticky;
  top: 100px;
  align-self: start;
  display: grid;
  gap: 22px;
  max-height: calc(100vh - 124px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.filter-group {
  display: grid;
  gap: 8px;
}

.filter-group + .filter-group {
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.rail-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.rail-title small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.rail-item {
  justify-content: space-between;
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.rail-item:hover {
  background: var(--soft-2);
}

.rail-item small {
  display: grid;
  min-width: 26px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.rail-item.active {
  color: #0f3f4a;
  background: var(--brand-selected);
}

.rail-item.active small {
  background: rgba(255, 255, 255, 0.72);
  color: var(--brand);
}

.library-surface {
  min-width: 0;
}

.hero-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  max-width: 760px;
  color: var(--ink);
  font-size: clamp(26px, 3vw, 34px);
  line-height: 1.18;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
}

.hero-copy {
  max-width: 720px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.quick-stats,
.metric-row {
  display: grid;
  grid-auto-flow: column;
  gap: 10px;
}

.quick-stats span,
.metric-row div {
  min-width: 88px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfd;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.quick-stats strong,
.metric-row strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.1;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) auto;
  gap: 14px;
  margin: 18px 0;
  align-items: center;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--muted);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}

.search-box input::placeholder {
  color: #98a2b3;
}

.search-submit {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 15px;
  border: 1px solid var(--brand);
  border-radius: 8px;
  background: var(--brand);
  color: white;
  font-weight: 800;
}

.search-submit:hover {
  border-color: var(--brand-hover);
  background: var(--brand-hover);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.chip {
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
}

.chip:hover {
  background: #d8eee9;
}

.filter-hint {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--muted);
  font-size: 13px;
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.skill-card {
  display: grid;
  gap: 14px;
  min-height: 260px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.skill-card:hover {
  border-color: #d0d5dd;
  box-shadow: 0 12px 24px rgba(16, 24, 40, 0.06);
}

.card-head {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: start;
}

.file-badge {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
}

.card-head h2 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.32;
}

.card-head p,
.description {
  color: var(--muted);
}

.card-head p {
  margin: 0;
  font-size: 13px;
  font-weight: 650;
}

.description {
  display: -webkit-box;
  min-height: calc(1.58em * 4);
  max-height: calc(1.58em * 4);
  margin-bottom: 0;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.58;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 26px;
}

.tag-row span,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--soft);
  color: #475467;
  font-size: 12px;
  font-weight: 750;
}

.meta-line,
.detail-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0;
}

.meta-line {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.meta-line div,
.detail-list div {
  padding: 0;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

dd {
  margin: 3px 0 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 850;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-self: end;
}

.primary-btn,
.ghost-btn {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 800;
  white-space: nowrap;
}

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

.primary-btn:hover {
  border-color: var(--brand-hover);
  background: var(--brand-hover);
}

.ghost-btn {
  border-color: var(--line);
  background: white;
  color: #344054;
}

.ghost-btn:hover,
.icon-button:hover {
  border-color: #d0d5dd;
  background: var(--soft-2);
}

.wide {
  width: 100%;
}

.empty-state {
  display: grid;
  min-height: 160px;
  place-items: center;
  gap: 10px;
  border: 1px dashed #d0d5dd;
  border-radius: 12px;
  background: white;
  color: var(--muted);
}

.admin-shell {
  padding: 24px 32px 40px;
}

.login-panel {
  width: min(420px, calc(100vw - 32px));
  margin: 8vh auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-mark {
  margin-bottom: 22px;
}

.stack-form,
.inline-form,
.upload-form {
  display: grid;
  gap: 12px;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  outline: 0;
  font-size: 14px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(21, 94, 117, 0.2);
  outline-offset: 2px;
}

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

.admin-head,
.metric-row,
.span-2 {
  grid-column: 1 / -1;
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.admin-head h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 32px);
}

.metric-row {
  grid-template-columns: repeat(5, minmax(120px, 1fr));
}

.admin-section {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

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

.section-title h2 {
  margin: 0;
  font-size: 18px;
}

.inline-form {
  grid-template-columns: minmax(150px, 1fr) minmax(190px, 1.3fr) 92px 88px;
  align-items: end;
  margin-bottom: 14px;
}

.inline-form .primary-btn {
  grid-column: 1 / -1;
  justify-self: end;
}

.toggle {
  display: flex;
  align-items: center;
  min-height: 40px;
  color: var(--text);
}

.toggle input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--brand);
}

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

.form-alert {
  grid-column: 1 / -1;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  font-size: 13px;
}

.form-alert strong {
  display: block;
  margin-bottom: 4px;
}

.form-alert p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.form-alert ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.5;
}

.form-alert.success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.form-alert.warning {
  border-color: #fed7aa;
  background: var(--warning-soft);
  color: #92400e;
}

.form-alert.error {
  border-color: #fecaca;
  background: var(--error-soft);
  color: #991b1b;
}

.upload-form.compact {
  margin-top: 18px;
}

.data-table {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  background: white;
}

.skill-table table {
  min-width: 760px;
}

th,
td {
  padding: 11px 12px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  color: var(--text);
  font-size: 13px;
}

thead th,
tr:first-child th {
  border-top: 0;
}

th {
  color: var(--muted);
  background: var(--soft-2);
  font-size: 12px;
  font-weight: 850;
  text-transform: none;
}

td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  min-width: 92px;
}

.icon-button {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-color: var(--line);
  background: white;
  color: var(--muted);
}

.icon-button.danger {
  color: var(--error);
}

.status.published {
  background: var(--success-soft);
  color: #166534;
}

.status.draft {
  background: #fef3c7;
  color: #92400e;
}

.status.archived {
  background: var(--soft);
  color: #475467;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 24, 39, 0.42);
}

.modal-panel {
  position: relative;
  width: min(560px, 100%);
  max-height: min(760px, 92vh);
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal-panel.large {
  width: min(760px, 100%);
}

.close-modal {
  position: absolute;
  top: 14px;
  right: 14px;
}

.modal-copy {
  color: var(--muted);
  line-height: 1.65;
}

.detail-list {
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 16px 0;
}

.detail-list div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft-2);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 14px;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  background: #f0fdf4;
  color: #166534;
  box-shadow: 0 14px 28px rgba(16, 24, 40, 0.12);
  font-size: 14px;
  font-weight: 750;
}

.toast.error {
  border-color: #fecaca;
  background: var(--error-soft);
  color: #991b1b;
}

button:disabled {
  cursor: progress;
  opacity: 0.62;
}

.fatal {
  margin: 20vh auto;
  width: min(520px, 90vw);
  padding: 20px;
  border: 1px solid #fecaca;
  border-radius: 12px;
  background: white;
  color: #991b1b;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 240px minmax(0, 1fr);
  }

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

  .quick-stats {
    grid-auto-flow: row;
    grid-template-columns: repeat(4, minmax(86px, 1fr));
    width: 100%;
  }

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

@media (max-width: 900px) {
  .topbar {
    padding: 10px 18px;
  }

  .workspace,
  .admin-shell {
    padding: 18px;
  }

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

  .filter-rail {
    position: static;
    max-height: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-group + .filter-group {
    padding-top: 0;
    padding-left: 18px;
    border-top: 0;
    border-left: 1px solid var(--line);
  }

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

  .chip-row {
    justify-content: flex-start;
  }

  .metric-row {
    grid-auto-flow: row;
    grid-template-columns: repeat(2, 1fr);
  }

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

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

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

  .brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 12px;
  }

  .tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .tabs button {
    padding: 0 10px;
  }

  .workspace,
  .admin-shell {
    padding: 14px;
  }

  .filter-rail {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .filter-group + .filter-group {
    padding-top: 16px;
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .hero-strip {
    padding: 18px;
  }

  h1 {
    font-size: 26px;
  }

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

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

  .meta-line,
  .detail-list,
  .card-actions {
    grid-template-columns: 1fr;
  }

  .admin-head {
    align-items: stretch;
    flex-direction: column;
    padding: 18px;
  }

  .metric-row {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    padding: 12px;
  }

  .modal-panel {
    max-height: 94vh;
    padding: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
