/* Royal Farm dashboard — match Tauri desktop shell tokens & boot UI */

:root {
  --bg-base: #09090b;
  --bg-surface: #0f0f11;
  --bg-elevated: #18181b;
  --bg-hover: #1f1f23;
  --bg-active: #27272a;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #fafafa;
  --accent-hover: #e4e4e7;
  --accent-dim: rgba(255, 255, 255, 0.08);
  --danger: #f87171;
  --titlebar-h: 38px;
  --sidebar-w: 200px;
  --radius: 8px;
  --radius-sm: 6px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", monospace;
  --transition: 150ms ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
}

body.boot-active .app-shell {
  display: none !important;
}

body:not(.boot-active) #boot-overlay {
  display: none !important;
}

/* —— Boot (login) — same as Tauri boot.css —— */

.boot-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
}

.boot-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: var(--titlebar-h);
  padding: 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.boot-topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  min-width: 0;
}

.boot-topbar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  overflow: hidden;
}

.boot-topbar-logo img {
  display: block;
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.boot-topbar-brand {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.boot-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-base);
}

.boot-card {
  width: min(440px, 100%);
  padding: 28px 24px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-surface);
}

.boot-card-head {
  margin-bottom: 16px;
}

.boot-card h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.boot-login {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.boot-login-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.boot-login-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font: inherit;
  font-size: 14px;
}

.boot-login-input:focus {
  outline: none;
  border-color: var(--border-strong);
}

.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.boot-password-wrap .boot-login-input {
  padding-right: 40px;
}

.password-toggle {
  position: absolute;
  right: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition);
}

.password-toggle svg {
  color: #fff;
  stroke: #fff;
}

.password-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
}

.password-toggle:active {
  opacity: 0.85;
}

.password-toggle .icon-eye-closed[hidden],
.password-toggle .icon-eye-open[hidden] {
  display: none;
}

.boot-login-input[type="password"]::-ms-reveal,
.boot-login-input[type="password"]::-ms-clear {
  display: none;
}

.boot-auth-error {
  margin: 0;
  font-size: 12.5px;
  color: var(--danger);
}

.boot-login-actions {
  margin-top: 6px;
}

/* —— App shell —— */

.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--titlebar-h);
  padding: 0 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.titlebar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.app-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  overflow: hidden;
}

.app-logo-img {
  display: block;
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.app-brand {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.titlebar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.app-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 8px;
  flex: 1;
}

.sidebar-section-label {
  margin: 10px 8px 6px;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sidebar-soon {
  margin-top: 18px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 0;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  text-align: left;
}

.nav-item:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Active = same as hover (no blue accent bar) */
.nav-item.active {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 22px 24px;
  overflow: auto;
  background: var(--bg-base);
}

.view-head {
  margin-bottom: 18px;
}

.view-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-surface);
  padding: 20px 22px;
  max-width: 40rem;
}

.muted {
  color: var(--text-muted);
  font-size: 13px;
}

.release-meta {
  display: grid;
  gap: 12px 20px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 16px;
}

.meta-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mono {
  font-family: var(--mono);
  font-size: 12.5px;
}

.sha {
  word-break: break-all;
  font-size: 11px;
  color: var(--text-secondary);
}

.release-notes {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
  white-space: pre-wrap;
}

.release-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--bg-hover);
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 14px;
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--text-primary);
  color: #09090b;
  border-color: transparent;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}

@media (max-width: 720px) {
  .app-body {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .sidebar-section-label {
    width: 100%;
  }
}
