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

:root {
  --bg: #0f141c;
  --surface: rgba(26, 33, 45, 0.66);
  --surface-strong: rgba(35, 45, 61, 0.82);
  --border: rgba(170, 191, 219, 0.22);
  --text-primary: #e8eef8;
  --text-secondary: #a5b8d1;
  --accent-blue: #4da3ff;
  --accent-red: #ff6b7a;
  --accent-green: #42d68b;
  --accent-orange: #ffb86b;
  --shadow-soft: 0 10px 32px rgba(7, 13, 24, .35);
  --glass-blur: 16px;

  --base-font-size: clamp(15px, 1.1vw + 11px, 19px);
  --content-pad: clamp(14px, 2.8vw, 28px);
  --top-nav-height: clamp(68px, 6vw + 42px, 92px);
  --top-nav-title-size: clamp(21px, 1.4vw + 14px, 34px);
  --menu-touch-size: clamp(46px, 4vw + 30px, 62px);
  --menu-font-size: clamp(16px, 0.75vw + 13px, 21px);
  --fab-size: clamp(56px, 6vw + 34px, 74px);
  --timesheet-cell-font: clamp(12px, 0.7vw + 9px, 16px);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #eef3fa;
    --surface: rgba(255, 255, 255, .74);
    --surface-strong: rgba(255, 255, 255, .92);
    --border: rgba(90, 120, 160, .22);
    --text-primary: #132032;
    --text-secondary: #526681;
    --shadow-soft: 0 14px 34px rgba(35, 57, 92, .12);
  }
}

@media (pointer: coarse) and (max-width: 1024px) {
  :root {
    --base-font-size: clamp(16px, 1.6vw + 11px, 21px);
    --top-nav-title-size: clamp(23px, 2vw + 14px, 36px);
    --menu-font-size: clamp(17px, 1.2vw + 13px, 23px);
    --menu-touch-size: clamp(48px, 5vw + 30px, 66px);
    --fab-size: clamp(60px, 7vw + 34px, 80px);
    --timesheet-cell-font: clamp(13px, .9vw + 10px, 17px);
  }
}

* { box-sizing: border-box; }
html, body { width: 100%; overflow-x: hidden; min-height: 100%; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at top right, rgba(77,163,255,.18), transparent 42%), var(--bg);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  color: var(--text-primary);
  font-size: var(--base-font-size);
}

.container { max-width: 1120px; margin: 0 auto; padding: 0 var(--content-pad); }
.main-content {
  max-width: 1120px;
  margin: calc(var(--top-nav-height) + 24px) auto 0;
  padding: var(--content-pad);
  display: grid;
  gap: 18px;
}
section, .section { margin: 0; }

