@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Manrope:wght@400;600;800&display=swap');

:root {
  --c-bg: #ffffff;
  --c-fg: #000000;
  --f-ui: 'Manrope', sans-serif;
  --f-mono: 'JetBrains Mono', monospace;
  --border-width: 2px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--c-bg);
  color: var(--c-fg);
  font-family: var(--f-ui);
  height: 100vh;
  overflow: hidden;
  display: flex;
  background-image: radial-gradient(#000 1px, transparent 1px);
  background-size: 40px 40px;
}

/* ================= Layout ================= */
.app-shell {
  display: flex;
  width: 100%;
  height: 100%;
}

.sidebar {
  width: 280px;
  background: var(--c-fg);
  color: var(--c-bg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 32px;
  position: relative;
  z-index: 10;
  transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.brand {
  font-family: var(--f-mono);
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -1px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 60px;
}

.brand::before {
  content: '';
  display: block;
  width: 20px;
  height: 20px;
  background: var(--c-bg);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 0 20%, 20% 0);
}

.nav-menu { list-style: none; display: flex; flex-direction: column; gap: 16px; }

.nav-item {
  font-family: var(--f-mono);
  font-size: 14px;
  text-transform: uppercase;
  padding: 12px 0;
  cursor: pointer;
  opacity: 0.6;
  transition: all 0.2s;
  display: flex;
  align-items: center; gap: 10px;
}

.nav-item:hover, .nav-item.active {
  opacity: 1;
  padding-left: 10px;
}

.nav-item.active::before { content: '>'; font-weight: bold; }

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.content-header {
  height: 80px;
  border-bottom: var(--border-width) solid var(--c-fg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  background: var(--c-bg);
}

.page-title h1 {
  font-family: var(--f-mono);
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.scroll-area { flex: 1; overflow-y: auto; padding: 40px; }

/* ================= Stats ================= */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 60px; }

.stat-card {
  border: var(--border-width) solid var(--c-fg);
  padding: 24px;
  background: var(--c-bg);
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: translate(-4px, -4px);
  box-shadow: 4px 4px 0 var(--c-fg);
}

.stat-label { font-family: var(--f-mono); font-size: 12px; text-transform: uppercase; margin-bottom: 16px; }
.stat-value { font-size: 48px; font-weight: 800; line-height: 1; letter-spacing: -2px; }

/* ================= Elements ================= */
.input-brutalist {
  width: 100%;
  height: 48px;
  border: var(--border-width) solid var(--c-fg);
  background: transparent;
  font-family: var(--f-mono);
  font-size: 14px;
  padding: 0 20px;
  outline: none;
}

.btn {
  height: 48px;
  padding: 0 32px;
  border: var(--border-width) solid var(--c-fg);
  background: var(--c-bg);
  font-family: var(--f-mono);
  font-weight: bold;
  text-transform: uppercase;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}

.btn-primary { background: var(--c-fg); color: var(--c-bg); }
.btn-primary:hover { background: var(--c-bg); color: var(--c-fg); }

/* NEW: Seamless Inputs for Detail View */
.input-seamless {
  width: 100%;
  border: none;
  border-bottom: 1px dashed #ccc;
  background: transparent;
  font-family: var(--f-mono);
  font-size: 14px;
  padding: 4px 0;
  outline: none;
  color: var(--c-fg);
  transition: all 0.2s;
}
.input-seamless:focus {
  border-bottom: 2px solid var(--c-fg);
  background: rgba(0,0,0,0.02);
  padding-left: 8px;
}
.input-seamless:disabled {
  border-bottom: none;
  color: #666;
  cursor: not-allowed;
  background: transparent;
}
select.input-seamless {
  cursor: pointer;
  appearance: none;
  background-image: url('data:image/svg+xml;utf8,<svg width="10" height="6" viewBox="0 0 10 6" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 0L5 6L10 0H0Z" fill="black"/></svg>');
  background-repeat: no-repeat;
  background-position: right 0 center;
}

/* ================= Table ================= */
.table-wrapper { border: var(--border-width) solid var(--c-fg); background: var(--c-bg); }
.table-header-deco {
  height: 24px; background: var(--c-fg); color: var(--c-bg);
  font-family: var(--f-mono); font-size: 10px;
  display: flex; align-items: center; padding: 0 12px; justify-content: space-between;
}

table { width: 100%; border-collapse: collapse; }
th {
  font-family: var(--f-mono); font-size: 12px; text-align: left;
  padding: 16px 20px; border-bottom: var(--border-width) solid var(--c-fg);
  background: #f0f0f0;
}
td { padding: 16px 20px; border-bottom: 1px solid #e0e0e0; font-size: 14px; }

/* ================= Modals ================= */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(255, 255, 255, 0.9);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }

.modal {
  background: var(--c-bg); border: var(--border-width) solid var(--c-fg);
  width: 100%; max-width: 500px; box-shadow: 12px 12px 0 var(--c-fg);
  transform: translateY(20px); transition: transform 0.2s;
}
.modal-overlay.show .modal { transform: translateY(0); }

.modal-header { background: var(--c-fg); color: var(--c-bg); padding: 16px 24px; font-family: var(--f-mono); font-weight: bold; }
.modal-body { padding: 32px 24px; }
.form-actions { padding: 24px; border-top: var(--border-width) solid var(--c-fg); display: flex; justify-content: flex-end; gap: 12px; }

.hidden { display: none !important; }

/* ================= Mobile ================= */
@media (max-width: 768px) {
  .app-shell { flex-direction: column; }
  .stats-grid { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; }
  /* Table Card View */
  table, thead, tbody, th, td, tr { display: block; }
  thead tr { position: absolute; top: -9999px; left: -9999px; }
  tr { border: 2px solid var(--c-fg); margin-bottom: 20px; }
  td { position: relative; padding-left: 50%; text-align: right; border-bottom: 1px solid #eee; }
  td:before { position: absolute; left: 12px; content: attr(data-label); font-family: var(--f-mono); font-weight: bold; font-size: 12px; }
}