/* =============================================
   TheWorkRate — Lo-Fi Wireframe Design System
   Grayscale only. No brand colors.
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #F5F5F5;
  --surface: #FFFFFF;
  --border: #D0D0D0;
  --border-light: #E5E5E5;
  --text-primary: #333333;
  --text-secondary: #888888;
  --text-muted: #AAAAAA;
  --accent: #555555;
  --accent-hover: #444444;
  --placeholder: #E8E8E8;
  --success: #6B6B6B;
  --warning: #999999;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.1);
  --sidebar-width: 240px;
  --topbar-height: 56px;
}

html { font-size: 14px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- App Layout --- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--text-primary);
  color: #ccc;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 16px 20px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid #444;
  letter-spacing: -0.3px;
}
.sidebar-logo span { font-weight: 300; }

.sidebar-nav { flex: 1; padding: 8px 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: #bbb;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.12); color: #fff; font-weight: 500; }

.nav-item .icon { width: 20px; text-align: center; font-size: 1rem; }

.nav-group-label {
  padding: 20px 20px 6px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #666;
}

.nav-children { background: rgba(0,0,0,0.15); }
.nav-children .nav-item { padding-left: 50px; font-size: 0.85rem; }

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid #444;
  font-size: 0.8rem;
  color: #666;
}

/* --- Main Content Area --- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --- Top Bar --- */
.topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-breadcrumb { font-size: 0.85rem; color: var(--text-secondary); }
.topbar-breadcrumb span { color: var(--text-primary); font-weight: 500; }

.topbar-right { display: flex; align-items: center; gap: 16px; }

.country-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.country-badge .flag {
  width: 18px; height: 13px;
  background: var(--placeholder);
  border-radius: 2px;
}

.user-badge {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.85rem;
}
.user-badge .avatar {
  width: 32px; height: 32px;
  background: var(--placeholder);
  border-radius: 50%;
  border: 1px solid var(--border);
}

/* --- Page Content --- */
.page-content {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
}
.page-content.full-width { max-width: 100%; }

/* --- Page Header --- */
.page-header { margin-bottom: 24px; }
.page-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.page-header .subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* --- Cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h2 {
  font-size: 1rem;
  font-weight: 600;
}
.card-header .badge {
  font-size: 0.75rem;
  padding: 2px 10px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.card-header .badge.done {
  background: #e8e8e8;
  color: var(--accent);
}
.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* --- KPI Tiles --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.kpi-tile .kpi-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.kpi-tile .kpi-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
}
.kpi-tile .kpi-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.kpi-tile .kpi-sparkline {
  height: 24px;
  background: var(--placeholder);
  border-radius: 4px;
  margin-top: 8px;
}

/* --- Grid Layouts --- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-6040 { display: grid; grid-template-columns: 3fr 2fr; gap: 24px; }
.grid-5050 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-2080 { display: grid; grid-template-columns: 220px 1fr; gap: 24px; }

/* --- Form Elements --- */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.form-group label .required { color: #999; }

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text-primary);
  transition: border-color 0.15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
}
select.form-control { cursor: pointer; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}
.form-row-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.form-help {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* --- Drag & Drop Zone --- */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.drop-zone:hover {
  border-color: var(--accent);
  background: rgba(0,0,0,0.02);
}
.drop-zone .drop-icon { font-size: 2rem; margin-bottom: 8px; }
.drop-zone .drop-text { font-size: 0.9rem; }
.drop-zone .drop-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg); }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 8px 12px;
}
.btn-ghost:hover { color: var(--text-primary); }

/* --- Progress Bar --- */
.progress-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
}
.progress-segment {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--border-light);
}
.progress-segment.filled { background: var(--accent); }
.progress-segment.current { background: var(--text-secondary); }

/* --- Stepper (Vertical) --- */
.stepper { list-style: none; }
.stepper-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  cursor: pointer;
  position: relative;
}
.stepper-item::before {
  content: '';
  position: absolute;
  left: 13px; top: 36px;
  width: 2px; height: calc(100% - 24px);
  background: var(--border-light);
}
.stepper-item:last-child::before { display: none; }