.top-nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 120;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: grid;
  grid-template-columns: var(--menu-touch-size) 1fr;
  align-items: center;
  gap: clamp(10px, 1.4vw, 16px);
  min-height: var(--top-nav-height);
}
.top-nav-title {
  margin: 0;
  font-size: var(--top-nav-title-size);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-nav-toggle {
  width: var(--menu-touch-size);
  height: var(--menu-touch-size);
  border-radius: clamp(10px, 1.2vw, 14px);
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--text-primary);
  cursor: pointer;
  display: grid;
  align-content: center;
  gap: clamp(5px, .6vw, 7px);
  padding: 0 clamp(10px, .8vw, 13px);
  transition: background .22s ease, transform .22s ease;
}
.mobile-nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform .22s ease, opacity .22s ease;
}
body.nav-open .mobile-nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.nav-open .mobile-nav-toggle span:nth-child(2) { opacity: 0; }
body.nav-open .mobile-nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.side-nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 11, 20, .5);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .24s ease;
  z-index: 145;
}
.side-nav {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: min(clamp(320px, 78vw, 420px), 94vw);
  padding: clamp(16px, 2.2vw, 24px) clamp(14px, 1.8vw, 20px);
  display: grid;
  gap: 14px;
  grid-template-rows: auto auto 1fr auto;
  background: color-mix(in srgb, var(--bg), var(--surface-strong) 72%);
  border-right: 1px solid var(--border);
  transform: translateX(-104%);
  transition: transform .24s ease;
  z-index: 150;
}
body.nav-open .side-nav-overlay { opacity: 1; pointer-events: auto; }
body.nav-open .side-nav { transform: translateX(0); }
.side-nav-brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: clamp(18px, 1vw + 14px, 24px); }
.side-nav-brand img { width: clamp(30px, 2.6vw, 40px); height: clamp(30px, 2.6vw, 40px); }
.side-nav-user { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); color: inherit; text-decoration: none; }
.side-nav-user:hover { background: var(--surface-strong); }
.side-nav-user strong { display: block; line-height: 1.2; }
.side-nav-user small { display: block; font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.side-nav-links { display: grid; gap: 8px; align-content: start; overflow-y: auto; padding-right: 4px; }
.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  padding: clamp(12px, 1.5vw, 16px) clamp(12px, 1.4vw, 16px);
  border-radius: 12px;
  font-size: var(--menu-font-size);
  font-weight: 600;
  min-height: clamp(50px, 5vw, 62px);
  display: flex;
  align-items: center;
  transition: color .22s ease, background .22s ease;
}
.nav-link:hover { color: var(--text-primary); background: var(--surface-strong); }
.nav-link.active { color: #fff; background: color-mix(in srgb, var(--accent-blue), transparent 55%); }
.side-nav-logout { width: 100%; text-align: center; }

.entity-link { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent-blue), transparent 45%); text-underline-offset: 2px; }
.entity-link:hover { color: var(--accent-blue); }

.workers-search-toggle { margin: 6px 0 10px; }
.workers-search-toggle.active { background: color-mix(in srgb, var(--accent-blue), transparent 75%); }
.workers-filters { display: none; margin-bottom: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: color-mix(in srgb, var(--surface), transparent 5%); }
.workers-filters.is-open { display: grid; gap: 10px; }
.workers-summary { margin: 8px 0 12px; }

.dynamic-select-group { display: grid; gap: 8px; }
.dynamic-select-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.dynamic-select { width: 100%; }
.btn-mini { padding: 8px 10px; min-width: 40px; }
.timesheet-form { align-items: start; }
.timesheet-form .form-actions-edit { grid-column: 1 / -1; margin-top: 8px; }

.dashboard-stats .metric { min-height: 112px; display: grid; align-content: center; }
.metric-link { text-decoration: none; color: inherit; }
.metric-link:hover { transform: translateY(-2px); }


.object-card { padding: 18px; }
.object-card .info-card-header { margin-bottom: 14px; }
.object-card .details-list { margin: 6px 0 2px; }
.object-card .info-card-actions { margin-top: 14px; }
.assignment-card { margin-top: 0; }
.card > .schedule-vertical, .card > .workers-grid, .card > .compact-grid { margin-top: 12px; }


.floating-create-wrap {
  position: fixed;
  right: clamp(8px, 1.6vw, 18px);
  bottom: calc(clamp(8px, 1.6vw, 18px) + env(safe-area-inset-bottom));
  z-index: 258;
  padding: clamp(6px, 1.1vw, 10px);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface), transparent 8%);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.floating-create-btn {
  width: var(--fab-size);
  height: var(--fab-size);
  border-radius: 50%;
  display: grid;
  place-items: center;
  text-decoration: none;
  font-size: clamp(32px, 3.2vw, 44px);
  line-height: 1;
  color: #fff;
  background: var(--accent-blue);
  box-shadow: 0 10px 24px rgba(0,0,0,.35);
  transition: transform .22s ease, background .22s ease;
  animation: softPulse 2.6s ease-in-out infinite;
}
.floating-create-btn:hover { background: color-mix(in srgb, var(--accent-blue), #000 16%); transform: translateY(-1px) scale(1.04); }
.modal-form-layout .floating-create-wrap { display: none !important; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes softPulse { 0%,100% { box-shadow: 0 10px 24px rgba(0,0,0,.35); } 50% { box-shadow: 0 14px 30px rgba(77,163,255,.42); } }
@keyframes shimmerIn { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: scale(1); } }
.card, .worker-card, .info-card, .placeholder-card { animation: fadeUp .28s ease both; }

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-strong);
  border: 1px solid var(--border);
}

