:root {
  --bg: #f4f7fc;
  --panel: #ffffff;
  --panel-soft: #fbfcff;
  --line: #e4ebf5;
  --line-strong: #cfdcf2;
  --text: #1f2a44;
  --muted: #6f7f99;
  --brand: #3d73ea;
  --brand-soft: #eaf1ff;
  --green: #39c53d;
  --red: #ff6b67;
  --red-soft: #fff0ef;
  --holiday: #ff7875;
  --holiday-soft: #fff1f0;
  --workday: #4c85ff;
  --workday-soft: #edf3ff;
  --leave: #ff9f43;
  --leave-soft: #fff5e8;
  --overtime: #14b8a6;
  --overtime-soft: #eafdfa;
  --shadow: 0 10px 28px rgba(50, 84, 130, 0.08);
  --radius-xl: 18px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --font-display: "Outfit", "Noto Sans SC", sans-serif;
  --font-body: "Noto Sans SC", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  font-size: 14px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.84)),
    linear-gradient(180deg, #eff4fb 0%, #f7f9fd 100%);
}

body.modal-open {
  overflow: hidden;
}

body.auth-page {
  overflow: hidden;
}

body.auth-page .app-shell {
  display: none;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 22% 14%, rgba(61, 115, 234, 0.18), transparent 28%),
    radial-gradient(circle at 78% 82%, rgba(20, 184, 166, 0.15), transparent 30%),
    linear-gradient(180deg, #f6f9ff 0%, #edf4ff 100%);
}

.auth-gate[hidden] {
  display: none;
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 30px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 28px 70px rgba(24, 46, 91, 0.18);
}

.auth-card h1 {
  margin: 0;
  font-size: 1.45rem;
}

.auth-card .button {
  width: 100%;
  min-height: 46px;
}

.auth-error {
  margin: 0;
  color: var(--red);
  font-weight: 700;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
label.file-trigger {
  cursor: pointer;
}

.app-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 14px 0 28px;
}

.hero {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  padding: 18px 22px;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero-copy {
  display: grid;
  gap: 4px;
  align-content: center;
}

.eyebrow,
.panel-kicker {
  margin: 0;
  color: var(--brand);
  letter-spacing: 0.03em;
  font-size: 0.72rem;
  font-weight: 700;
}

.hero h1,
.tab-bar h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.02rem, 1.5vw, 1.28rem);
  line-height: 1.15;
}

.hero-text,
.section-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.section-text.compact {
  margin-top: 6px;
  font-size: 0.88rem;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  margin-top: 14px;
}

