:root {
  --navy: #1e3a5f;
  --navy-dark: #16293f;
  --blue: #2563eb;
  --bg: #f4f6f9;
  --card: #ffffff;
  --border: #e2e6ec;
  --text: #1f2937;
  --muted: #6b7280;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.topbar {
  background: var(--navy);
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  color: white;
  text-decoration: none;
  font-weight: 700;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.brand-logo { flex-shrink: 0; display: block; }
.brand-text {
  font-weight: 800;
  letter-spacing: 0.03em;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.brand-sub {
  font-weight: 400;
  letter-spacing: normal;
  font-size: 12px;
  color: rgba(255,255,255,0.7);
}
.topnav { display: flex; gap: 10px; flex: 1; align-items: center; }
.topnav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 6px;
}
.topnav a:hover { background: rgba(255,255,255,0.12); color: white; }
/* Current page gets a filled pill so it's always obvious where you are. */
.topnav a.active { background: rgba(255,255,255,0.18); color: white; font-weight: 600; }
/* Thin divider separating the two MAIN destinations (fortnightly report +
   marketing plan, shown as colored pills) from the secondary utility menus. */
.nav-divider { width: 1px; height: 18px; background: rgba(255,255,255,0.28); flex-shrink: 0; }
/* The two primary menus each get their own colored pill identity: the
   fortnightly report world is blue, the Marketing Plan world is green
   (matching the colors of the pages themselves). */
.topnav a.nav-primary {
  color: white;
  background: var(--blue);
  border: 1px solid var(--blue);
  border-radius: 999px;
  padding: 5px 13px;
  font-weight: 600;
}
.topnav a.nav-primary:hover { background: #1d4ed8; border-color: #1d4ed8; color: white; }
.topnav a.nav-primary.active { box-shadow: 0 0 0 2px rgba(255,255,255,0.55); }
.topnav a.nav-plan {
  color: white;
  background: #15803d;
  border: 1px solid #15803d;
  border-radius: 999px;
  padding: 5px 13px;
  font-weight: 600;
}
.topnav a.nav-plan:hover { background: #166534; border-color: #166534; color: white; }
.topnav a.nav-plan.active { box-shadow: 0 0 0 2px rgba(255,255,255,0.55); }
/* Secondary menus stay quiet so the two primaries carry the visual weight. */
.topnav a.nav-secondary { font-size: 13px; color: rgba(255,255,255,0.62); }
.topnav a.nav-secondary:hover { color: white; }
.who { display: flex; align-items: center; gap: 12px; font-size: 14px; color: rgba(255,255,255,0.9); margin-left: auto; }
.lang-toggle {
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 999px;
  padding: 3px 10px;
}
.lang-toggle:hover { background: rgba(255,255,255,0.12); color: white; }
.logout-btn {
  color: white;
  background: rgba(255,255,255,0.15);
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
}
.logout-btn:hover { background: rgba(255,255,255,0.28); }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 24px;
}

.page-head h1 { margin: 0 0 4px; font-size: 22px; color: var(--navy-dark); }
.muted { color: var(--muted); font-size: 14px; }

.flash { padding: 10px 20px; text-align: center; font-size: 14px; }
.flash.info { background: #eff6ff; color: #1e40af; }

/* ---- login ---- */
.login-wrap {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.05);
}
.login-card h1 { font-size: 20px; margin: 0 0 6px; color: var(--navy-dark); }
.login-card label { display: block; margin: 16px 0 6px; font-size: 13px; color: var(--muted); }
.login-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}
.hint { font-size: 12px; color: var(--muted); margin-top: 16px; }

/* ---- buttons ---- */
.btn {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: #e5e7eb; color: var(--text); }
.btn-secondary:hover { background: #d1d5db; }
.btn-danger { background: #fee2e2; color: var(--red); }
.btn-danger:hover { background: #fecaca; }
.btn-small { padding: 6px 10px; font-size: 12px; }
.btn-block { width: 100%; margin-top: 20px; }

.alert-error { background: #fee2e2; color: var(--red); padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.alert-success { background: #dcfce7; color: #15803d; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.alert-info { background: #eff6ff; color: #1e40af; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.alert-info a { color: #1e40af; font-weight: 600; }

/* ---- period select ---- */
.period-select-form { margin: 16px 0; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.period-select-form label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.period-select-form select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

.deadline-badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.deadline-ok { background: #dcfce7; color: #15803d; }
.deadline-soon { background: #fef3c7; color: #92400e; }
.deadline-overdue { background: #fee2e2; color: var(--red); }

/* ---- tables ---- */
.table-scroll { overflow-x: auto; background: var(--card); border-radius: 10px; border: 1px solid var(--border); }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
/* Fixed layout so our per-column widths (below) are actually honored instead
   of the browser shrinking wide columns to fit a long nowrap header. */
.entry-table, .consolidated-table { table-layout: fixed; }
.entry-table th, .entry-table td,
.consolidated-table th, .consolidated-table td,
.simple-table th, .simple-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  vertical-align: top;
  text-align: left;
  overflow-wrap: break-word;
}
.entry-table th, .consolidated-table th, .simple-table th {
  background: var(--navy);
  color: white;
  font-weight: 600;
}
.consolidated-table .dept-cell {
  background: #eaf1fb;
  font-weight: 700;
  color: var(--navy-dark);
}
.dept-note { font-weight: 400; font-size: 11px; color: var(--muted); margin-top: 4px; white-space: normal; }
.consolidated-table .not-used { color: #cbd5e1; text-align: center; }
.consolidated-table .no-data td { background: #fff7ed; color: var(--amber); }
.reporter-cell-view { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* ---- department row banding ----
   Every row belonging to one department shares a background tint; the tint
   alternates at each department boundary (not per row) so it's obvious at a
   glance where one department's block of rows ends and the next begins.
   Cells that already set their own background (.dept-cell, .no-data td)
   paint over this — table cell backgrounds always take priority over the
   row's background, so the "not submitted" amber and the department-name
   tag both stay visually distinct regardless of banding. */
.consolidated-table .dept-row.band-b { background: #eef3fb; }
.consolidated-table .dept-row.band-b .dept-cell { background: #dce8fa; }

/* Column widths: narrow for short-content columns (reporter/expenses/decisions),
   wide for long free-text columns (completed/in progress). table-layout stays
   "auto" so these act as preferred widths rather than hard constraints. */
[data-col="department"] { width: 130px; }
[data-col="reporter"] { width: 90px; }
[data-col="taskUnit"] { width: 130px; }
[data-col="completed"] { width: 280px; }
[data-col="inProgress"] { width: 280px; }
[data-col="expenses"] { width: 100px; }
[data-col="managerDecision"] { width: 140px; }
[data-col="toBeDecided"] { width: 140px; }
[data-col="actions"] { width: 36px; }

.entry-table textarea, .entry-table input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid transparent;
  padding: 6px;
  font-size: 13px;
  border-radius: 6px;
  font-family: inherit;
  resize: none;
  overflow: hidden;
}
.entry-table textarea:focus, .entry-table input:focus {
  border-color: var(--blue);
  outline: none;
  background: #f8fafc;
}
.row-actions { text-align: center; width: 36px; }
.btn-remove-row {
  border: none;
  background: transparent;
  color: var(--red);
  cursor: pointer;
  font-size: 16px;
}
.table-actions { margin: 12px 0; }
.form-submit-row { margin-top: 16px; }

/* ---- summary cards ---- */
.summary-cards { display: flex; gap: 16px; margin: 16px 0; flex-wrap: wrap; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  min-width: 180px;
}
.card-num { font-size: 24px; font-weight: 700; color: var(--navy-dark); }
.card-label { font-size: 13px; color: var(--muted); margin-top: 4px; }
.card-warn { border-color: #fed7aa; background: #fff7ed; }
.card-warn .card-num { color: var(--amber); }
.card-ok .card-num { color: var(--green); }

/* ---- admin department management ---- */
.add-dept-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  margin: 16px 0 24px;
}
.add-dept-box h2 { font-size: 15px; margin: 0 0 10px; }
.inline-form-wrap { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-form-wrap input, .inline-form-wrap select {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
}
.dept-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.dept-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
.dept-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.dept-name-input { font-weight: 700; font-size: 15px; border: 1px solid transparent; border-radius: 6px; padding: 4px 6px; width: 55%; }
.dept-name-input:focus { border-color: var(--blue); outline: none; }
.dept-edit-form label { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 4px; }
.dept-edit-form input[type=text] { width: 100%; padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
fieldset { border: 1px solid var(--border); border-radius: 8px; margin-top: 10px; padding: 8px 10px; }
legend { font-size: 11px; color: var(--muted); padding: 0 4px; }
.col-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.col-check { font-size: 12px; display: flex; align-items: center; gap: 4px; color: var(--text); }
.dept-card-actions { margin-top: 10px; }
.inline-form { display: flex; gap: 8px; margin-top: 8px; }
.inline-form input { flex: 1; padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; }

.simple-table { background: var(--card); border-radius: 10px; overflow: hidden; }

/* ---- submission history matrix ---- */
.history-table th, .history-table td { text-align: center; }
.history-table .dept-cell { text-align: left; white-space: nowrap; }
.history-table .hist-rate { font-weight: 600; color: var(--navy-dark); white-space: nowrap; }
.history-table .hist-yes { color: var(--green); font-weight: 700; background: #f0fdf4; }
.history-table .hist-no { color: #cbd5e1; background: #fafafa; }

/* ---- version history (report history page) ---- */
.version-list { margin-top: 10px; padding-left: 0; list-style: none; font-size: 12px; color: var(--muted); }
.version-list li { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.version-list form { display: inline; }

/* ---- backup & restore ---- */
.backup-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.restore-form textarea { width: 100%; min-height: 90px; font-family: monospace; font-size: 12px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; box-sizing: border-box; }
.restore-form { margin-top: 10px; }

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

/* ---- period picker (calendar-style, grouped by month) ----
   A zero-JS <details>/<summary> dropdown. Periods are grouped under a month
   header so browsing stays easy once many fortnights have piled up; the
   actual current period always gets a green dot/highlight, separate from
   whichever period is currently being viewed (highlighted navy) — those two
   aren't always the same period. */
.period-picker { position: relative; }
.period-picker-summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--card);
  user-select: none;
}
.period-picker-summary::-webkit-details-marker { display: none; }
.period-picker-summary::marker { content: ""; }
.period-picker-selected { font-weight: 600; color: var(--navy-dark); }
.current-badge {
  background: #dcfce7;
  color: #15803d;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.period-picker .chevron { color: var(--muted); font-size: 11px; transition: transform 0.15s; }
.period-picker[open] .chevron { transform: rotate(180deg); }
.period-picker-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.14);
  padding: 12px;
  width: 360px;
  max-width: 90vw;
  max-height: 380px;
  overflow-y: auto;
}

/* Each month gets its own small calendar-like tile with its two fortnights
   stacked inside; the tiles themselves lay out in a grid so a year's worth
   of periods is a scannable grid instead of one long list. */
.period-calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.period-month-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
}
.period-month-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  text-align: center;
  margin-bottom: 6px;
}
.period-month-cells { display: flex; flex-direction: column; gap: 4px; }
.period-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 6px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  background: #f8fafc;
}
.period-cell:hover { background: #eef2f7; }
.period-cell.is-selected { background: var(--navy); color: white; }
.period-cell.is-current:not(.is-selected) { background: #dcfce7; color: #15803d; }
.current-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); display: inline-block; flex-shrink: 0; }
.period-cell.is-selected .current-dot { background: white; }

/* ---- marketing plan ----
   A twice-a-year document (H1/H2), so the period switcher is deliberately
   just a plain row of tabs — not the month-grouped calendar picker used for
   fortnightly periods, which would be overkill for something that only
   changes twice a year. */
.halfyear-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.halfyear-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}
.halfyear-tab:hover { background: #f1f5f9; }
.halfyear-tab.is-selected { background: var(--navy); color: white; border-color: var(--navy); }
.halfyear-tab .current-dot { background: var(--green); }
.halfyear-tab.is-selected .current-dot { background: white; }

.mp-category { margin: 28px 0; }
/* Filled color band per market category — same color coding as the original
   shared Word doc (B2B blue, Online green, Duty Free purple, Export brown),
   so scanning the page feels like flipping through the doc's sections. */
.mp-category-label {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: white;
  margin: 0 0 14px;
  padding: 9px 14px;
  border-radius: 8px;
}
.mp-section-grid { display: flex; flex-direction: column; gap: 18px; }
.mp-section-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 10px;
  padding: 0 18px 16px;
  overflow: hidden;
}
.mp-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 -18px 12px;
  padding: 11px 18px;
}
.mp-section-head h3 { margin: 0; font-size: 15px; }

/* Category color schemes: band = category color, card left edge + section
   header strip tinted to match, so both the market group AND each channel
   inside it read at a glance. */
.cat-blue .mp-category-label { background: #2e6da4; }
.cat-blue .mp-section-card { border-left-color: #2e6da4; }
.cat-blue .mp-section-head { background: #e8f0f8; }
.cat-blue .mp-section-head h3 { color: #24557f; }

.cat-green .mp-category-label { background: #1b5e3a; }
.cat-green .mp-section-card { border-left-color: #1b5e3a; }
.cat-green .mp-section-head { background: #e6f2ea; }
.cat-green .mp-section-head h3 { color: #17492e; }

.cat-purple .mp-category-label { background: #6a3d9a; }
.cat-purple .mp-section-card { border-left-color: #6a3d9a; }
.cat-purple .mp-section-head { background: #f0e9f7; }
.cat-purple .mp-section-head h3 { color: #543079; }

.cat-brown .mp-category-label { background: #8b4513; }
.cat-brown .mp-section-card { border-left-color: #8b4513; }
.cat-brown .mp-section-head { background: #f6ece2; }
.cat-brown .mp-section-head h3 { color: #6e370f; }

.cat-teal .mp-category-label { background: #0e7490; }
.cat-teal .mp-section-card { border-left-color: #0e7490; }
.cat-teal .mp-section-head { background: #e0f1f6; }
.cat-teal .mp-section-head h3 { color: #155e75; }
.mp-owner { font-weight: 400; color: var(--muted); font-size: 13px; }
.mp-badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; flex-shrink: 0; }
.mp-badge-edit { background: #dcfce7; color: #15803d; }
.mp-empty { padding: 4px 2px 10px; margin: 0; }

.mp-table { border-collapse: collapse; width: 100%; font-size: 13px; table-layout: fixed; }
.mp-table th, .mp-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  vertical-align: top;
  text-align: left;
  overflow-wrap: break-word;
}
.mp-table th { background: var(--navy); color: white; font-weight: 600; font-size: 12px; }
.mp-table textarea, .mp-table input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid transparent;
  padding: 6px;
  font-size: 13px;
  border-radius: 6px;
  font-family: inherit;
  resize: none;
  overflow: hidden;
}
.mp-table textarea:focus, .mp-table input:focus { border-color: var(--blue); outline: none; background: #f8fafc; }
.mp-table-readonly td { background: #fafbfc; }
/* Proportions mirror the original shared Word doc: Project and Details get
   the bulk of the width, Period and Budget stay narrow, Remarks in between. */
[data-col="taskName"] { width: 280px; }
[data-col="details"] { width: 300px; }
[data-col="period"] { width: 105px; }
[data-col="budget"] { width: 90px; }
[data-col="notes"] { width: 165px; }

.mp-save-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.mp-savedby-label { font-size: 11px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.mp-savedby { padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; width: 200px; }
.mp-savedby:focus { border-color: var(--blue); outline: none; }

.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 38px; }
.pw-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 5px 7px;
  display: flex;
  align-items: center;
}
.pw-toggle:hover { color: var(--navy); }

.mp-updated { font-size: 12px; color: var(--muted); margin: -4px 0 10px; }
.mp-updated strong { color: var(--navy-dark); }
.mp-history { margin: 0 0 12px; font-size: 12px; }
.mp-history summary { cursor: pointer; color: var(--muted); }
.mp-history .version-list li { flex-wrap: wrap; }

.search-targets { display: flex; gap: 12px; align-items: center; }
.search-target { font-size: 13px; }
.search-group-label {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--navy);
  margin: 24px 0 10px;
}

.mp-manage { margin: 4px 0 12px; font-size: 12px; }
.mp-manage summary { cursor: pointer; color: var(--muted); }
.mp-manage-form { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; max-width: 420px; }
.mp-manage-form label { font-size: 12px; color: var(--muted); display: block; }
.mp-manage-form input[type=text] { width: 100%; padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; margin-top: 2px; box-sizing: border-box; }
.mp-manage fieldset { margin-top: 4px; }

@media (max-width: 700px) {
  .topbar-inner { flex-wrap: wrap; gap: 10px; }
  .topnav { order: 3; width: 100%; flex-wrap: wrap; }
}

/* ---- mobile card layout ----
   Below this width, entry-table (department report form) and
   consolidated-table (admin dashboard) stop being real grids and stack as
   one bordered "card" per row, with each cell's data-label attribute shown
   as a small heading above its value (see report-form.js / admin-dashboard.js
   for the data-col / data-label markup, and report.js for the textarea
   autosize that still works fine on stacked cells). */
@media (max-width: 640px) {
  .container { padding: 20px 12px 60px; }
  .page-head h1 { font-size: 19px; }

  .period-select-form { flex-direction: column; align-items: stretch; gap: 8px; }
  .period-select-form select, .period-select-form .search-input { width: 100%; }
  .period-select-form > a.btn,
  .period-select-form > span.btn-group { margin-left: 0 !important; text-align: center; }

  .period-picker { width: 100%; }
  .period-picker-summary { width: 100%; justify-content: space-between; box-sizing: border-box; }
  .period-picker-panel { left: 0; right: 0; width: auto; min-width: 0; }
  .period-select-form span.btn-group { display: flex; flex-direction: column; gap: 8px; width: 100%; }

  .summary-cards { flex-direction: column; }
  .dept-cards { grid-template-columns: 1fr; }

  .entry-table, .consolidated-table, .mp-table, .simple-table.history-table { table-layout: auto; }
  .table-scroll { overflow-x: visible; border: none; background: none; }

  .entry-table thead, .consolidated-table thead, .mp-table thead { display: none; }

  .entry-table, .entry-table tbody, .entry-table tr,
  .consolidated-table, .consolidated-table tbody, .consolidated-table tr,
  .mp-table, .mp-table tbody, .mp-table tr {
    display: block;
    width: 100%;
  }

  .entry-row, .consolidated-table .dept-row, .mp-table tr {
    display: block;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 14px;
    padding: 8px 12px;
  }

  .entry-table td, .consolidated-table td, .mp-table td {
    display: block;
    width: 100% !important;
    box-sizing: border-box;
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 8px 2px;
  }
  .entry-table td:last-child, .consolidated-table td:last-child, .mp-table td:last-child { border-bottom: none; }

  .entry-table td[data-col]:not([data-col="actions"])::before,
  .consolidated-table td[data-col]::before,
  .mp-table td[data-col]:not([data-col="actions"])::before,
  .mp-table-readonly td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--muted);
    margin-bottom: 4px;
  }

  .entry-table td.row-actions {
    border-bottom: none;
    text-align: right;
    padding-top: 0;
  }

  .consolidated-table .dept-cell {
    background: transparent;
    border-bottom: 2px solid var(--navy);
    padding-bottom: 10px;
  }
  .consolidated-table .dept-cell::before { display: none; }

  .mp-section-head { flex-direction: column; align-items: flex-start; gap: 6px; }
}
