:root {
  --bg: #f3efe6;
  --ink: #191919;
  --muted: #6e6a63;
  --accent: #1f6f54;
  --accent-strong: #14543f;
  --accent-warm: #f4a340;
  --panel: #ffffff;
  --stroke: rgba(25, 25, 25, 0.12);
  --shadow: 0 24px 60px rgba(25, 25, 25, 0.12);
  --radius: 18px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

.dashboard-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 20% 10%, rgba(244, 163, 64, 0.18), transparent 45%),
    radial-gradient(circle at 80% 0%, rgba(31, 111, 84, 0.2), transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(31, 111, 84, 0.18), transparent 45%);
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 6vw;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(243, 239, 230, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(25, 25, 25, 0.05);
}

.logo {
  font-family: 'Syne', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  box-shadow: 0 12px 24px rgba(27, 26, 24, 0.08);
  font-size: 0.85rem;
}

.user-badge img {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  object-fit: cover;
}

.user-badge span {
  color: var(--muted);
  display: block;
  font-size: 0.75rem;
}

.btn {
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-size: 0.9rem;
}

.btn.solid {
  background: var(--accent);
  color: #fff;
}

.btn.outline {
  border-color: var(--accent);
  color: var(--accent);
}

.btn.ghost {
  border-color: var(--stroke);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.6);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.35fr) minmax(0, 1fr);
  gap: 24px;
  padding: 20px 6vw 60px;
}

.panel {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
}

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

.panel-subtext {
  color: var(--muted);
  font-size: 0.9rem;
}

.key-list {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.key-list.empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.key-item {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.key-item span {
  color: var(--muted);
}

.active-key {
  margin-top: 20px;
  display: grid;
  gap: 10px;
}

.active-key label {
  font-weight: 600;
}

.field-group {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

input,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  font-family: inherit;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.8);
}

textarea {
  resize: vertical;
}

.note {
  font-size: 0.8rem;
  color: var(--muted);
}

.key-reveal {
  margin-top: 20px;
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed rgba(27, 26, 24, 0.2);
  background: rgba(244, 163, 64, 0.12);
  display: grid;
  gap: 8px;
}

.key-reveal code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  word-break: break-all;
}

.data-panel .panel-head {
  flex-wrap: wrap;
}

.search-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.storage-meter {
  width: 100%;
  height: 8px;
  background: rgba(27, 26, 24, 0.1);
  border-radius: 999px;
  overflow: hidden;
  margin: 16px 0 22px;
}

.storage-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-warm));
  transition: width 0.5s ease;
}

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

.table-head,
.table-row {
  display: grid;
  grid-template-columns: 1.2fr 1.4fr 0.7fr 1fr 1.2fr;
  gap: 12px;
  align-items: center;
}

.table-head {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.85rem;
}

.table-row {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.85);
}

.table-row code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
}

.table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

.editor {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--stroke);
}

.editor-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
  margin-top: 0;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  justify-content: flex-end;
}

.login-gate {
  position: fixed;
  inset: 0;
  background: rgba(18, 18, 18, 0.25);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.login-card {
  background: var(--panel);
  padding: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  max-width: 420px;
  text-align: center;
}

.login-actions {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.9rem;
  z-index: 30;
}

.admin-panel {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 50;
  padding: 24px 6vw;
  overflow-y: auto;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
  margin: 32px 0;
}

.stat-card {
  background: var(--panel);
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
}

.stat-card h3 {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.stat-card p {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  font-family: 'Syne', sans-serif;
}

.admin-users {
  background: var(--panel);
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
}

@media (max-width: 1000px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .table-head,
  .table-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      'id filename'
      'size updated'
      'actions actions';
  }

  .table-row > :nth-child(1) {
    grid-area: id;
  }
  .table-row > :nth-child(2) {
    grid-area: filename;
  }
  .table-row > :nth-child(3) {
    grid-area: size;
  }
  .table-row > :nth-child(4) {
    grid-area: updated;
  }
  .table-row > :nth-child(5) {
    grid-area: actions;
  }
}

@media (max-width: 640px) {
  .header-actions {
    flex-direction: column;
    align-items: flex-end;
  }

  .search-actions {
    width: 100%;
  }

  .btn {
    width: 100%;
  }
}