.tab-bar {
  display: grid;
  gap: 10px;
  align-self: start;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.tab-bar-header {
  display: grid;
  gap: 4px;
  padding: 4px 2px 10px;
  border-bottom: 1px solid var(--line);
}

.tab-button {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 700;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.tab-button:hover {
  transform: translateY(-1px);
  color: var(--brand);
}

.tab-button.active {
  color: var(--brand);
  background: var(--brand-soft);
  border-color: #dbe7ff;
}

.tab-bar-footer {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.legend-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #f8fbff;
}

.legend-pill.holiday {
  color: var(--holiday);
  border-color: #ffd0ce;
  background: var(--holiday-soft);
}

.legend-pill.workday {
  color: var(--workday);
  border-color: #d9e5ff;
  background: var(--workday-soft);
}

.legend-pill.reports {
  color: var(--brand);
  border-color: #dbe7ff;
  background: var(--brand-soft);
}

.legend-pill.todos {
  color: var(--green);
  border-color: #d8f2db;
  background: #effaf0;
}

.legend-pill.accounts {
  color: #8b5cf6;
  border-color: #eadfff;
  background: #f5f0ff;
}

.legend-pill.leave {
  color: var(--leave);
  border-color: #ffd9a7;
  background: var(--leave-soft);
}

.legend-pill.overtime {
  color: var(--overtime);
  border-color: #bcefe8;
  background: var(--overtime-soft);
}

.workspace {
  min-width: 0;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
}

.hero-metrics {
  margin: 0;
}

.metric-card {
  min-height: 168px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-align: center;
}

.metric-label {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
}

.metric-value {
  font-family: var(--font-display);
  font-size: clamp(3rem, 4.2vw, 4.6rem);
  line-height: 1;
  font-weight: 700;
}

.metric-note {
  color: var(--muted);
  font-size: 0.92rem;
}

.metric-blue .metric-value {
  color: var(--brand);
}

.metric-green .metric-value {
  color: var(--green);
}

.metric-red .metric-value {
  color: var(--red);
}

.hero-metrics .metric-card {
  min-height: 120px;
  padding: 14px 14px;
}

.hero-metrics .metric-label {
  font-size: 0.82rem;
}

.hero-metrics .metric-value {
  font-size: clamp(1.8rem, 2.5vw, 2.4rem);
}

.hero-metrics .metric-note {
  font-size: 0.76rem;
}

.reports-layout,
.settings-grid {
  display: grid;
  gap: 16px;
}

.settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.panel-header,
.subpanel-header,
.entry-top,
.list-card-top,
.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.reports-main > .panel-header {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.panel h2,
.modal h2 {
  margin: 0;
  font-size: 1.22rem;
}

.panel h3,
.modal h3 {
  margin: 0;
  font-size: 1rem;
}

.calendar-tools {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(120px, auto) minmax(260px, 1fr) minmax(120px, auto);
  gap: 12px;
  align-items: center;
}

.calendar-nav {
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
}

.calendar-nav strong {
  text-align: center;
  font-weight: 700;
}

.dot-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.82rem;
}

.dot-legend span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  display: inline-block;
}

.dot.reports {
  background: var(--brand);
}

.dot.holiday {
  background: var(--holiday);
}

.dot.leave {
  background: var(--leave);
}

.dot.overtime {
  background: var(--overtime);
}

.calendar-legend,
.filter-row,
.search-row,
.global-search-box,
.search-summary,
.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.icon-button,
.button,
.button-secondary,
.chip,
.text-button,
.data-chip {
  transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.icon-button,
.button,
.button-secondary {
  border: 1px solid transparent;
  border-radius: 999px;
}

.icon-button {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  background: var(--panel);
  color: var(--brand);
  border-color: var(--line);
  font-size: 1.15rem;
}

.button,
.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  font-weight: 700;
}

.button-small {
  padding: 8px 12px;
  font-size: 0.86rem;
}

.button {
  background: var(--brand);
  color: white;
  box-shadow: 0 8px 20px rgba(61, 115, 234, 0.18);
}

.button-secondary {
  background: var(--panel);
  border-color: var(--line-strong);
  color: var(--brand);
}

.icon-button:hover,
.button:hover,
.button-secondary:hover,
.chip:hover,
.text-button:hover,
.data-chip:hover {
  transform: translateY(-1px);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.mobile-calendar-list,
.weekly-mobile-list {
  display: none;
}

.weekday-label,
.calendar-day {
  padding: 10px;
  border-radius: var(--radius-md);
}

.weekday-label {
  text-align: center;
  background: #f8fbff;
  color: var(--muted);
  font-size: 0.88rem;
  border: 1px solid var(--line);
}

.calendar-day {
  position: relative;
  min-height: 108px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  text-align: left;
}

.calendar-day:hover {
  border-color: #b8ccf5;
  box-shadow: 0 8px 18px rgba(61, 115, 234, 0.08);
}

.calendar-day.muted {
  opacity: 0.56;
  background: #f8fbff;
}

.calendar-day.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(61, 115, 234, 0.08);
}

.calendar-day.today::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--brand);
}

.day-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.day-number {
  font-weight: 800;
  font-size: 1rem;
}

.day-status-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.day-status {
  max-width: 72px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  line-height: 1.35;
  text-align: center;
  word-break: break-all;
}

.day-status.holiday {
  color: var(--holiday);
  background: var(--holiday-soft);
}

.day-status.workday {
  color: var(--workday);
  background: var(--workday-soft);
}

.day-status.leave {
  color: var(--leave);
  background: var(--leave-soft);
}

.day-status.overtime {
  color: var(--overtime);
  background: var(--overtime-soft);
}

.day-status.reports {
  color: var(--brand);
  background: var(--brand);
}

.day-preview {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

.preview-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.count-badge,
.hint {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: #f6f9ff;
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 0.86rem;
}

.count-badge.holiday {
  color: var(--holiday);
  background: var(--holiday-soft);
  border-color: #ffd0ce;
}

.count-badge.workday {
  color: var(--workday);
  background: var(--workday-soft);
  border-color: #d9e5ff;
}

.count-badge.leave {
  color: var(--leave);
  background: var(--leave-soft);
  border-color: #ffd9a7;
}

.count-badge.overtime {
  color: var(--overtime);
  background: var(--overtime-soft);
  border-color: #bcefe8;
}

.stack-form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
}

