:root {
  --bg: #FFFAF3;
  --surface: #FFFFFF;
  --surface-hover: #F4EFEA;
  --border: #E8DDD3;
  --border-subtle: #F0E8E0;
  --text: #575279;
  --text-muted: #6E6A86;
  --accent: #3788BE;
  --accent-hover: #2C6D9E;
  --accent-light: #7397DE;
  --accent-wash: rgba(55, 136, 190, 0.08);
  --accent-warm: #C8A299;
  --success: #5A9A6E;
  --error: #D26A5D;
  --radius: 10px;
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'DM Serif Display', Georgia, serif;
  --shadow-sm: 0 1px 3px rgba(87, 82, 121, 0.06), 0 1px 2px rgba(87, 82, 121, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(87, 82, 121, 0.07), 0 2px 4px -2px rgba(87, 82, 121, 0.05);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg: #13111C;
  --surface: #1C1929;
  --surface-hover: #252137;
  --border: rgba(160, 140, 220, 0.15);
  --border-subtle: rgba(160, 140, 220, 0.08);
  --text: #E0DBF5;
  --text-muted: #9B93C0;
  --accent: #8B7CF6;
  --accent-hover: #7560E0;
  --accent-light: #A99BFD;
  --accent-wash: rgba(139, 124, 246, 0.1);
  --accent-warm: #B8A0D4;
  --success: #A3D9A5;
  --error: #E88B8B;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.35), 0 2px 4px -2px rgba(0, 0, 0, 0.25);
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  line-height: 1.6;
  font-size: 0.925rem;
}

header {
  text-align: center;
  margin-bottom: 2rem;
  position: relative;
}

header h1 {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--text);
}

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

.subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.25rem;
  font-weight: 400;
}

/* Theme toggle */
.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.4rem 0.55rem;
  line-height: 1;
  transition: all 0.2s var(--ease);
  box-shadow: var(--shadow-sm);
  z-index: 50;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow-md);
}

/* Two-column layout */
.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2rem;
  width: 100%;
  max-width: 960px;
}

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: sticky;
  top: 2rem;
  align-self: start;
}

.utilities {
  min-width: 0;
}

/* Navigation tabs */
nav {
  display: flex;
  gap: 0.25rem;
  background: var(--surface);
  padding: 0.25rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.tab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem 1.25rem;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.tab:hover {
  color: var(--text);
  background: var(--accent-wash);
}

.tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

/* Main content */
main {
  width: 100%;
}

.panel {
  display: none;
}

.panel.active {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: var(--shadow-sm);
}

.card h2 {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--text);
  text-transform: none;
  letter-spacing: -0.01em;
}

/* Inputs */
textarea, input[type="text"], input[type="number"], input[type="date"] {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.875rem;
  padding: 0.6rem 0.75rem;
  width: 100%;
  resize: vertical;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

::placeholder {
  color: var(--accent-warm);
  opacity: 0.55;
}

textarea:focus, input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

input[type="number"], input[type="date"] {
  width: auto;
}

/* Checkbox options */
.options-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.options-row label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
}

.options-row input[type="checkbox"] {
  accent-color: var(--accent);
}

/* Buttons */
.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.6rem 1.25rem;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease);
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: scale(0.98);
}

.btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-copy {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
  background: var(--bg);
  border: none;
  border-left: 1px solid var(--border);
  border-radius: 0 calc(var(--radius) - 3px) calc(var(--radius) - 3px) 0;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 0.5rem;
  font-size: 0.75rem;
  opacity: 0;
  transition: all 0.2s var(--ease);
  flex-shrink: 0;
}

.output-row:hover .btn-copy,
.btn-copy:focus-visible {
  opacity: 1;
}

.btn-copy:hover {
  color: var(--accent);
  background: var(--accent-wash);
}

/* Output */
output {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 0.6rem 0.75rem;
  font-size: 0.8rem;
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'JetBrains Mono', monospace;
  word-break: break-all;
  white-space: pre-wrap;
  min-height: 2rem;
  color: var(--success);
}

output.error {
  color: var(--error);
}

.output-row {
  position: relative;
  display: flex;
  align-items: flex-start;
}

.output-row output {
  flex: 1;
  padding-right: 2.5rem;
}

/* Labels */
.hash-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-warm);
  min-width: 52px;
  padding-top: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Date rows */
.date-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.date-row label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
}

/* Footer */
footer {
  margin-top: 3rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.8rem;
  opacity: 0;
  transition: all 0.3s var(--ease);
  pointer-events: none;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .dashboard {
    position: static;
  }
}

@media (max-width: 480px) {
  body {
    padding: 1rem 0.75rem;
  }

  header h1 {
    font-size: 1.5rem;
  }

  nav {
    width: 100%;
  }

  .tab {
    flex: 1;
    text-align: center;
    padding: 0.5rem 0.5rem;
    font-size: 0.75rem;
  }

  .date-row {
    flex-direction: column;
    align-items: stretch;
  }
}
