/* Ruby Portal — unified tablet design system (zinc shell + per-app accent) */

:root {
  --shell-bg: #09090b;
  --shell-surface: #111113;
  --shell-surface-2: #18181b;
  --shell-border: rgba(255, 255, 255, 0.07);
  --shell-text: #fafafa;
  --shell-muted: #71717a;
  --shell-radius: 12px;
  --shell-sidebar-w: 248px;
  --shell-topbar-h: 56px;
}

/* Map shared tablet-ui tokens to shell palette */
body.tablet-bg {
  --bg: var(--shell-bg);
  --bg-elevated: var(--shell-surface);
  --panel: rgba(24, 24, 27, 0.72);
  --panel-solid: var(--shell-surface-2);
  --glass: rgba(17, 17, 19, 0.82);
  --border: var(--shell-border);
  --text: var(--shell-text);
  --text-secondary: rgba(250, 250, 250, 0.72);
  --muted: var(--shell-muted);
}

body.tablet-bg.tablet-bg {
  background:
    radial-gradient(ellipse 70% 45% at 100% 0%, var(--accent-glow), transparent 55%),
    radial-gradient(ellipse 50% 40% at 0% 100%, rgba(39, 39, 42, 0.35), transparent 50%),
    var(--shell-bg);
}

/* —— Theme accents —— */
body.theme-neutral,
body.theme-ruby,
body.ruby-hub,
body.ruby-app,
body.ruby-system {
  --accent: #e11d48;
  --accent-hover: #f43f5e;
  --accent-soft: rgba(225, 29, 72, 0.16);
  --accent-glow: rgba(225, 29, 72, 0.12);
  --border-strong: rgba(255, 255, 255, 0.14);
  --shadow-glow: 0 0 48px rgba(225, 29, 72, 0.2);
}

body.theme-blacknet,
body.blacknet-app {
  --accent: #dc2626;
  --accent-hover: #ef4444;
  --accent-soft: rgba(220, 38, 38, 0.14);
  --accent-glow: rgba(220, 38, 38, 0.12);
  --border-strong: rgba(220, 38, 38, 0.28);
  --shadow-glow: 0 0 40px rgba(220, 38, 38, 0.1);
}

body.theme-warenhandel,
body.warenhandel-app {
  --accent: #e11d48;
  --accent-hover: #f43f5e;
  --accent-soft: rgba(225, 29, 72, 0.14);
  --accent-glow: rgba(225, 29, 72, 0.12);
  --border-strong: rgba(225, 29, 72, 0.28);
  --shadow-glow: 0 0 40px rgba(225, 29, 72, 0.1);
}

body.theme-duty,
.dp-app {
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-soft: rgba(59, 130, 246, 0.14);
  --accent-glow: rgba(59, 130, 246, 0.12);
  --border-strong: rgba(59, 130, 246, 0.28);
  --shadow-glow: 0 0 40px rgba(59, 130, 246, 0.08);
}

.dp-app--medical {
  --accent: #ef4444;
  --accent-hover: #f87171;
  --accent-soft: rgba(239, 68, 68, 0.14);
  --accent-glow: rgba(239, 68, 68, 0.12);
  --border-strong: rgba(239, 68, 68, 0.28);
}

/* —— Unified chrome (topbar + sidebar + page head) —— */
.chrome-topbar {
  display: grid;
  grid-template-columns: var(--shell-sidebar-w) 1fr auto;
  align-items: center;
  gap: 16px;
  min-height: var(--shell-topbar-h);
  padding: 12px 16px 12px 14px;
  border-bottom: 1px solid var(--shell-border);
  background: var(--shell-surface);
  flex-shrink: 0;
  z-index: 2;
}

.chrome-topbar-start {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.chrome-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  flex-shrink: 0;
}

.chrome-topbar-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.chrome-wordmark {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--shell-text);
}

.chrome-topbar-meta {
  font-size: 0.75rem;
  color: var(--shell-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chrome-topbar-context {
  margin: 0;
  font-size: 0.82rem;
  color: var(--shell-muted);
  white-space: nowrap;
  justify-self: start;
  padding-left: 4px;
}

.chrome-topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chrome-icon-btn,
.chrome-text-btn {
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--shell-muted);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 8px 10px;
  transition: color 0.15s ease, background 0.15s ease;
}

.chrome-icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 1rem;
}

.chrome-icon-btn:hover,
.chrome-text-btn:hover {
  color: var(--shell-text);
  background: rgba(255, 255, 255, 0.04);
}