label span {
  color: var(--muted);
  font-size: 0.88rem;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #a8c2f8;
  box-shadow: 0 0 0 4px rgba(61, 115, 234, 0.08);
}

textarea {
  min-height: 88px;
  resize: vertical;
}

.marker-switch {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #f4f7fd;
  overflow: hidden;
}

.marker-switch-indicator {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc((100% - 8px) / 3);
  height: calc(100% - 8px);
  border-radius: 10px;
  background: white;
  box-shadow: 0 8px 18px rgba(61, 115, 234, 0.12);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.marker-switch[data-active="leave"] .marker-switch-indicator {
  transform: translateX(100%);
  background: var(--leave-soft);
}

.marker-switch[data-active="overtime"] .marker-switch-indicator {
  transform: translateX(200%);
  background: var(--overtime-soft);
}

.marker-option {
  position: relative;
  z-index: 1;
  min-height: 42px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  transition: color 0.2s ease;
}

.marker-option.active[data-marker-option="none"] {
  color: var(--brand);
}

.marker-option.active[data-marker-option="leave"] {
  color: var(--leave);
}

.marker-option.active[data-marker-option="overtime"] {
  color: var(--overtime);
}

.task-editor {
  display: grid;
  gap: 12px;
}

.quick-record-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid #dbe7ff;
  background: #f7faff;
}

.manual-entry-panel {
  display: grid;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--line-strong);
  background: #fcfdff;
}

.form-mode-bar,
.task-editor-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.form-mode-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.task-editor-actions,
.quick-record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.task-editor-header span {
  color: var(--muted);
  font-size: 0.88rem;
}

.task-list,
.entry-list,
.card-list,
.weekly-list {
  display: grid;
  gap: 12px;
}

.task-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.task-input {
  border-radius: 999px;
}

.empty-state {
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  text-align: center;
  background: #fafcff;
}

.global-search-box {
  display: grid;
  align-items: stretch;
  gap: 12px;
}

.global-search-box input[type="search"] {
  min-width: min(100%, 420px);
  flex: 1 1 420px;
}

.search-summary {
  align-items: center;
  justify-content: space-between;
}

.search-results {
  text-align: left;
}

.search-result-card {
  display: grid;
  gap: 10px;
}

.search-result-snippet {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  white-space: pre-wrap;
}

.search-result-title {
  margin: 0;
  font-size: 0.98rem;
}

.entry-card,
.list-card,
.week-card,
.tip-card,
.settings-note,
.modal-section {
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.entry-card,
.list-card,
.week-card,
.tip-card,
.settings-note {
  padding: 16px;
}

.entry-card.is-editing {
  border-color: #b8ccf5;
  box-shadow: 0 0 0 2px rgba(61, 115, 234, 0.08);
}

.entry-title,
.todo-title,
.account-title,
.week-title {
  margin: 0;
  font-size: 0.98rem;
}

.entry-meta,
.todo-date,
.account-user,
.week-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.entry-actions,
.todo-actions {
  display: flex;
  gap: 6px;
}

.entry-tasks {
  margin: 14px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 7px;
  line-height: 1.6;
}

.text-button {
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: var(--brand);
  font-weight: 700;
}

.text-button.danger {
  color: var(--red);
}

.week-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 0;
  border: none;
  background: transparent;
  text-align: left;
}

.week-toggle-indicator {
  color: var(--brand);
  font-weight: 700;
  flex-shrink: 0;
}

.week-body {
  display: none;
  margin-top: 14px;
}

.week-card.expanded .week-body {
  display: block;
}

.weekly-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.weekly-table {
  width: 100%;
  border-collapse: collapse;
}

.weekly-table th,
.weekly-table td {
  padding: 10px 8px;
  border-top: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
  font-size: 0.86rem;
}

.weekly-table th {
  color: var(--muted);
  font-weight: 700;
}

.weekly-table td[rowspan] {
  vertical-align: middle;
  background: #fbfdff;
  font-weight: 700;
}

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

.copy-column-btn,
.copyable,
.cell-copy {
  border: none;
  background: transparent;
  cursor: pointer;
}

.copy-column-btn {
  padding: 0;
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 700;
}

.cell-copy {
  width: 100%;
  padding: 0;
  color: inherit;
  text-align: left;
  font: inherit;
  white-space: pre-wrap;
}

.chip {
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--muted);
  font-weight: 600;
}