.stepper-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.stepper-item.completed .stepper-dot {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.stepper-item.active .stepper-dot {
  border-color: var(--accent);
  color: var(--accent);
}

.stepper-label { font-size: 0.85rem; color: var(--text-secondary); padding-top: 4px; }
.stepper-item.active .stepper-label { color: var(--text-primary); font-weight: 500; }
.stepper-item.completed .stepper-label { color: var(--text-primary); }

/* --- Accordion --- */
.accordion-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}
.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  transition: background 0.15s;
}
.accordion-header:hover { background: var(--bg); }
.accordion-header .arrow {
  transition: transform 0.2s;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.accordion-item.open .accordion-header .arrow { transform: rotate(180deg); }
.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.accordion-item.open .accordion-body { max-height: 2000px; }
.accordion-body-inner { padding: 0 20px 20px; }

/* --- Info Banner --- */
.info-banner {
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.info-banner .info-icon { font-size: 1.1rem; }

/* --- Data Table --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  background: var(--bg);
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}
.data-table tr:hover td { background: rgba(0,0,0,0.02); }

/* --- Range/Gauge Bar --- */
.range-bar {
  position: relative;
  height: 8px;
  background: var(--border-light);
  border-radius: 4px;
  margin: 16px 0 8px;
}
.range-bar .range-fill {
  position: absolute;
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  left: 20%;
  width: 60%;
  opacity: 0.3;
}
.range-bar .range-marker {
  position: absolute;
  width: 16px; height: 16px;
  background: var(--accent);
  border-radius: 50%;
  top: -4px;
  border: 2px solid var(--surface);
  box-shadow: var(--shadow);
}
.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* --- Status Indicators --- */
.status { display: flex; align-items: center; gap: 4px; font-size: 0.8rem; }
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border);
}
.status-dot.ok { background: #888; }
.status-dot.warn { background: #aaa; }
.status-dot.error { background: #666; }

/* --- Country Card --- */
.country-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.country-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}
.country-card.selected {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}
.country-card .country-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.country-card .country-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.country-card .country-flag {
  width: 24px; height: 16px;
  background: var(--placeholder);
  border-radius: 2px;
  display: inline-block;
}

/* --- Function Tile --- */
.func-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
}
.func-tile:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.func-tile .func-icon {
  width: 40px; height: 40px;
  background: var(--placeholder);
  border-radius: 8px;
  margin-bottom: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}
.func-tile .func-title { font-weight: 600; font-size: 0.95rem; margin-bottom: 4px; }
.func-tile .func-desc { font-size: 0.8rem; color: var(--text-secondary); }

/* --- Activity Feed --- */
.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.85rem;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}
.activity-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
}

/* --- Map Placeholder --- */
.map-placeholder {
  background: var(--placeholder);
  border-radius: var(--radius);
  min-height: 350px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  position: relative;
  overflow: hidden;
}
.map-dot {
  position: absolute;
  width: 14px; height: 14px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--surface);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s;
}
.map-dot:hover { transform: scale(1.4); }
.map-dot .map-tooltip {
  display: none;
  position: absolute;
  bottom: 100%; left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: #fff;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  margin-bottom: 6px;
}
.map-dot:hover .map-tooltip { display: block; }

/* --- Leave Row --- */
.leave-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.leave-row:last-child { border-bottom: none; }
.leave-row .leave-label { flex: 1; font-size: 0.85rem; }
.leave-row .leave-value {
  font-size: 0.85rem;
  color: var(--text-secondary);
  min-width: 100px;
  text-align: right;
}
.leave-row .leave-toggle { margin-left: 8px; }

/* --- Toggle Switch --- */
.toggle {
  position: relative;
  width: 36px; height: 20px;
  display: inline-block;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  left: 2px; top: 2px;
  transition: transform 0.2s;
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }

/* --- Search/Filter Bar --- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-input {
  padding: 8px 12px 8px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") 10px center no-repeat;
  min-width: 200px;
}
.filter-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--surface);
  cursor: pointer;
}

/* --- Chart Placeholder --- */
.chart-placeholder {
  background: var(--placeholder);
  border-radius: var(--radius-sm);
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* --- Completion Ring (text-based for wireframe) --- */
.completion-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* --- Utilities --- */
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-secondary); }
.text-small { font-size: 0.8rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }

/* Scrollable area */
.scroll-area {
  max-height: 400px;
  overflow-y: auto;
}
.scroll-area::-webkit-scrollbar { width: 4px; }
.scroll-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