.chrome-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  width: var(--shell-sidebar-w);
  padding: 12px 10px 14px;
  background: var(--shell-surface);
  border-right: 1px solid var(--shell-border);
  overflow: hidden;
}

.chrome-sidebar-nav {
  display: grid;
  gap: 4px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.chrome-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 36px;
  text-align: left;
  padding: 7px 9px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #a1a1aa;
  font-size: 0.84rem;
  font-weight: 450;
  transition: color 0.18s ease, background 0.18s ease;
}

.chrome-nav-item:hover:not(:disabled) {
  color: #e4e4e7;
  background: rgba(255, 255, 255, 0.04);
}

.chrome-nav-item.is-active,
.chrome-nav-item.app-nav-item-active {
  color: #fafafa;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 2px 0 0 rgba(255, 255, 255, 0.18);
}

.chrome-nav-item:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.shell-page-head,
.chrome-page-head {
  padding: 22px 28px 0;
}

.shell-page-head h1,
.chrome-page-head h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--shell-text);
}

.shell-page-head p,
.chrome-page-head p {
  margin: 6px 0 0;
  font-size: 0.88rem;
  color: #a1a1aa;
}

.app-shell .app-main {
  background: #0c0c0f;
}

.app-shell .app-content {
  padding: 20px 28px 32px;
  display: grid;
  gap: 14px;
  align-content: start;
}

/* Align legacy app-shell with unified chrome */
.app-layout {
  grid-template-columns: var(--shell-sidebar-w) 1fr;
}

.app-sidebar {
  border-right: 1px solid var(--shell-border);
  background: var(--shell-surface);
  backdrop-filter: none;
  padding: 12px 10px 14px;
}

.app-nav-item-active {
  color: #fafafa !important;
  background: rgba(255, 255, 255, 0.05) !important;
  box-shadow: inset 2px 0 0 rgba(255, 255, 255, 0.18) !important;
}

.app-topbar {
  border-bottom: 1px solid var(--shell-border);
  background: var(--shell-surface);
}

.shell-panel,
.glass-panel {
  background: var(--shell-surface);
  border: 1px solid var(--shell-border);
  border-radius: 12px;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

.shell-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px 20px;
  border-radius: 12px;
  border: 1px solid var(--shell-border);
  background: var(--shell-surface);
}

.shell-hero-label {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--shell-muted);
  text-transform: capitalize;
  letter-spacing: normal;
}

.shell-hero h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--shell-text);
}

.shell-hero-meta {
  margin: 8px 0 0;
  font-size: 0.88rem;
  color: #a1a1aa;
}

.shell-hero-aside {
  text-align: right;
  padding: 16px 20px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  background: linear-gradient(135deg, var(--accent-soft), rgba(24, 24, 27, 0.95));
  min-width: min(200px, 100%);
}

.shell-hero-aside-label {
  display: block;
  font-size: 0.72rem;
  color: var(--shell-muted);
}

.shell-hero-aside strong {
  display: block;
  margin-top: 4px;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--shell-text);
}

.shell-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.shell-stat {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--shell-border);
  background: var(--shell-surface);
}

.shell-stat-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--shell-muted);
  text-transform: capitalize;
  letter-spacing: normal;
}

.shell-stat-value {
  display: block;
  margin-top: 6px;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--shell-text);
}

.shell-stat-hint {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
  color: #a1a1aa;
}

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

.shell-panel-head h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.shell-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.05);
  color: #a1a1aa;
  font-size: 0.78rem;
  font-weight: 500;
}

.shell-pill--accent {
  background: var(--accent-soft);
  color: color-mix(in srgb, var(--accent) 70%, white);
}

.shell-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.shell-list li {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--shell-border);
}

.shell-list strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
}

.shell-list span {
  display: block;
  margin-top: 2px;
  font-size: 0.78rem;
  color: #a1a1aa;
}

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

.shell-grid-2 .shell-panel--wide {
  grid-column: 1 / -1;
}

.shell-panel {
  padding: 16px 18px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.primary-button {
  box-shadow: none;
}

.primary-button {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 35%, transparent);
}

.primary-button:hover {
  background: var(--accent-hover);
}

.secondary-button {
  background: var(--accent-soft);
  color: color-mix(in srgb, var(--accent) 65%, white);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}

.pill {
  background: var(--accent-soft);
  color: color-mix(in srgb, var(--accent) 70%, white);
}

.icon-button {
  color: color-mix(in srgb, var(--accent) 70%, white);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}

.icon-button:hover {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}

.tablet-input:focus,
.tablet-select:focus,
.tablet-textarea:focus {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
}