.chip.active {
  background: var(--brand-soft);
  border-color: #dbe7ff;
  color: var(--brand);
}

.list-card.done {
  opacity: 0.72;
}

.list-card.done .todo-title,
.list-card.done .todo-note {
  text-decoration: line-through;
}

.todo-note {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.7;
  white-space: pre-wrap;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.data-chip {
  display: grid;
  gap: 5px;
  padding: 12px;
  border-radius: 12px;
  background: var(--brand-soft);
  text-align: left;
  color: var(--text);
}

.data-chip small {
  color: var(--muted);
  font-size: 0.76rem;
}

.data-chip strong {
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.data-chip:disabled {
  opacity: 0.56;
  cursor: default;
}

.settings-note strong,
.tip-card strong {
  display: block;
  font-size: 0.98rem;
}

.date-marker-note {
  min-height: 100%;
}

.settings-note p,
.tip-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.sync-status {
  margin-top: 12px;
  background: linear-gradient(135deg, #f7fbff 0%, #ffffff 100%);
}

.tips-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 39, 64, 0.38);
}

.modal-dialog {
  position: relative;
  width: min(1180px, 100%);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(24, 46, 91, 0.2);
}

.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

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

.modal-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 18px;
  min-height: 0;
  overflow-y: auto;
}

.modal-section {
  padding: 16px;
}

.modal-section .entry-list {
  max-height: 460px;
  overflow: auto;
  padding-right: 4px;
}

.screenshot-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.screenshot-card {
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.screenshot-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #eef3fb;
}

.screenshot-card-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
}

.screenshot-card-footer span {
  min-width: 0;
  color: var(--muted);
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(31, 42, 68, 0.94);
  color: white;
  box-shadow: var(--shadow);
  animation: fade-in 0.18s ease;
  z-index: 60;
}

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

@media (max-width: 1180px) {
  .hero,
  .dashboard-shell,
  .reports-layout,
  .settings-grid,
  .tips-grid,
  .account-grid,
  .form-row,
  .modal-body {
    grid-template-columns: 1fr;
  }

  .tab-bar {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: center;
  }

  .tab-bar-header,
  .tab-bar-footer {
    display: none;
  }

  .tab-button {
    text-align: center;
  }
}