.card, .worker-card, .info-card, .placeholder-card, .table-row {
  background: var(--surface);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  transition: box-shadow .22s ease, background .22s ease, transform .22s ease;
}
.card:hover, .worker-card:hover, .info-card:hover { box-shadow: 0 12px 36px rgba(8, 15, 29, .42); transform: translateY(-1px); }
.card, .placeholder-card { padding: 20px; }
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-body { display: block; }

.metric { padding: 14px; border-radius: 14px; background: var(--surface-strong); border: 1px solid var(--border); }
.metric .label { color: var(--text-secondary); font-size: 12px; }
.metric .value { font-size: 28px; font-weight: 700; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.metric .trend.up { color: var(--accent-green); }
.metric .trend.down { color: var(--accent-red); }

.status-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 999px; font-size: 12px; }
.status-badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.status-badge.online, .status-badge.active { color: var(--accent-green); background: color-mix(in srgb, var(--accent-green), transparent 80%); }
.status-badge.offline { color: var(--accent-red); background: color-mix(in srgb, var(--accent-red), transparent 82%); }
.status-badge.warning { color: var(--accent-orange); background: color-mix(in srgb, var(--accent-orange), transparent 82%); }

.page-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.page-header h1 { margin: 0; font-size: clamp(24px, 3.2vw, 32px); }
.back-link { color: var(--text-secondary); text-decoration: none; margin-bottom: 10px; display: inline-flex; align-items: center; gap: 8px; }
.back-link svg { width: 16px; height: 16px; flex-shrink: 0; }

.table, .timesheet-matrix { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
.table thead th { color: var(--text-secondary); font-weight: 600; text-align: left; padding: 8px; }
.table tbody tr { background: var(--surface-strong); border: 1px solid var(--border); }
.table td, .table th { padding: 10px 12px; }
.table td:nth-child(2), .table td:nth-child(3), .table td:nth-child(4), .table td:last-child { font-family: ui-monospace, Menlo, monospace; }

.workers-grid, .compact-grid { display: grid; gap: 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.worker-card { padding: 16px; }
.worker-card-link-wrapper { text-decoration: none; color: inherit; }
.worker-card-header { display: flex; gap: 10px; }
.worker-avatar { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-strong); display: grid; place-items: center; }

.form-grid, .form-grid-edit, .timesheet-form { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-group, .form-group-edit { display: flex; flex-direction: column; gap: 6px; }
.form-control, input, select, textarea {
  width: 100%;
  background: var(--surface-strong);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: color-mix(in srgb, var(--accent-blue), white 20%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-blue), transparent 76%);
}
.form-actions, .form-actions-edit, .filter-actions, .table-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.form-error { margin: 0 0 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--accent-red), transparent 45%); background: color-mix(in srgb, var(--accent-red), transparent 86%); color: #ffd4d9; font-weight: 600; animation: fadeUp .22s ease both; }

