@charset "utf-8";

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

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* App Shell Structure */
#app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
}

/* Top App Bar */
#app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  height: var(--header-height);
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  box-shadow: var(--elevation-1);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--text-primary);
}

.header-brand .brand-logo {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--primary);
  color: var(--primary-text);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-md);
}

.header-brand h1 {
  margin: 0;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.02em;
}

.header-brand h1 span {
  font-weight: normal;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

.header-status {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.header-status .btn {
  height: 32px;
  padding: 0 var(--space-3);
  text-decoration: none;
}

.date-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  background-color: var(--bg-surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}

.user-badge .user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: var(--bg-surface-sunken);
  border: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.user-badge .user-meta {
  display: flex;
  flex-direction: column;
}

.user-badge .user-name {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  line-height: 1.2;
}

.user-badge .user-role {
  font-size: var(--font-size-2xs);
  color: var(--text-muted);
  text-transform: uppercase;
}

/* App Body Layout: Sidebar + Workspace */
#app-body {
  display: flex;
  flex: 1;
  width: 100%;
  position: relative;
}

/* Navigation Drawer */
#app-drawer {
  width: var(--drawer-width);
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  padding: var(--space-3) 0;
  flex-shrink: 0;
  max-height: calc(100vh - var(--header-height));
  position: sticky;
  top: var(--header-height);
  overflow-y: auto;
}

.drawer-group {
  margin-bottom: var(--space-4);
}

.drawer-group-title {
  padding: var(--space-1) var(--space-4);
  font-size: var(--font-size-2xs);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.drawer-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.drawer-menu li {
  margin: 1px var(--space-2);
}

.drawer-menu a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  transition: background-color 150ms ease, color 150ms ease;
}

.drawer-menu a:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.drawer-menu a.active {
  background-color: var(--primary-light);
  color: var(--primary);
  font-weight: var(--font-weight-semibold);
}

.drawer-menu a .icon {
  font-size: 20px;
  color: inherit;
}

/* Main Workspace */
#app-main {
  flex: 1;
  padding: var(--space-6);
  min-width: 0;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
  gap: var(--space-3);
}

.workspace-title h2 {
  margin: 0;
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.workspace-title p {
  margin: var(--space-1) 0 0 0;
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.workspace-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* View Switching */
.app-view {
  display: none;
}

.app-view.current-view {
  display: block;
}

/* Responsive Rules */
@media (max-width: 1024px) {
  #app-drawer {
    position: fixed;
    left: -100%;
    top: var(--header-height);
    bottom: 0;
    z-index: var(--z-drawer);
    transition: left 250ms ease;
    box-shadow: var(--elevation-3);
  }

  #app-drawer.open {
    left: 0;
  }

  #app-main {
    padding: var(--space-4);
  }
}
