/* ─── Design Tokens ──────────────────────────────────────────────────────── */
:root {
  /* Atlassian-inspired colour palette */
  --primary:          #0052CC;
  --primary-hover:    #0065FF;
  --primary-light:    #DEEBFF;
  --success:          #36B37E;
  --success-light:    #E3FCEF;
  --warning:          #FF8B00;
  --warning-light:    #FFFAE6;
  --danger:           #DE350B;
  --danger-light:     #FFEBE6;
  --danger-hover:     #BF2600;

  /* Neutrals */
  --bg-page:          #F4F5F7;
  --bg-white:         #FFFFFF;
  --bg-hover:         #F4F5F7;
  --bg-today:         #DEEBFF;
  --border:           #DFE1E6;
  --border-focus:     #4C9AFF;

  /* Text */
  --text-dark:        #172B4D;
  --text-medium:      #42526E;
  --text-light:       #6B778C;
  --text-placeholder: #97A0AF;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow-md:  0 4px 12px rgba(0,0,0,.15);
  --shadow-lg:  0 8px 24px rgba(0,0,0,.18);

  /* Layout */
  --header-height:   56px;
  --sidebar-width:   260px;
  --radius-sm:       4px;
  --radius-md:       6px;
  --radius-lg:       8px;
  --radius-xl:       12px;

  /* Transitions */
  --transition: 150ms ease;
}

/* ─── Reset / Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
               Ubuntu, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-page);
  color: var(--text-dark);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.25; }

/* ─── App Shell ──────────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Header ─────────────────────────────────────────────────────────────── */
#app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 0;
  box-shadow: var(--shadow-sm);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 17px;
  color: var(--primary);
  letter-spacing: -0.3px;
  white-space: nowrap;
  margin-right: 24px;
}

.brand-text { color: #3d8c26; }

.header-brand .icon { width: 22px; height: 22px; }
.brand-logo { width: 28px; height: 28px; border-radius: 6px; object-fit: contain; flex-shrink: 0; }

/* ─── Navigation ─────────────────────────────────────────────────────────── */
#app-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-medium);
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

.nav-btn:hover   { background: var(--bg-hover); color: var(--text-dark); }
.nav-btn.active  {
  background: var(--primary-light);
  color: var(--primary);
}

.nav-btn .icon { width: 16px; height: 16px; }

/* ─── Header right side ─────────────────────────────────────────────────── */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-medium);
}

.header-user .icon { width: 14px; height: 14px; }

/* ─── Main content area ──────────────────────────────────────────────────── */
#app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

#main-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  min-width: 0;
}

/* ─── Views ──────────────────────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }

/* ─── Loading overlay (full page) ────────────────────────────────────────── */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  flex-direction: column;
  gap: 16px;
}
#loading-overlay.visible { display: flex; }

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Toast notifications ────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--text-dark);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  pointer-events: all;
  animation: toastIn .25s ease;
  max-width: 340px;
}

.toast.success { background: var(--success); }
.toast.error   { background: var(--danger);  }
.toast.warning { background: var(--warning); color: var(--text-dark); }

.toast .icon { width: 16px; height: 16px; flex-shrink: 0; }
.toast-msg   { flex: 1; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Section heading ────────────────────────────────────────────────────── */
.section-heading {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 16px;
}

/* ─── Skeleton loading shimmer ───────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #e8eaed 25%, #f4f5f7 50%, #e8eaed 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

/* ─── Empty state ────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  color: var(--text-light);
  gap: 12px;
}

.empty-state .icon {
  width: 48px;
  height: 48px;
  opacity: .4;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-medium);
}

.empty-state p {
  font-size: 14px;
  max-width: 340px;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #main-content { padding: 16px 12px; }

  .nav-btn span { display: none; }

  #app-header { padding: 0 12px; }

  .header-brand .brand-text { display: none; }
}