@media (max-width: 760px) {
  html {
    font-size: 13px;
  }

  body {
    background:
      radial-gradient(circle at top left, rgba(61, 115, 234, 0.12), transparent 34vw),
      linear-gradient(180deg, #f6f9ff 0%, #eef4fb 100%);
  }

  .app-shell {
    width: 100%;
    padding: 8px 10px 18px;
  }

  .hero,
  .tab-bar,
  .panel,
  .metric-card,
  .modal-header,
  .modal-body {
    padding-left: 14px;
    padding-right: 14px;
  }

  .hero {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    border-radius: 16px;
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .hero-copy {
    gap: 4px;
  }

  .hero h1 {
    font-size: 1.14rem;
  }

  .hero-text {
    font-size: 0.78rem;
  }

  .metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .hero-metrics .metric-card {
    min-height: 92px;
    padding: 10px 6px;
    border-radius: 16px;
  }

  .hero-metrics .metric-value {
    font-size: clamp(1.65rem, 8vw, 2.1rem);
  }

  .hero-metrics .metric-note {
    display: none;
  }

  .hero-metrics .metric-label {
    font-size: 0.86rem;
  }

  .dashboard-shell {
    gap: 10px;
    margin-top: 10px;
  }

  .tab-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
    border-radius: 16px;
    box-shadow: 0 10px 28px rgba(50, 84, 130, 0.12);
    scrollbar-width: none;
  }

  .tab-bar::-webkit-scrollbar {
    display: none;
  }

  .tab-bar-header,
  .tab-bar-footer {
    display: none;
  }

  .tab-button {
    width: 100%;
    min-height: 38px;
    padding: 9px 4px;
    white-space: nowrap;
    text-align: center;
    font-size: 0.86rem;
  }

  .panel {
    border-radius: 16px;
  }

  .panel-header,
  .subpanel-header,
  .entry-top,
  .list-card-top,
  .form-mode-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .calendar-tools {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .calendar-tools #today-month-btn {
    width: 100%;
  }

  .calendar-nav {
    width: 100%;
  }

  .dot-legend {
    justify-content: center;
    gap: 8px 12px;
    margin-top: 12px;
  }

  .calendar-legend {
    display: none;
  }

  .calendar-grid {
    gap: 4px;
    margin-top: 12px;
  }

  .weekday-label {
    padding: 7px 2px;
    font-size: 0.76rem;
  }

  .calendar-day {
    min-height: 46px;
    justify-content: center;
    gap: 5px;
    padding: 5px 3px;
    border-radius: 10px;
    text-align: center;
  }

  .day-head {
    justify-content: center;
    gap: 3px;
  }

  .day-number {
    font-size: 0.88rem;
  }

  .day-status-group {
    position: absolute;
    right: 3px;
    bottom: 3px;
    gap: 2px;
  }

  .day-status {
    width: 5px;
    height: 5px;
    max-width: none;
    padding: 0;
    border-radius: 999px;
    overflow: hidden;
    color: transparent;
  }

  .day-status.holiday {
    background: var(--holiday);
  }

  .day-status.workday,
  .day-status.reports {
    background: var(--brand);
  }

  .day-status.leave {
    background: var(--leave);
  }

  .day-status.overtime {
    background: var(--overtime);
  }

  .day-preview {
    display: none;
  }

  .day-preview .preview-pill:nth-child(n + 2) {
    display: none;
  }

  .preview-pill {
    padding: 3px 5px;
    border-radius: 8px;
  }

  .weekly-table-wrap {
    display: none;
  }

  .weekly-mobile-list {
    display: grid;
    gap: 12px;
  }

  .weekly-mobile-day {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
  }

  .weekly-mobile-day-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
  }

  .weekly-mobile-entry {
    display: grid;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
  }

  .weekly-mobile-name {
    font-weight: 800;
    color: var(--text);
  }

  .weekly-mobile-requirement {
    width: fit-content;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 0.78rem;
  }

  .weekly-mobile-tasks {
    line-height: 1.7;
  }

  .task-row {
    grid-template-columns: 1fr;
  }

  .modal {
    align-items: end;
    padding: 0;
  }

  .modal-dialog {
    width: 100%;
    max-height: 94vh;
    border-radius: 22px 22px 0 0;
    border-bottom: none;
  }

  .modal-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
  }

  .modal-header-actions,
  .form-mode-actions,
  .entry-actions,
  .todo-actions {
    flex-wrap: wrap;
  }

  .modal-body {
    gap: 12px;
    padding-top: 12px;
  }

  .modal-section {
    padding: 14px;
  }

  input,
  select,
  textarea,
  .button,
  .button-secondary,
  .chip,
  .text-button {
    min-height: 42px;
  }

  .quick-record-actions {
    align-items: stretch;
  }

  .quick-record-actions .button {
    width: 100%;
  }

  .account-grid {
    grid-template-columns: 1fr;
  }

  .settings-actions .button,
  .settings-actions .file-trigger {
    width: 100%;
  }
}