.btn {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .24s ease, transform .24s ease, box-shadow .24s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent-blue); color: #fff; border-color: transparent; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent-blue), #000 18%); box-shadow: 0 6px 16px rgba(77,163,255,.28); transform: translateY(-1px); }
.btn-secondary { background: var(--surface-strong); color: var(--text-primary); }
.btn-secondary:hover { background: color-mix(in srgb, var(--surface-strong), #fff 8%); transform: translateY(-1px); }
.btn-danger { background: var(--accent-red); color: #fff; border-color: transparent; }
.btn-danger:hover { background: color-mix(in srgb, var(--accent-red), #000 12%); transform: translateY(-1px); }

.schedule-day-group, .schedule-entry-vertical, .table-scroll { margin-top: 10px; }
.schedule-day-group { display: grid; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: color-mix(in srgb, var(--surface), transparent 8%); }
.schedule-day-group h3 { margin: 0; font-size: 15px; letter-spacing: .02em; color: var(--text-secondary); padding-bottom: 8px; border-bottom: 1px dashed var(--border); }
.schedule-day-list, .schedule-vertical { display: grid; gap: 10px; }
.schedule-day-list .assignment-card, .schedule-vertical .assignment-card, .schedule-vertical .structured-assignment { width: min(680px, 100%); margin-inline: auto; }
.assignment-card, .structured-assignment { padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-strong); }
.assignment-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.assignment-head span { color: var(--accent-blue); font-weight: 700; }
.assignment-body { display: grid; gap: 8px; }
.assignment-meta, .assignment-note { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.assignment-meta span, .assignment-note span { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.assignment-meta p, .assignment-note p { margin: 0; color: var(--text-primary); }
.info-card-actions { display: flex; gap: 8px; margin-top: 10px; }
.month-selector { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.log-panel {
  background: rgba(9, 15, 24, .86);
  border: 1px solid var(--border);
  color: #c4d2e8;
  border-radius: 12px;
  padding: 12px;
  height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: ui-monospace, Menlo, monospace;
}

.action-modal {
  position: fixed; inset: 0; z-index: 300;
  display: none; align-items: center; justify-content: center;
  background: rgba(4, 10, 20, .45);
  backdrop-filter: blur(10px);
}
.action-modal.visible { display: flex; animation: fadeUp .24s ease both; }
.action-modal-sheet { width: min(980px, 96vw); height: min(90vh, 860px); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; animation: shimmerIn .18s ease both; }
.action-modal-header { height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; border-bottom: 1px solid var(--border); }
.action-modal-close { background: var(--surface-strong); border: 1px solid var(--border); border-radius: 10px; width: 32px; height: 32px; cursor: pointer; color: var(--text-primary); }
#app-action-modal-iframe { width: 100%; height: calc(100% - 52px); border: 0; background: var(--bg); }

.modal-form-layout { min-height: 100vh; padding: 16px; }
.modal-form-content { margin: 0; padding: 0; }
.modal-form-card { box-shadow: none; }
.modal-form-layout .top-nav,
.modal-form-layout .side-nav,
.modal-form-layout .side-nav-overlay,
.modal-form-layout .nav-inner { display: none !important; }

.center-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.center-card { width: min(100%, 420px); }
.center-card h2 { font-size: 28px; margin-bottom: 8px; }
.center-card p { color: var(--text-secondary); }

h1,h2,h3 { line-height: 1.2; }
p,li,label,td,th { line-height: 1.5; }

.info-card, .worker-card, .placeholder-card {
  min-height: 176px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.info-card p, .worker-card p, .placeholder-card p {
  color: var(--text-secondary);
  margin: 6px 0;
}

.table-scroll {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface), transparent 15%);
  padding: 6px;
}

.timesheet-matrix {
  table-layout: fixed;
  min-width: max-content;
}
.timesheet-matrix thead th,
.timesheet-matrix tbody td,
.timesheet-matrix tbody th {
  vertical-align: middle;
  white-space: normal;
  text-align: center;
}
.timesheet-matrix th:first-child,
.timesheet-matrix td:first-child {
  text-align: left;
  width: clamp(126px, 20vw, 210px);
  min-width: clamp(126px, 20vw, 210px);
  position: sticky;
  left: 0;
  z-index: 2;
  background: color-mix(in srgb, var(--surface-strong), var(--bg) 18%);
}
.timesheet-matrix tbody th {
  padding: clamp(8px, 1vw, 12px) clamp(8px, 1.2vw, 12px);
  font-size: var(--timesheet-cell-font);
  font-weight: 600;
}
.timesheet-card { padding: 22px; }
.timesheet-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.timesheet-matrix th,
.timesheet-matrix td {
  min-width: clamp(46px, 4.4vw, 72px);
  font-size: var(--timesheet-cell-font);
  padding: clamp(7px, 1vw, 12px) clamp(5px, .9vw, 10px);
}
.timesheet-matrix tbody tr {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  transition: background .22s ease;
}
.timesheet-matrix tbody tr:hover {
  background: color-mix(in srgb, var(--surface-strong), #fff 6%);
}

.hours-cell {
  position: relative;
  font-family: ui-monospace, Menlo, monospace;
  font-weight: 600;
  color: var(--text-primary);
}
.hours-cell > span {
  display: inline-block;
  min-width: 2.2ch;
  text-align: center;
}
.hours-cell.empty {
  opacity: .78;
  font-weight: 500;
}
.empty-value { opacity: .95; color: var(--text-secondary); font-weight: 700; }
.timesheet-quick-add {
  display: none;
  margin-left: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #fff;
  background: var(--accent-blue);
  font-weight: 700;
  line-height: 1;
  transition: transform .2s ease, background .2s ease;
}
.hours-cell.empty:hover .timesheet-quick-add { display: inline-flex; }
.timesheet-quick-add:hover { transform: scale(1.08); background: color-mix(in srgb, var(--accent-blue), #000 14%); }
.hours-tooltip {
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%) translateY(4px);
  min-width: 220px;
  max-width: 320px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(8, 13, 22, .92);
  color: #d9e7ff;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease, visibility .22s ease;
  z-index: 30;
  white-space: normal;
}
.hours-cell:hover .hours-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 900px) {
  .container, .main-content { padding-left: 16px; padding-right: 16px; }
  .main-content { margin-top: 92px; padding-top: 12px; }
  .nav-inner { min-height: 68px; }
}

@media (max-width: 720px) {
  .info-card, .worker-card, .placeholder-card { min-height: 0; }
  .profile-header-container { flex-direction: column; }
  .profile-actions { justify-content: flex-start; }
  .assignment-head { flex-direction: column; align-items: flex-start; }
  .workers-filters { padding: 10px; }
  .hours-tooltip { display: none; }
  .top-nav-title { font-size: 20px; }
  .center-card { width: 100%; }
  .center-card h2 { font-size: 24px; }
  .form-grid, .form-grid-edit, .timesheet-form { grid-template-columns: 1fr; }
  .workers-grid, .compact-grid { grid-template-columns: 1fr; }
  .btn { width: 100%; }
  .table-actions .btn, .filter-actions .btn { width: auto; }
  .action-modal-sheet { width: 100vw; height: 100vh; border-radius: 0; }
  .floating-create-wrap { right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); padding: 8px; }
  .floating-create-btn { width: 58px; height: 58px; font-size: 38px; }
  .dynamic-select-row { grid-template-columns: 1fr; }
  .btn-mini { width: 100%; }
}

@media (max-width: 560px) {
  .nav-inner {
    grid-template-columns: 48px 1fr;
    min-height: 66px;
    gap: 12px;
  }
  .mobile-nav-toggle {
    width: 44px;
    height: 44px;
    padding: 0 10px;
  }
  .top-nav-title { font-size: clamp(18px, 1vw + 14px, 24px); }

  .timesheet-card { padding: 14px; }
  .timesheet-matrix th,
  .timesheet-matrix td {
    min-width: 54px;
    font-size: 13px;
    padding: 8px 6px;
  }
  .timesheet-matrix th:first-child,
  .timesheet-matrix td:first-child {
    min-width: 136px;
    width: 136px;
    font-size: 13px;
    padding: 8px;
  }
  .timesheet-matrix .hours-cell {
    white-space: nowrap;
  }
}

@media (max-width: 420px) {
  .table-scroll { padding: 4px; }
  .timesheet-matrix th,
  .timesheet-matrix td {
    min-width: 48px;
    font-size: 12px;
    padding: 7px 5px;
  }
  .timesheet-matrix th:first-child,
  .timesheet-matrix td:first-child {
    min-width: 116px;
    width: 116px;
    font-size: 12px;
  }
  .floating-create-wrap { right: 8px; padding: 6px; }
  .floating-create-btn { width: 54px; height: 54px; font-size: 34px; }
}


.profile-header-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}
.profile-header { display: flex; gap: 12px; align-items: center; }
.profile-header-info h1 { margin: 0; font-size: clamp(24px, 3vw, 32px); }
.profile-header-info p { margin: 4px 0 0; color: var(--text-secondary); }
.profile-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.profile-details {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.profile-details li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.profile-details svg { width: 16px; height: 16px; opacity: .75; flex-shrink: 0; }
.profile-grid { display: grid; gap: 14px; }
.history-header h2 { margin: 0 0 10px; }

.object-card .info-card-header { margin-bottom: 12px; }
.details-list { display: grid; gap: 8px; }
.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-strong), transparent 10%);
}
.detail-row span { color: var(--text-secondary); }
.detail-row strong { text-align: right; }


@media (min-width: 1025px) {
  :root {
    --base-font-size: clamp(13px, .2vw + 10px, 15px);
    --content-pad: clamp(14px, .9vw, 18px);
    --top-nav-height: clamp(58px, .8vw + 48px, 68px);
    --top-nav-title-size: clamp(17px, .4vw + 13px, 22px);
    --menu-touch-size: clamp(36px, .6vw + 30px, 42px);
    --menu-font-size: clamp(13px, .2vw + 12px, 15px);
    --fab-size: clamp(48px, 1vw + 38px, 56px);
    --timesheet-cell-font: clamp(11px, .15vw + 10px, 13px);
  }
}


@media (min-width: 1025px) {
  .btn { padding: 7px 12px; font-size: 13px; }
  .page-header h1 { font-size: clamp(20px, 1.1vw + 14px, 26px); }
  .card, .placeholder-card { padding: 16px; }
  .table td, .table th { padding: 8px 10px; }
}


@media (min-width: 1024px) {
  .timesheet-card { padding: 14px; }
  .timesheet-table-wrap { overflow-x: auto; }
  .timesheet-matrix {
    min-width: 0;
    width: 100%;
    table-layout: fixed;
  }
  .timesheet-matrix th,
  .timesheet-matrix td {
    min-width: 0;
    padding: 6px 4px;
    font-size: clamp(10px, .18vw + 9px, 12px);
    white-space: nowrap;
  }
  .timesheet-matrix th:first-child,
  .timesheet-matrix td:first-child {
    width: clamp(118px, 12vw, 160px);
    min-width: clamp(118px, 12vw, 160px);
    padding: 6px 8px;
  }
  .timesheet-matrix .hours-cell > span {
    min-width: 2ch;
  }
}

@media (min-width: 1024px) {
  .side-nav { transform: translateX(0); width: 280px; }
  .side-nav-overlay { display: none; }
  .mobile-nav-toggle { display: none; }
  .top-nav { left: 280px; }
  .nav-inner { grid-template-columns: 1fr; }
  .main-content { margin-left: 300px; margin-right: 24px; max-width: calc(100% - 324px); }
  .container { max-width: none; }
}

@media (max-width: 1023px) {
  .timesheet-table-wrap { overflow-x: auto; }
  .timesheet-matrix th, .timesheet-matrix td { white-space: nowrap; }
}

@media (max-width: 1200px) {
  .workers-grid, .compact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
