/* ========================================
   KRAFT — Main Stylesheet
   ======================================== */

:root {
  --navy: #0B1320;
  --navy-80: rgba(11,19,32,0.8);
  --navy-50: rgba(11,19,32,0.5);
  --navy-20: rgba(11,19,32,0.2);
  --navy-08: rgba(11,19,32,0.08);
  --navy-04: rgba(11,19,32,0.04);
  --yellow: #F4B000;
  --yellow-dark: #D99D00;
  --yellow-light: #FFF8E1;
  --yellow-bg: rgba(244,176,0,0.12);
  --teal: #0F766E;
  --teal-dark: #0A5E57;
  --teal-light: #E6F4F3;
  --teal-bg: rgba(15,118,110,0.1);
  --off-white: #F5F2EC;
  --white: #FFFFFF;
  --gray-50: #FAFAFA;
  --gray-100: #F2F2F2;
  --gray-150: #EBEBEB;
  --gray-200: #E0E0E0;
  --gray-300: #C8C8C8;
  --gray-400: #AAAAAA;
  --gray-500: #888888;
  --gray-600: #666666;
  --gray-700: #444444;
  --red: #EF4444;
  --green: #10B981;
  --shadow-xs: 0 1px 3px rgba(11,19,32,0.06), 0 1px 2px rgba(11,19,32,0.04);
  --shadow-sm: 0 2px 8px rgba(11,19,32,0.08), 0 1px 4px rgba(11,19,32,0.05);
  --shadow-md: 0 4px 16px rgba(11,19,32,0.10), 0 2px 8px rgba(11,19,32,0.06);
  --shadow-lg: 0 8px 32px rgba(11,19,32,0.12), 0 4px 16px rgba(11,19,32,0.08);
  --shadow-xl: 0 16px 48px rgba(11,19,32,0.15), 0 8px 24px rgba(11,19,32,0.10);
  --shadow-yellow: 0 4px 16px rgba(244,176,0,0.35);
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-full: 9999px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --header-h: 60px;
  --nav-h: 72px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--off-white);
  color: var(--navy);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
input, textarea, select, button { font-family: inherit; font-size: inherit; }
button { cursor: pointer; border: none; background: none; }
ul, ol { list-style: none; }
::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* ---- App Layout ---- */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--off-white);
  position: relative;
  overflow-x: hidden;
}

.page-content {
  padding-bottom: 20px;
}

.page-content.with-nav {
  padding-top: var(--header-h);
  padding-bottom: calc(var(--nav-h) + 16px);
}

/* ---- Typography ---- */
h1 { font-size: 26px; font-weight: 800; line-height: 1.15; letter-spacing: -0.5px; }
h2 { font-size: 21px; font-weight: 700; line-height: 1.2; letter-spacing: -0.3px; }
h3 { font-size: 17px; font-weight: 700; line-height: 1.3; }
h4 { font-size: 15px; font-weight: 600; line-height: 1.4; }
h5 { font-size: 13px; font-weight: 600; line-height: 1.4; }
p { font-size: 15px; line-height: 1.6; color: var(--gray-600); }

.text-xs { font-size: 11px; line-height: 1.4; }
.text-sm { font-size: 13px; line-height: 1.5; }
.text-base { font-size: 15px; }
.text-lg { font-size: 17px; }
.text-xl { font-size: 20px; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.text-muted { color: var(--gray-500); }
.text-navy { color: var(--navy); }
.text-yellow { color: var(--yellow-dark); }
.text-teal { color: var(--teal); }
.text-white { color: var(--white); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* ---- Spacing helpers ---- */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

/* ---- Flex helpers ---- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }

/* ---- Header ---- */
.app-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-150);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 200;
  box-shadow: var(--shadow-xs);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.logo-mark {
  width: 34px;
  height: 34px;
  background: var(--navy);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 18px;
  color: var(--yellow);
  letter-spacing: -1px;
  flex-shrink: 0;
}

.header-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
}

.header-subtitle {
  font-size: 11px;
  color: var(--gray-500);
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.header-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-600);
  transition: var(--transition);
  position: relative;
  cursor: pointer;
  background: transparent;
  border: none;
}

.icon-btn:hover, .icon-btn:active { background: var(--gray-100); }

.icon-btn .badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: var(--radius-full);
  border: 2px solid var(--white);
}

.header-back {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  padding: 8px 0;
  text-decoration: none;
}

/* ---- Bottom Navigation ---- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--nav-h);
  background: var(--white);
  border-top: 1px solid var(--gray-150);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 200;
  box-shadow: 0 -2px 16px rgba(11,19,32,0.08);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 10px 4px;
  cursor: pointer;
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: var(--transition);
  flex: 1;
  min-width: 0;
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  transition: var(--transition);
}

.nav-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--gray-400);
  transition: var(--transition);
  white-space: nowrap;
}

.nav-item.active .nav-icon { color: var(--navy); }
.nav-item.active .nav-label { color: var(--navy); font-weight: 700; }

.nav-create-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1;
  margin-top: -18px;
}

.nav-create {
  width: 52px;
  height: 52px;
  background: var(--yellow);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: var(--shadow-yellow);
  transition: var(--transition);
  flex-shrink: 0;
  cursor: pointer;
}

.nav-create:hover, .nav-create:active {
  transform: scale(1.06);
  box-shadow: 0 6px 20px rgba(244,176,0,0.5);
}

.nav-create svg { color: var(--navy); }

.nav-create-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--gray-400);
  white-space: nowrap;
}

/* ---- Sections ---- */
.section {
  padding: 20px 16px;
}

