* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
}
.page {
  min-height: 100vh;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: #0b1220;
  border-bottom: 1px solid #1f2a44;
}
.brand {
  font-weight: 800;
  font-size: 18px;
}
.user {
  color: #94a3b8;
  font-size: 13px;
  margin-left: auto;
}
.admin-btn {
  width: auto;
  background: transparent;
  border: 1px solid #223055;
  color: #cbd5e1;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  text-decoration: none;
}
.admin-btn:hover {
  background: #111c33;
}
.logout {
  color: #cbd5e1;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #223055;
}
.logout:hover {
  background: #111c33;
}
.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 60px);
}
.sidebar {
  background: #0b1220;
  border-right: 1px solid #1f2a44;
  padding: 16px;
}
.sidebar-section {
  margin-bottom: 16px;
}
.sidebar-title {
  font-weight: 700;
  margin-bottom: 6px;
}
.mini-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}
.mini-form input,
.mini-form select,
.mini-form button {
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 8px;
}
.mini-form button.ghost {
  width: 100%;
}
.mini-btn {
  width: 100%;
  margin-bottom: 8px;
}
.modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal.open {
  display: flex;
}
.modal-content {
  background: #0b1220;
  border: 1px solid #1f2a44;
  border-radius: 14px;
  padding: 16px;
  width: 420px;
  max-width: 92vw;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.modal-title {
  font-weight: 700;
}
.modal-close {
  width: auto;
  background: transparent;
  border: 1px solid #223055;
  color: #cbd5e1;
  border-radius: 8px;
  padding: 2px 8px;
}
.sidebar-sub {
  color: #94a3b8;
  font-size: 12px;
}
.side-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.side-nav a {
  color: #cbd5e1;
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 8px;
}
.side-nav a:hover {
  background: #111c33;
}
.project-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.project-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid #223055;
  color: #cbd5e1;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
}
.project-btn:hover {
  background: #111c33;
}
.project-btn.active {
  background: #16264a;
  border-color: #16264a;
  color: #e2e8f0;
}
.tree {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tree-root {
  color: #cbd5e1;
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #223055;
}
.tree-root:hover {
  background: #111c33;
}
.tree-node {
  padding-left: 6px;
  border-left: 1px solid #1f2a44;
}
.tree-label {
  font-weight: 600;
  color: #e2e8f0;
  margin: 6px 0;
}
.tree-children {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 12px;
}
.tree-link, .tree-leaf {
  color: #cbd5e1;
  text-decoration: none;
  padding: 4px 6px;
  border-radius: 6px;
}
.tree-link:hover, .tree-leaf:hover {
  background: #111c33;
}
details > summary {
  cursor: pointer;
  color: #cbd5e1;
  padding: 4px 6px;
  border-radius: 6px;
}
details > summary:hover {
  background: #111c33;
}
.content {
  padding: 24px;
}
.card {
  background: #0b1220;
  border: 1px solid #1f2a44;
  border-radius: 14px;
  padding: 20px;
  max-width: 1100px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.icon-btn {
  width: auto;
  padding: 6px 10px;
  font-size: 16px;
}
.menu {
  position: relative;
}
.menu-dropdown {
  position: absolute;
  right: 0;
  top: 36px;
  min-width: 220px;
  background: #0b1220;
  border: 1px solid #1f2a44;
  border-radius: 10px;
  padding: 6px;
  display: none;
  z-index: 10;
}
.menu-dropdown.open {
  display: block;
}
.menu-item {
  width: 100%;
  background: transparent;
  border: none;
  color: #cbd5e1;
  text-align: left;
  padding: 6px 8px;
  border-radius: 8px;
}
.menu-item:hover {
  background: #111c33;
}
.card.narrow {
  max-width: 420px;
}
h1, h2 {
  margin: 0 0 12px 0;
}
h2 {
  margin-top: 24px;
}
label {
  display: block;
  margin: 12px 0 6px;
  color: #cbd5e1;
}
input, textarea, button, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #1f2a44;
  background: #0f172a;
  color: #e2e8f0;
}
code {
  color: #cbd5e1;
}
button {
  margin-top: 12px;
  background: #3b82f6;
  border: none;
  font-weight: 700;
  cursor: pointer;
}
button:hover {
  background: #2563eb;
}
button.ghost {
  background: transparent;
  border: 1px solid #223055;
  color: #cbd5e1;
  width: auto;
}
.actions {
  margin-top: 12px;
}
.grid {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8px;
}
.grid th, .grid td {
  border: 1px solid #1f2a44;
  padding: 6px;
}
.grid th {
  background: #0f172a;
  text-align: left;
}
.sum-row td {
  font-weight: 700;
  background: #0b1220;
}
.link {
  color: #93c5fd;
  text-decoration: none;
}
.link:hover {
  text-decoration: underline;
}
.block {
  border: 1px solid #1f2a44;
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 12px;
  background: #0f172a;
}
.grid input {
  width: 100%;
}
.alert {
  padding: 8px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
}
.alert.success {
  background: #0b2a1b;
  border: 1px solid #1f7a3a;
  color: #c7f9d4;
}
.alert.error {
  background: #3f1115;
  border: 1px solid #b91c1c;
  color: #fecaca;
}
.section {
  margin-bottom: 20px;
}
.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.inline {
  display: inline-block;
  margin-right: 8px;
}
.hint {
  color: #94a3b8;
  font-size: 13px;
  margin-bottom: 6px;
}
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid #1f2a44;
  }
  .grid, .grid thead {
    display: none;
  }
}
