/* TechnoTemp Mini App — Premium Design System v2
   Telegram WebApp-native. Light + Dark themes.
   Mobile-first, glass morphism, depth shadows.
   All Telegram CSS vars with dual-mode fallbacks. */

/* ─── Reset & Base ──────────────────────────────────────── */
*{margin:0;padding:0;box-sizing:border-box}
html{
  -webkit-text-size-adjust:100%;
  -webkit-tap-highlight-color:transparent;
  scroll-behavior:smooth;
}

/* ─── Theme Tokens ──────────────────────────────────────── */
:root{
  /* Core palette — light fallbacks (when outside TG or light theme) */
  --bg:    var(--tg-theme-bg-color, #f5f7fa);
  --bg2:   var(--tg-theme-secondary-bg-color, #ffffff);
  --bg3:   #eef1f6;
  --text:  var(--tg-theme-text-color, #1a1d26);
  --hint:  var(--tg-theme-hint-color, #8893a4);
  --accent:var(--tg-theme-link-color, #3478f6);
  --btn:   var(--tg-theme-button-color, #3478f6);
  --btn-text:var(--tg-theme-button-text-color, #ffffff);

  /* Semantic colors */
  --ok:     #34c759;
  --warn:   #ff9f0a;
  --err:    #ff3b30;
  --orange: #ff6b2c;
  --info:   #5ac8fa;

  /* Surfaces */
  --border: rgba(0,0,0,0.06);
  --card-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03);
  --card-shadow-hover: 0 2px 8px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.06);
  --overlay-bg: rgba(0,0,0,0.4);
  --glass-bg: rgba(255,255,255,0.85);
  --glass-border: rgba(255,255,255,0.3);

  /* Radii */
  --radius: 14px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --radius-pill: 100px;

  /* Layout */
  --nav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Transitions */
  --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration: 0.25s;
}

/* Dark theme detection — when TG provides dark bg or via media query */
@media (prefers-color-scheme: dark) {
  :root{
    --bg:    var(--tg-theme-bg-color, #151921);
    --bg2:   var(--tg-theme-secondary-bg-color, #1e2430);
    --bg3:   #262d3d;
    --text:  var(--tg-theme-text-color, #e8edf5);
    --hint:  var(--tg-theme-hint-color, #7d8899);
    --accent:var(--tg-theme-link-color, #5ea2ff);
    --btn:   var(--tg-theme-button-color, #5ea2ff);
    --btn-text:var(--tg-theme-button-text-color, #ffffff);

    --border: rgba(255,255,255,0.07);
    --card-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 6px 20px rgba(0,0,0,0.15);
    --card-shadow-hover: 0 2px 8px rgba(0,0,0,0.25), 0 12px 36px rgba(0,0,0,0.2);
    --overlay-bg: rgba(0,0,0,0.6);
    --glass-bg: rgba(30,36,48,0.85);
    --glass-border: rgba(255,255,255,0.08);
  }
}

/* ─── Body ──────────────────────────────────────────────── */
body{
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  padding: 16px 16px calc(var(--nav-h) + var(--safe-bottom) + 20px);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Typography ────────────────────────────────────────── */
h1{
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}
h2{
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  margin: 20px 0 10px;
  padding: 8px 14px;
  background: var(--bg2);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
  box-shadow: var(--card-shadow);
}
h3{
  font-size: 15px;
  font-weight: 600;
  margin: 14px 0 6px;
  letter-spacing: -0.2px;
}
.date{color:var(--hint);font-size:12px;font-weight:500}
.hint{color:var(--hint);font-size:13px;font-weight:500}
a{color:var(--accent);text-decoration:none;transition:opacity var(--duration)}
a:active{opacity:0.7}

/* ─── Page Header ───────────────────────────────────────── */
.page-header{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0 16px;
}
.page-header h1{flex:1;margin:0}
.page-header .avatar{
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #6366f1));
  color: var(--btn-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* ─── Cards ─────────────────────────────────────────────── */
.card{
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 10px 0;
  box-shadow: var(--card-shadow);
  transition: box-shadow var(--duration) var(--ease-out),
              transform var(--duration) var(--ease-out);
}
.card:active{
  transform: scale(0.985);
}
.card-flat{
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 10px 0;
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
}

/* ─── Grid ──────────────────────────────────────────────── */
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.grid3{display:grid;grid-template-columns:1fr 1fr 1fr;gap:10px}

/* ─── Metric Blocks ─────────────────────────────────────── */
.metric{
  text-align: center;
  padding: 16px 10px 14px;
  background: var(--bg2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  transition: transform var(--duration) var(--ease-out);
}
.metric:active{transform:scale(0.97)}
.metric .num{
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}
.metric .lbl{
  font-size: 10px;
  color: var(--hint);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}
.metric.green .num{color:var(--ok)}
.metric.yellow .num{color:var(--warn)}
.metric.orange .num{color:var(--orange)}
.metric.red .num{color:var(--err)}

/* ─── Progress Bars ─────────────────────────────────────── */
.bar{
  height: 8px;
  border-radius: 4px;
  background: var(--bg3);
  overflow: hidden;
  margin: 6px 0;
}
.bar-fill{
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s var(--ease-out);
  position: relative;
}
.bar-fill.green{background:linear-gradient(90deg, #34c759, #30d158)}
.bar-fill.yellow{background:linear-gradient(90deg, #ff9f0a, #ffc107)}
.bar-fill.orange{background:linear-gradient(90deg, #ff6b2c, #ff8a50)}
.bar-fill.red{background:linear-gradient(90deg, #ff3b30, #ff6259)}

/* Shimmer effect on progress bars */
.bar-fill::after{
  content:'';
  position:absolute;
  top:0;left:0;right:0;bottom:0;
  background:linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.2) 50%, transparent 100%);
  animation:shimmer 2.5s ease infinite;
}
@keyframes shimmer{
  0%{transform:translateX(-100%)}
  100%{transform:translateX(100%)}
}

/* ─── Alerts ────────────────────────────────────────────── */
.alert{
  padding: 12px 14px;
  margin: 8px 0;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border-left: 3px solid;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.alert-red{
  background: rgba(255,59,48,0.08);
  border-color: var(--err);
  color: var(--err);
}
.alert-yellow{
  background: rgba(255,159,10,0.08);
  border-color: var(--warn);
  color: var(--warn);
}
.alert-green{
  background: rgba(52,199,89,0.08);
  border-color: var(--ok);
  color: var(--ok);
}

/* ─── Task Items ────────────────────────────────────────── */
.task-item{
  padding: 16px;
  margin: 8px 0;
  background: var(--bg2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  box-shadow: var(--card-shadow);
  transition: transform var(--duration) var(--ease-out),
              box-shadow var(--duration) var(--ease-out);
  cursor: pointer;
}
.task-item:active{
  transform: scale(0.98);
  box-shadow: var(--card-shadow-hover);
}
.task-item.urgent{
  border-left-color: var(--err);
  border-left-width: 4px;
}
.task-item.overdue{
  border-left-color: var(--err);
  background: rgba(255,59,48,0.04);
}
.task-item.done{
  border-left-color: var(--ok);
  opacity: 0.65;
}
.task-item.in_progress{
  border-left-color: var(--warn);
  border-left-width: 4px;
}
.task-item .task-text{
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text);
  line-height: 1.4;
}
.task-item .task-meta{
  font-size: 12px;
  color: var(--hint);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.task-item .task-actions{
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* ─── Filter Chips ──────────────────────────────────────── */
.chips{
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar{display:none}
.chip{
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: var(--bg2);
  color: var(--hint);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all var(--duration) var(--ease-out);
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.chip.active{
  background: var(--accent);
  color: var(--btn-text);
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.chip:active{
  transform: scale(0.94);
}

/* ─── Buttons ───────────────────────────────────────────── */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
  min-height: 44px;
  letter-spacing: -0.1px;
  position: relative;
  overflow: hidden;
}
.btn:active{
  transform: scale(0.96);
  opacity: 0.9;
}
.btn-primary{
  background: linear-gradient(135deg, var(--btn), color-mix(in srgb, var(--btn) 80%, #6366f1));
  color: var(--btn-text);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.06);
}
.btn-success{
  background: linear-gradient(135deg, var(--ok), #30d158);
  color: #fff;
  box-shadow: 0 2px 8px rgba(52,199,89,0.25);
}
.btn-danger{
  background: linear-gradient(135deg, var(--err), #ff6259);
  color: #fff;
  box-shadow: 0 2px 8px rgba(255,59,48,0.25);
}
.btn-ghost{
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--border);
}
.btn-ghost:active{
  background: var(--bg3);
}
.btn-sm{
  padding: 7px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  min-height: 34px;
}
.btn-block{
  width: 100%;
  justify-content: center;
}
.btn-icon{
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Forms ─────────────────────────────────────────────── */
textarea,
input[type="text"],
input[type="date"],
select{
  width: 100%;
  padding: 12px 14px;
  background: var(--bg3);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  resize: vertical;
  transition: border-color var(--duration) var(--ease-out),
              box-shadow var(--duration) var(--ease-out);
  -webkit-appearance: none;
  appearance: none;
}
textarea:focus,
input:focus,
select:focus{
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(52,120,246,0.12);
}
textarea{min-height:88px;border-radius:var(--radius)}
label{
  display: block;
  font-size: 12px;
  color: var(--hint);
  margin: 14px 0 6px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* ─── Profile Cards ─────────────────────────────────────── */
.profile-card{
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  margin: 8px 0;
  background: var(--bg2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  transition: transform var(--duration) var(--ease-out);
}
.profile-card:active{transform:scale(0.985)}
.profile-card .avatar{
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #a78bfa));
  color: var(--btn-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.profile-card .info{flex:1;min-width:0}
.profile-card .name{
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.2px;
}
.profile-card .role{
  font-size: 13px;
  color: var(--hint);
  margin-top: 2px;
}
.openness-bar{
  width: 100%;
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  margin-top: 6px;
  overflow: hidden;
}
.openness-fill{
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s var(--ease-out);
  background: linear-gradient(90deg, var(--accent), #5ac8fa);
}

/* ─── Voice Recording ───────────────────────────────────── */
.voice-btn{
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 75%, #6366f1));
  color: var(--btn-text);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 20px auto;
  transition: all 0.3s var(--ease-out);
  position: relative;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.voice-btn:active{
  transform: scale(0.92);
}
.voice-btn.recording{
  background: linear-gradient(135deg, var(--err), #ff6259);
  animation: pulse-ring 1.5s ease infinite;
  box-shadow: 0 4px 20px rgba(255,59,48,0.3);
}
@keyframes pulse-ring{
  0%{box-shadow:0 0 0 0 rgba(255,59,48,0.35)}
  70%{box-shadow:0 0 0 24px rgba(255,59,48,0)}
  100%{box-shadow:0 0 0 0 rgba(255,59,48,0)}
}
.voice-wave{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 32px;
  margin: 10px 0;
}
.voice-wave .bar{
  width: 4px;
  background: var(--accent);
  border-radius: 2px;
  animation: wave 0.8s ease infinite;
  height: 8px;
}
.voice-wave .bar:nth-child(2){animation-delay:0.1s}
.voice-wave .bar:nth-child(3){animation-delay:0.2s}
.voice-wave .bar:nth-child(4){animation-delay:0.3s}
.voice-wave .bar:nth-child(5){animation-delay:0.4s}
@keyframes wave{
  0%,100%{height:8px}
  50%{height:28px}
}

/* ─── Document Upload ───────────────────────────────────── */
.upload-zone{
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  color: var(--hint);
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
  background: transparent;
}
.upload-zone:active{
  border-color: var(--accent);
  background: rgba(52,120,246,0.04);
}
.upload-zone input{display:none}
.upload-preview{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg3);
  border-radius: var(--radius-sm);
  margin: 6px 0;
  font-size: 13px;
  border: 1px solid var(--border);
}
.upload-preview .icon{font-size:20px}
.upload-preview .name{
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Bottom Navigation ─────────────────────────────────── */
.bottom-nav{
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--glass-bg);
  border-top: 0.5px solid var(--border);
  display: flex;
  z-index: 100;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.bottom-nav a{
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--hint);
  text-decoration: none;
  font-size: 10px;
  font-weight: 600;
  transition: color var(--duration) var(--ease-out);
  padding: 6px 0;
  position: relative;
}
.bottom-nav a .icon{
  font-size: 24px;
  line-height: 1;
  transition: transform 0.3s var(--ease-spring);
}
.bottom-nav a.active{
  color: var(--accent);
}
.bottom-nav a.active .icon{
  transform: scale(1.12);
}
.bottom-nav a:active{opacity:0.6}

/* Active tab indicator dot */
.bottom-nav a.active::after{
  content: '';
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* ─── Loading ───────────────────────────────────────────── */
.loading{
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--hint);
  font-size: 14px;
}
.spinner{
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 10px;
}
@keyframes spin{to{transform:rotate(360deg)}}

/* ─── Workload / Status Badges ──────────────────────────── */
.load-badge{
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.load-badge.free{
  background: rgba(52,199,89,0.12);
  color: var(--ok);
}
.load-badge.normal{
  background: rgba(52,120,246,0.12);
  color: var(--accent);
}
.load-badge.heavy{
  background: rgba(255,159,10,0.12);
  color: var(--warn);
}
.load-badge.overloaded{
  background: rgba(255,59,48,0.12);
  color: var(--err);
}
/* Task statuses */
.load-badge.pending{
  background: rgba(52,120,246,0.10);
  color: var(--accent);
}
.load-badge.in_progress{
  background: rgba(255,159,10,0.12);
  color: var(--orange);
}
.load-badge.done{
  background: rgba(52,199,89,0.12);
  color: var(--ok);
}
.load-badge.confirmed{
  background: rgba(52,199,89,0.15);
  color: var(--ok);
}
.load-badge.cancelled{
  background: rgba(255,59,48,0.10);
  color: var(--err);
}

/* ─── Toast Notifications ──────────────────────────────── */
.toast{
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--glass-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--glass-border);
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  z-index: 200;
  opacity: 0;
  transition: all 0.4s var(--ease-spring);
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  max-width: calc(100vw - 40px);
}
.toast.show{
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.toast.success{color:var(--ok)}
.toast.error{color:var(--err)}

/* ─── Empty State ───────────────────────────────────────── */
.empty{
  text-align: center;
  padding: 56px 28px;
  color: var(--hint);
}
.empty .icon{
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.3;
  filter: grayscale(0.3);
}
.empty p{
  font-size: 16px;
  line-height: 1.5;
  font-weight: 500;
}
.empty .sub{
  font-size: 14px;
  margin-top: 8px;
  opacity: 0.6;
}

/* ─── Dashboard ─────────────────────────────────────────── */
.dash-header{
  text-align: center;
  padding: 16px 0 14px;
  margin-bottom: 12px;
  position: relative;
}
.dash-header h1{
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}
.dash-date{
  font-size: 13px;
  color: var(--hint);
  margin-top: 4px;
  font-weight: 500;
}

.dash-grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.dash-card{
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
}

/* Colored top accent for dashboard cards */
.dash-card::before{
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.dash-card:nth-child(1)::before{background:linear-gradient(90deg, #3478f6, #5ac8fa)}
.dash-card:nth-child(2)::before{background:linear-gradient(90deg, #34c759, #30d158)}
.dash-card:nth-child(3)::before{background:linear-gradient(90deg, #ff9f0a, #ffcc00)}
.dash-card:nth-child(4)::before{background:linear-gradient(90deg, #ff3b30, #ff6259)}

.dash-title{
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.2px;
}
.dash-title.sales{color:#3478f6}
.dash-title.service{color:var(--ok)}
.dash-title.stock{color:var(--warn)}
.dash-title.summary{color:var(--err)}

/* Dashboard tables */
.tbl-scroll{
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 0 4px;
}
.dash-card table{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.dash-card th{
  text-align: left;
  font-weight: 600;
  color: var(--hint);
  padding: 6px 6px;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.dash-card th.r{text-align:right}
.dash-card td{
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.dash-card td.num{
  text-align: right;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.dash-card td.dim{color:var(--hint)}
.dash-card tr:last-child td{border-bottom:none}
.dash-card tr.total-row td{
  font-weight: 700;
  border-top: 2px solid var(--border);
  padding-top: 10px;
  color: var(--text);
}

/* Plan progress (inline bar in table) */
.plan-bar{
  display: inline-block;
  width: 42px;
  height: 7px;
  background: var(--bg3);
  border-radius: 4px;
  overflow: hidden;
  vertical-align: middle;
}
.plan-fill{
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s var(--ease-out);
}
.pct-green .plan-fill{background:linear-gradient(90deg, #34c759, #30d158)}
.pct-yellow .plan-fill{background:linear-gradient(90deg, #ff9f0a, #ffcc00)}
.pct-red .plan-fill{background:linear-gradient(90deg, #ff3b30, #ff6259)}
.pct{
  font-size: 12px;
  font-weight: 700;
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}
.pct.green{color:var(--ok)}
.pct.yellow{color:var(--warn)}
.pct.red{color:var(--err)}

/* Zone indicators */
.zone{
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
  box-shadow: 0 0 4px rgba(0,0,0,0.1);
}
.zone-green{background:var(--ok)}
.zone-yellow{background:var(--warn)}
.zone-orange{background:var(--orange)}
.zone-red{background:var(--err)}

/* Summary rows */
.sum-rows{margin-top:8px}
.sum-row{
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.sum-row:last-child{border-bottom:none}
.sum-lbl{
  color: var(--hint);
  font-size: 14px;
}
.sum-val{
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.sum-val.pos{color:var(--ok)}
.sum-val.neg{color:var(--err)}
.net-row{border-bottom:2px solid var(--border)}

/* Insight callouts */
.insight{
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--bg3);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
  font-size: 12px;
  color: var(--hint);
  line-height: 1.5;
}
.insight.blue{border-left-color:#3478f6}
.insight.green{border-left-color:var(--ok)}
.insight.yellow{border-left-color:var(--warn)}
.insight.red{border-left-color:var(--err)}

/* Status dots */
.dot{
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.dot-ok{background:var(--ok)}
.dot-warn{background:var(--warn)}
.dot-bad{background:var(--err)}

/* Repair type tags */
.repair-types{
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.repair-tag{
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: var(--bg3);
  font-weight: 500;
}
.repair-tag.to{border-left:2px solid #3478f6}
.repair-tag.paid{border-left:2px solid var(--ok)}
.repair-tag.warranty{border-left:2px solid var(--warn)}
.stuck-warn{
  margin-top: 6px;
  font-size: 12px;
  color: var(--err);
  font-weight: 500;
}

.dash-footer{
  text-align: center;
  padding: 12px 0 6px;
  font-size: 11px;
  color: var(--hint);
  opacity: 0.6;
}

/* ─── Mobile responsive ─────────────────────────────────── */
@media(max-width:600px){
  .dash-header h1{font-size:20px}
  .dash-date{font-size:13px}
  .dash-card{padding:14px}
  .dash-title{font-size:16px !important;margin-bottom:10px;padding-bottom:8px}
  .dash-card table{font-size:13px}
  .dash-card th{font-size:10px;padding:5px 5px}
  .dash-card td{padding:6px 5px}
  .plan-bar{width:36px;height:7px}
  .pct{font-size:12px}
  .insight{font-size:12px;padding:8px 10px;line-height:1.4}
  .sum-row{padding:6px 0}
  .sum-lbl,.sum-val{font-size:14px}
  .repair-tag{font-size:11px;padding:3px 8px}
  .stuck-warn{font-size:12px}
}

/* ─── Animations & Transitions ──────────────────────────── */
.fade-in{
  animation: fadeIn 0.35s var(--ease-out);
}
@keyframes fadeIn{
  from{opacity:0;transform:translateY(12px)}
  to{opacity:1;transform:none}
}

/* Slide-up for overlays */
@keyframes slideUp{
  from{opacity:0;transform:translateY(100%)}
  to{opacity:1;transform:translateY(0)}
}

/* Staggered list animation */
.task-item,
.card,
.profile-card{
  animation: fadeIn 0.3s var(--ease-out) backwards;
}
.task-item:nth-child(1),
.card:nth-child(1){animation-delay:0.02s}
.task-item:nth-child(2),
.card:nth-child(2){animation-delay:0.05s}
.task-item:nth-child(3),
.card:nth-child(3){animation-delay:0.08s}
.task-item:nth-child(4),
.card:nth-child(4){animation-delay:0.11s}
.task-item:nth-child(5),
.card:nth-child(5){animation-delay:0.14s}

/* ─── Utilities ─────────────────────────────────────────── */
.flex{display:flex;align-items:center}
.flex-between{display:flex;align-items:center;justify-content:space-between}
.gap-4{gap:4px}
.gap-8{gap:8px}
.gap-12{gap:12px}
.mt-8{margin-top:8px}
.mt-16{margin-top:16px}
.mb-8{margin-bottom:8px}
.text-ok{color:var(--ok)}
.text-warn{color:var(--warn)}
.text-err{color:var(--err)}
.text-hint{color:var(--hint)}
.text-center{text-align:center}
.text-sm{font-size:12px}
.fw-700{font-weight:700}
.hidden{display:none !important}

/* ─── Selection & Scrollbar ─────────────────────────────── */
::selection{
  background: rgba(52,120,246,0.2);
  color: var(--text);
}
::-webkit-scrollbar{
  width: 4px;
  height: 4px;
}
::-webkit-scrollbar-track{
  background: transparent;
}
::-webkit-scrollbar-thumb{
  background: var(--hint);
  border-radius: 4px;
  opacity: 0.3;
}

/* ─── Meetings ─────────────────────────────────────────── */
.meeting-card{
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.meeting-card:active{
  transform: scale(0.98);
}
.meeting-card-head{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.meeting-date-badge{
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(52,120,246,0.08);
  padding: 2px 8px;
  border-radius: 6px;
}
.meeting-title{
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.3;
}
.meeting-stats{
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
}
.meeting-stat{
  display: flex;
  flex-direction: column;
  align-items: center;
}
.meeting-stat-num{
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.meeting-stat-num.green{color:var(--ok)}
.meeting-stat-num.yellow{color:var(--warn)}
.meeting-stat-num.red{color:var(--err)}
.meeting-stat-lbl{
  font-size: 11px;
  color: var(--hint);
}
.meeting-progress{
  margin-top: 4px;
}
/* Detail */
.meeting-detail-type{
  font-size: 12px;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.meeting-participants{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.participant-tag{
  font-size: 12px;
  background: rgba(52,120,246,0.08);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 10px;
}
.meeting-section{
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.meeting-section-head{
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg2);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  user-select: none;
}
.meeting-section-head::after{
  content: '\u25BE';
  font-size: 12px;
  color: var(--hint);
  margin-left: 4px;
}
.meeting-section-count{
  background: var(--bg3);
  color: var(--hint);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
}
.meeting-section-body{
  padding: 6px 14px 10px;
  display: none;
}
.meeting-problem-item,
.meeting-promise-item,
.meeting-kpi-item{
  padding: 6px 0;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
}
.meeting-problem-item:last-child,
.meeting-promise-item:last-child,
.meeting-kpi-item:last-child{
  border-bottom: none;
}
.meeting-quote-item{
  padding: 8px 12px;
  margin: 4px 0;
  font-size: 13px;
  font-style: italic;
  color: var(--hint);
  background: var(--bg2);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
  line-height: 1.4;
}
/* Meeting task items */
.meeting-task-item{
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.meeting-task-item:last-child{border-bottom:none}
.meeting-task-item.overdue{background:rgba(207,34,46,0.04);margin:0 -14px;padding:8px 14px}
.meeting-task-check{font-size:16px;flex-shrink:0;margin-top:1px}
.meeting-task-body{flex:1;min-width:0}
.meeting-task-text{font-size:13px;color:var(--text);line-height:1.4;margin-bottom:4px}
.meeting-task-item.done .meeting-task-text,
.meeting-task-item.confirmed .meeting-task-text{
  text-decoration:line-through;
  color:var(--hint);
}
.meeting-task-meta{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  font-size:11px;
  color:var(--hint);
}
/* Summary table on main page */
.meeting-summary-table{
  width:100%;
  border-collapse:collapse;
  font-size:13px;
  margin-top:8px;
}
.meeting-summary-table th{
  text-align:left;
  font-size:11px;
  color:var(--hint);
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:0.3px;
  padding:6px 8px;
  border-bottom:2px solid var(--border);
}
.meeting-summary-table td{
  padding:8px;
  border-bottom:1px solid var(--border);
  color:var(--text);
}
.meeting-summary-table tr:last-child td{border-bottom:none}

/* Agenda */
.agenda-card{
  border-left: 3px solid var(--accent);
}
.agenda-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.agenda-group{
  margin-bottom: 10px;
}
.agenda-group:last-child{margin-bottom:0}
.agenda-group-title{
  font-size: 12px;
  font-weight: 700;
  padding: 4px 0;
  margin-bottom: 4px;
}
.agenda-task-row{
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.agenda-task-row:last-child{border-bottom:none}
.agenda-task-text{
  font-size: 13px;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 3px;
}
.agenda-task-meta{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  color: var(--hint);
}

/* Dynamics */
.dynamics-grid{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.dynamics-item{
  text-align: center;
  padding: 6px 4px;
  background: var(--bg);
  border-radius: 8px;
}
.dynamics-label{
  font-size: 10px;
  color: var(--hint);
  margin-bottom: 2px;
  line-height: 1.2;
}
.dynamics-value{
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.dynamics-delta{
  font-size: 11px;
  font-weight: 600;
}