.section-sm {
  padding: 12px 16px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
}

.section-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--teal);
  text-decoration: none;
  cursor: pointer;
}

/* ---- Divider ---- */
.divider {
  height: 1px;
  background: var(--gray-150);
  margin: 0 16px;
}

.divider-thick {
  height: 6px;
  background: var(--off-white);
  margin: 0;
}

/* ---- Avatar ---- */
.avatar {
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -0.5px;
  overflow: hidden;
}

.avatar-xs { width: 28px; height: 28px; font-size: 11px; }
.avatar-sm { width: 36px; height: 36px; font-size: 13px; }
.avatar-md { width: 44px; height: 44px; font-size: 16px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }
.avatar-xl { width: 72px; height: 72px; font-size: 26px; }
.avatar-2xl { width: 88px; height: 88px; font-size: 32px; }

.avatar-group {
  display: flex;
}

.avatar-group .avatar {
  border: 2px solid var(--white);
  margin-left: -8px;
}

.avatar-group .avatar:first-child { margin-left: 0; }

/* ---- Tags / Chips ---- */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: var(--transition);
}

.tag-yellow { background: var(--yellow-bg); color: var(--yellow-dark); }
.tag-teal { background: var(--teal-bg); color: var(--teal); }
.tag-navy { background: var(--navy-08); color: var(--navy); }
.tag-white { background: rgba(255,255,255,0.2); color: var(--white); border: 1px solid rgba(255,255,255,0.3); }
.tag-gray { background: var(--gray-100); color: var(--gray-600); }
.tag-green { background: rgba(16,185,129,0.12); color: var(--green); }

.tag-outline {
  background: transparent;
  border: 1.5px solid currentColor;
}

.tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.2px;
}

.btn-primary {
  background: var(--yellow);
  color: var(--navy);
  box-shadow: var(--shadow-yellow);
}

.btn-primary:hover, .btn-primary:active {
  background: var(--yellow-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(244,176,0,0.4);
}

.btn-secondary {
  background: var(--navy-08);
  color: var(--navy);
}

.btn-secondary:hover, .btn-secondary:active {
  background: var(--navy-20);
}

.btn-outline {
  background: transparent;
  color: var(--navy);
  border: 1.5px solid var(--gray-200);
}

.btn-outline:hover { border-color: var(--navy-20); background: var(--navy-04); }

.btn-teal {
  background: var(--teal);
  color: var(--white);
}

.btn-teal:hover { background: var(--teal-dark); }

.btn-navy {
  background: var(--navy);
  color: var(--white);
}

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
  padding: 10px 16px;
}

.btn-ghost:hover { background: var(--gray-100); }

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 16px 28px;
  font-size: 16px;
  border-radius: var(--radius-lg);
}

.btn-full {
  width: 100%;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-full);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ---- Cards ---- */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-padded {
  padding: 16px;
}

.card-hover {
  transition: var(--transition);
  cursor: pointer;
}

.card-hover:hover, .card-hover:active {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ---- Forms ---- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 13px 14px;
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 15px;
  color: var(--navy);
  transition: var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

.form-input::placeholder { color: var(--gray-400); }
.form-input:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px var(--navy-08);
}

.form-textarea {
  resize: none;
  min-height: 80px;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 38px;
}

/* ---- Status / badges ---- */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.status-online { background: var(--green); }
.status-away { background: var(--yellow); }
.status-offline { background: var(--gray-300); }

.badge-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--red);
  color: var(--white);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Loading ---- */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-150) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---- Transitions ---- */
.page-enter {
  animation: pageEnter 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes pageEnter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.slide-up {
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Modal / Sheet ---- */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11,19,32,0.55);
  z-index: 800;
  display: none;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.sheet-overlay.active { display: block; }

.sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(101%);
  width: 100%;
  max-width: 480px;
  background: var(--white);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  z-index: 900;
  padding: 20px 20px 32px;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
}

.sheet.active { transform: translateX(-50%) translateY(0); }

.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  margin: 0 auto 20px;
}

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state h3 {
  margin-bottom: 8px;
  color: var(--navy);
}

.empty-state p {
  font-size: 14px;
  color: var(--gray-500);
  margin-bottom: 24px;
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  top: calc(var(--header-h) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  background: var(--navy);
  color: var(--white);
  padding: 12px 20px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  z-index: 400;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
  max-width: calc(100vw - 32px);
}

.toast.show { transform: translateX(-50%) translateY(0); }
.toast-success { background: var(--teal); }
.toast-error   { background: var(--red); }

/* ---- Spinner ---- */
.btn-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Button touch feedback ---- */
.btn:not(:disabled):active { transform: scale(0.97); }
.btn-primary:not(:disabled):active { transform: scale(0.97) translateY(0); }

/* ---- Header glass effect ---- */
.app-header {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.92);
}

/* ---- Nav active pill ---- */
.nav-item.active .nav-icon {
  background: var(--navy-08);
  border-radius: var(--radius-sm);
}


/* ---- Misc ---- */
.overflow-hidden { overflow: hidden; }
.relative { position: relative; }
.absolute { position: absolute; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.block { display: block; }
.hidden { display: none; }
.pointer { cursor: pointer; }
.no-select { user-select: none; }