/* Mobile hardening pass: keep every app surface inside the viewport. */
@media (max-width: 760px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-shell,
  .hero,
  .hero-copy,
  .hero-metrics,
  .dashboard-shell,
  .workspace,
  .tab-panel,
  .reports-layout,
  .panel,
  .calendar-tools,
  .calendar-nav,
  .calendar-grid,
  .weekly-list,
  .week-card {
    min-width: 0;
    max-width: 100%;
  }

  .app-shell {
    width: 100%;
    padding: 10px 10px 96px;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    overflow: hidden;
    padding: 16px;
  }

  .hero-copy {
    min-height: auto;
  }

  .metrics-grid,
  .hero-metrics {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .metric-card,
  .hero-metrics .metric-card {
    min-width: 0;
    width: 100%;
    min-height: 88px;
    padding: 10px 4px;
    overflow: hidden;
  }

  .metric-label {
    max-width: 100%;
    font-size: 0.76rem;
    line-height: 1.2;
    white-space: normal;
  }

  .metric-value,
  .hero-metrics .metric-value {
    font-size: clamp(1.45rem, 7vw, 1.95rem);
  }

  .metric-note {
    display: none;
  }

  .tab-bar {
    left: 10px;
    right: 10px;
    width: auto;
  }

  .tab-button {
    min-width: 0;
    overflow: hidden;
    text-overflow: clip;
  }

  .calendar-tools {
    grid-template-columns: minmax(0, 1fr);
  }

  .calendar-nav {
    grid-template-columns: 38px minmax(0, 1fr) 38px;
  }

  .dot-legend {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .dot-legend span {
    justify-content: center;
    min-width: 0;
    font-size: 0.76rem;
  }

  .calendar-grid {
    width: 100%;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 5px;
  }

  .weekday-label,
  .calendar-day {
    min-width: 0;
    padding-left: 0;
    padding-right: 0;
  }

  .calendar-day {
    min-height: 48px;
  }

  .day-number {
    font-size: 0.84rem;
  }
}

/* Redesign layer: compact app-like workbench */
:root {
  --bg: #eef4fb;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-soft: #f8fbff;
  --line: #dfe8f5;
  --line-strong: #c9d8ed;
  --text: #14213d;
  --muted: #667895;
  --brand: #2f6df6;
  --brand-soft: #eaf2ff;
  --green: #22c55e;
  --red: #ff6565;
  --holiday: #ff5f6d;
  --workday: #2f6df6;
  --leave: #f59e0b;
  --overtime: #10b981;
  --shadow: 0 18px 50px rgba(44, 79, 128, 0.12);
  --shadow-soft: 0 10px 28px rgba(44, 79, 128, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

body {
  background:
    radial-gradient(circle at 12% 8%, rgba(47, 109, 246, 0.12), transparent 28%),
    radial-gradient(circle at 88% 12%, rgba(16, 185, 129, 0.10), transparent 26%),
    linear-gradient(180deg, #f6f9ff 0%, var(--bg) 48%, #f7f9fc 100%);
}

.app-shell {
  width: min(1320px, calc(100% - 36px));
  padding: 18px 0 36px;
}

.auth-gate {
  padding: 22px;
  background:
    radial-gradient(circle at 18% 18%, rgba(47, 109, 246, 0.18), transparent 30%),
    radial-gradient(circle at 82% 72%, rgba(16, 185, 129, 0.16), transparent 28%),
    linear-gradient(145deg, #f7fbff 0%, #eaf2ff 100%);
}

.auth-card {
  position: relative;
  width: min(440px, 100%);
  gap: 18px;
  padding: 34px;
  border-radius: 30px;
  border: 1px solid rgba(201, 216, 237, 0.9);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.9)),
    radial-gradient(circle at top right, rgba(47, 109, 246, 0.14), transparent 42%);
  box-shadow: 0 28px 90px rgba(28, 55, 100, 0.20);
}

.auth-card::before {
  content: "";
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background:
    linear-gradient(135deg, var(--brand), #7aa7ff);
  box-shadow: 0 12px 26px rgba(47, 109, 246, 0.24);
}

.auth-card h1 {
  font-size: 1.65rem;
  letter-spacing: -0.03em;
}

.auth-card input {
  min-height: 48px;
  border-radius: 16px;
  background: #f8fbff;
}

.auth-card .button {
  min-height: 50px;
  border-radius: 16px;
}

.hero,
.tab-bar,
.panel {
  border: 1px solid rgba(214, 226, 242, 0.95);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}

.hero {
  grid-template-columns: minmax(180px, 0.55fr) minmax(0, 1.45fr);
  gap: 18px;
  padding: 20px;
  border-radius: 30px;
}

.hero-copy {
  min-height: 122px;
  padding: 4px 4px 4px 6px;
}

.eyebrow,
.panel-kicker {
  color: var(--brand);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
}

.hero h1 {
  font-size: clamp(1.25rem, 2vw, 1.8rem);
  letter-spacing: -0.05em;
}

.metrics-grid {
  gap: 14px;
}

.hero-metrics .metric-card,
.metric-card {
  min-height: 122px;
  gap: 8px;
  border-radius: 24px;
  border-color: rgba(210, 223, 242, 0.96);
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 12px 24px rgba(44, 79, 128, 0.08);
}

.metric-label {
  font-size: 0.92rem;
}

.metric-value {
  font-size: clamp(2.1rem, 3vw, 3rem);
  letter-spacing: -0.06em;
}

.dashboard-shell {
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.tab-bar {
  position: sticky;
  top: 14px;
  gap: 8px;
  padding: 12px;
  border-radius: 26px;
}

.tab-bar-header {
  display: none;
}

.tab-button {
  min-height: 46px;
  padding: 0 14px;
  border-radius: 16px;
  color: #60728f;
}

.tab-button.active {
  color: var(--brand);
  background:
    linear-gradient(180deg, #edf4ff 0%, #e7f0ff 100%);
  border-color: #cfe0ff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.tab-bar-footer {
  display: none;
}

.workspace {
  display: grid;
  gap: 18px;
}

.panel {
  padding: 22px;
  border-radius: 28px;
}

.panel h2,
.modal h2 {
  font-size: 1.35rem;
  letter-spacing: -0.04em;
}

.reports-layout {
  gap: 18px;
}

.reports-main > .panel-header {
  gap: 16px;
}

.calendar-tools {
  grid-template-columns: minmax(130px, 0.26fr) minmax(260px, 1fr);
}

.calendar-nav {
  min-height: 50px;
  border-radius: 18px;
  background: #f8fbff;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 14px;
}

.button,
.button-secondary,
.chip {
  border-radius: 16px;
}

.button {
  background: linear-gradient(135deg, var(--brand), #5d91ff);
  box-shadow: 0 12px 24px rgba(47, 109, 246, 0.18);
}

.button-secondary {
  background: #f8fbff;
}

.dot-legend {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f9fbff;
}

.calendar-grid {
  gap: 8px;
}

.weekday-label,
.calendar-day {
  border-radius: 16px;
}

.weekday-label {
  border: none;
  background: #f5f8fd;
  font-weight: 800;
}

.calendar-day {
  min-height: 96px;
  border-color: #dce8f6;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.calendar-day.selected {
  border-color: var(--brand);
  background: #f7fbff;
  box-shadow: 0 0 0 3px rgba(47, 109, 246, 0.10);
}

.calendar-day.today::after {
  top: 9px;
  right: 9px;
}

.preview-pill {
  border-radius: 10px;
}

.entry-card,
.list-card,
.week-card,
.tip-card,
.settings-note,
.modal-section {
  border-color: #dde8f6;
  background: #fbfdff;
  border-radius: 20px;
}

.week-toggle {
  padding: 2px;
}

.week-toggle-indicator,
.text-button,
.copy-column-btn {
  color: var(--brand);
}

.modal-dialog {
  border-radius: 28px;
  box-shadow: 0 30px 90px rgba(24, 46, 91, 0.24);
}

.quick-record-panel,
.manual-entry-panel {
  border-radius: 20px;
}

input,
select,
textarea {
  border-radius: 16px;
  background: #fbfdff;
}

@media (max-width: 1180px) {
  .dashboard-shell {
    grid-template-columns: 1fr;
  }

  .tab-bar {
    top: 10px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body {
    padding-bottom: 86px;
  }

  .app-shell {
    padding: 10px 10px 22px;
  }

  .auth-card {
    padding: 28px;
    border-radius: 28px;
  }

  .hero {
    gap: 12px;
    padding: 18px;
    border-radius: 26px;
  }

  .hero-copy {
    min-height: auto;
    padding: 0;
  }

  .hero h1 {
    font-size: 1.35rem;
  }

  .hero-metrics .metric-card {
    min-height: 90px;
    padding: 10px 4px;
  }

  .hero-metrics .metric-label {
    font-size: 0.78rem;
  }

  .hero-metrics .metric-value {
    font-size: clamp(1.55rem, 7.2vw, 2rem);
  }

  .dashboard-shell {
    margin-top: 12px;
  }

  .tab-bar {
    position: fixed;
    left: 10px;
    right: 10px;
    top: auto;
    bottom: 10px;
    z-index: 45;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
    padding: 8px;
    border-radius: 22px;
    box-shadow: 0 16px 44px rgba(36, 62, 104, 0.22);
  }

  .tab-button {
    min-height: 42px;
    padding: 0 2px;
    border-radius: 15px;
    font-size: 0.78rem;
  }

  .panel {
    padding: 16px;
    border-radius: 24px;
  }

  .panel h2,
  .modal h2 {
    font-size: 1.22rem;
  }

  .calendar-tools {
    grid-template-columns: 1fr;
  }

  .dot-legend {
    justify-content: flex-start;
    padding: 9px 10px;
  }

  .calendar-grid {
    gap: 5px;
  }

  .weekday-label {
    padding: 8px 0;
    border-radius: 12px;
  }

  .calendar-day {
    min-height: 50px;
    border-radius: 13px;
  }

  .day-status-group {
    right: 5px;
    bottom: 5px;
  }

  .day-status {
    width: 5px;
    height: 5px;
  }

  .weekly-mobile-day,
  .entry-card,
  .list-card,
  .modal-section {
    border-radius: 18px;
  }

  .modal {
    z-index: 70;
  }

  .modal-dialog {
    max-height: 94vh;
    border-radius: 26px 26px 0 0;
  }

  .toast {
    left: 14px;
    right: 14px;
    bottom: 96px;
    text-align: center;
  }
}

/* Final mobile fit pass. Keep this last so older desktop-first rules cannot re-expand the page. */
@media (max-width: 760px) {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
    min-width: 0 !important;
  }

  html,
  body {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: clip !important;
  }

  body {
    padding: 0 0 calc(84px + env(safe-area-inset-bottom)) !important;
  }

  .app-shell {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 10px 10px 20px !important;
    overflow: hidden !important;
  }

  .hero,
  .dashboard-shell,
  .workspace,
  .tab-panel,
  .reports-layout,
  .reports-main,
  .reports-bottom,
  .panel,
  .weekly-list,
  .week-card {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  .hero {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    padding: 14px !important;
    border-radius: 22px !important;
  }

  .hero-copy {
    width: 100% !important;
    min-height: auto !important;
    padding: 0 !important;
  }

  .hero h1 {
    font-size: 1.28rem !important;
    line-height: 1.15 !important;
  }

  .metrics-grid,
  .hero-metrics {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 8px !important;
  }

  .metric-card,
  .hero-metrics .metric-card {
    width: auto !important;
    min-height: 82px !important;
    padding: 8px 3px !important;
    gap: 4px !important;
    border-radius: 16px !important;
  }

  .metric-label,
  .hero-metrics .metric-label {
    font-size: 0.72rem !important;
    line-height: 1.2 !important;
    white-space: normal !important;
  }

  .metric-value,
  .hero-metrics .metric-value {
    font-size: clamp(1.45rem, 7vw, 1.9rem) !important;
    line-height: 1 !important;
  }

  .metric-note {
    display: none !important;
  }

  .dashboard-shell {
    display: block !important;
    margin-top: 12px !important;
  }

  .workspace {
    display: block !important;
  }

  .panel {
    padding: 14px !important;
    border-radius: 22px !important;
  }

  .panel-header {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
    align-items: start !important;
  }

  .panel h2,
  .modal h2 {
    font-size: 1.18rem !important;
  }

  .calendar-tools {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 10px !important;
    width: 100% !important;
  }

  .calendar-tools #today-month-btn {
    width: 100% !important;
    min-height: 42px !important;
  }

  .calendar-nav {
    display: grid !important;
    grid-template-columns: 38px minmax(0, 1fr) 38px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 46px !important;
  }

  .dot-legend {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    width: 100% !important;
    gap: 6px !important;
    padding: 8px !important;
  }

  .dot-legend span {
    justify-content: center !important;
    gap: 4px !important;
    font-size: 0.68rem !important;
    white-space: nowrap !important;
  }

  .dot-legend .dot {
    width: 7px !important;
    height: 7px !important;
  }

  .calendar-grid {
    display: grid !important;
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 5px !important;
    overflow: hidden !important;
  }

  .weekday-label,
  .calendar-day {
    width: auto !important;
    max-width: 100% !important;
    padding: 0 !important;
    border-radius: 12px !important;
  }

  .weekday-label {
    display: grid !important;
    place-items: center !important;
    height: 34px !important;
    font-size: 0.72rem !important;
  }

  .calendar-day {
    display: grid !important;
    place-items: center !important;
    min-height: 48px !important;
  }

  .day-head {
    justify-content: center !important;
    width: 100% !important;
  }

  .day-number {
    font-size: 0.82rem !important;
  }

  .day-preview {
    display: none !important;
  }

  .day-status-group {
    right: 5px !important;
    bottom: 5px !important;
    gap: 2px !important;
  }

  .day-status {
    width: 5px !important;
    height: 5px !important;
  }

  .tab-bar {
    position: fixed !important;
    left: 10px !important;
    right: 10px !important;
    bottom: calc(10px + env(safe-area-inset-bottom)) !important;
    top: auto !important;
    z-index: 45 !important;
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    width: auto !important;
    max-width: none !important;
    gap: 5px !important;
    padding: 8px !important;
    border-radius: 20px !important;
  }

  .tab-button {
    min-height: 42px !important;
    padding: 0 2px !important;
    border-radius: 14px !important;
    font-size: 0.75rem !important;
    white-space: nowrap !important;
  }

  .weekly-mobile-day,
  .weekly-mobile-project,
  .weekly-mobile-tasks,
  .entry-card,
  .list-card {
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }
}
