:root {
  --bg: #08070d;
  --panel: #12101a;
  --panel-2: #191527;
  --line: #2e2840;
  --text: #f4f0ff;
  --muted: #a89dbd;
  --violet: #8b5cf6;
  --violet-2: #6d28d9;
  --cyan: #22d3ee;
  --green: #34d399;
  --danger: #fb7185;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
  background:
    linear-gradient(135deg, rgba(139, 92, 246, 0.16), transparent 34%),
    linear-gradient(315deg, rgba(34, 211, 238, 0.08), transparent 28%),
    var(--bg);
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(12, 10, 18, 0.92);
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(139, 92, 246, 0.72);
  background: #171124;
  color: #ffffff;
  font-weight: 800;
  border-radius: 8px;
  box-shadow: inset 0 0 24px rgba(139, 92, 246, 0.22);
}

.brand-mark.large {
  width: 56px;
  height: 56px;
  font-size: 1.35rem;
}

.brand-name {
  font-size: 1rem;
  font-weight: 800;
}

.brand-state {
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: 2px;
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tab,
.ghost-button,
.secondary-button,
.primary-button,
.icon-button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--text);
  background: #14111f;
  padding: 0 14px;
}

.nav-tab {
  text-align: left;
}

.nav-tab.active {
  border-color: rgba(139, 92, 246, 0.8);
  background: #211735;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.ghost-button {
  background: transparent;
}

.ghost-link {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--text);
  background: transparent;
  padding: 9px 14px;
  text-decoration: none;
  text-align: center;
}

.download-link {
  display: inline-flex;
  margin: -8px 0 18px;
  color: var(--cyan);
  text-decoration: none;
}

.ghost-button:hover,
.ghost-link:hover,
.secondary-button:hover,
.icon-button:hover {
  border-color: rgba(139, 92, 246, 0.78);
}

.danger {
  color: var(--danger);
}

.primary-button {
  border-color: rgba(139, 92, 246, 0.95);
  background: #7c3aed;
  font-weight: 800;
}

.secondary-button {
  background: #191527;
}

.main {
  min-width: 0;
}

.auth-panel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-box {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  background: rgba(18, 16, 26, 0.94);
  box-shadow: var(--shadow);
  border-radius: 8px;
  padding: 28px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.75rem;
}

h2 {
  font-size: 1.1rem;
}

p {
  color: var(--muted);
  margin-top: 4px;
}

.auth-form,
.settings-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

input,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d0b13;
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

input:focus,
textarea:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}

textarea {
  min-height: 130px;
  resize: vertical;
}

.workspace {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.toolbar {
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(9, 8, 14, 0.72);
}

.view {
  display: none;
  padding: 20px;
}

.view.active {
  display: block;
}

.vault-grid {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 18px;
  min-height: calc(100vh - 112px);
}

.entry-list,
.entry-editor,
.tool-panel {
  border: 1px solid var(--line);
  background: rgba(18, 16, 26, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.entry-list {
  overflow: auto;
  padding: 8px;
}

.entry-item {
  width: 100%;
  min-height: 62px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  padding: 10px;
  display: grid;
  gap: 4px;
}

.entry-item:hover,
.entry-item.active {
  border-color: rgba(139, 92, 246, 0.6);
  background: #191527;
}

.entry-item span {
  color: var(--muted);
  font-size: 0.84rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-editor {
  padding: 18px;
}

.editor-header,
.tool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

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

.span-2 {
  grid-column: 1 / -1;
}

.password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
}

.tool-panel {
  max-width: 760px;
  padding: 22px;
  display: grid;
  gap: 18px;
}

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

.checks label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checks input {
  width: 18px;
  height: 18px;
}

.generated-output {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d0b13;
  padding: 16px;
  color: var(--cyan);
  overflow-wrap: anywhere;
}

.status-pill {
  border: 1px solid rgba(52, 211, 153, 0.5);
  color: var(--green);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.84rem;
}

.security-lines {
  display: grid;
  gap: 10px;
}

.import-panel {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.import-status {
  color: var(--muted);
  min-height: 20px;
  overflow-wrap: anywhere;
}

.security-lines div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.security-lines span {
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  border: 1px solid var(--line);
  background: #171124;
  color: var(--text);
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.downloads-page {
  min-height: 100vh;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(139, 92, 246, 0.16), transparent 34%),
    linear-gradient(315deg, rgba(34, 211, 238, 0.08), transparent 28%),
    var(--bg);
}

.downloads-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1120px;
  margin: 0 auto 44px;
}

.download-brand {
  color: var(--text);
  text-decoration: none;
}

.download-brand span {
  display: block;
}

.download-hero,
.download-layout {
  max-width: 1120px;
  margin: 0 auto;
}

.download-hero {
  margin-bottom: 24px;
}

.download-hero h1 {
  font-size: clamp(2rem, 4vw, 4rem);
  max-width: 860px;
}

.download-hero p {
  max-width: 720px;
  font-size: 1.05rem;
}

.download-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 18px;
}

.release-list {
  display: grid;
  gap: 10px;
}

.release-empty,
.release-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d0b13;
  padding: 14px;
}

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

.release-item span {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.security-lines a {
  color: var(--cyan);
  text-decoration: none;
}

.hidden {
  display: none !important;
}

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

  .sidebar {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nav-tab {
    text-align: center;
  }

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

  .download-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 620px) {
  .toolbar,
  .form-grid,
  .checks,
  .password-row,
  .downloads-header,
  .release-item {
    grid-template-columns: 1fr;
  }

  .downloads-header,
  .release-item {
    display: grid;
    align-items: stretch;
  }

  .toolbar {
    align-items: stretch;
  }

  .auth-panel,
  .view {
    padding: 14px;
  }

  .auth-box,
  .tool-panel,
  .entry-editor {
    padding: 16px;
  }
}
