.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
  margin-top: 18px;
}

.sidebar {
  position: sticky;
  top: 88px;
  align-self: start;
}

.menu {
  display: grid;
  gap: 8px;
}

.menu .btn {
  text-align: right;
}

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

.stat-grid .kpi {
  background: var(--surface);
  border: var(--border);
}

.state-samples {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.media-preview {
  height: 260px;
  max-height: 260px;
  border: var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.media-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.timeline-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.timeline-main {
  all: unset;
  cursor: pointer;
  display: grid;
  gap: 6px;
  flex: 1;
}

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

.timeline-percent {
  background: #e3f1f1;
  color: #0d6e6e;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.78rem;
  font-weight: 800;
}

.timeline-gallery-button {
  border: var(--border);
  background: #fff;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1rem;
}

.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
}

.gallery-modal.open {
  display: grid;
  place-items: center;
}

.gallery-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 18, 28, 0.55);
}

.gallery-modal-content {
  position: relative;
  width: min(780px, 92vw);
  background: #fff;
  border-radius: 16px;
  border: var(--border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.24);
  padding: 14px;
  display: grid;
  gap: 10px;
}

.gallery-modal-close {
  position: absolute;
  left: 10px;
  top: 8px;
  border: 0;
  background: transparent;
  font-size: 1.7rem;
  cursor: pointer;
  color: #475668;
}

.gallery-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-left: 26px;
}

.gallery-modal-media {
  border-radius: 12px;
  border: var(--border);
  height: 420px;
  max-height: 420px;
  overflow: hidden;
  background: #f3f6fa;
  display: grid;
  place-items: center;
}

.gallery-modal-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-modal-actions {
  display: flex;
  justify-content: space-between;
}

.message-item {
  border: var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.message-item.unread {
  border-color: #0d6e6e;
  background: #f2fbfb;
}

.panel-app {
  padding: 18px 0 28px;
}

.panel-shell {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 16px;
}

.panel-sidebar {
  position: sticky;
  top: 16px;
  align-self: start;
  display: grid;
  gap: 2px;
}

.panel-sidebar h3 {
  margin: 0;
  line-height: 1.25;
}

.panel-menu {
  margin-top: 0;
}

.panel-home-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: var(--border);
  background: #eef4fb;
  color: #28425d;
  font-weight: 700;
  min-height: 40px;
}

.panel-menu {
  display: grid;
  gap: 8px;
}

.panel-menu-link {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 12px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #dce5ef;
  background: #f8fbff;
  color: #2c3e51;
  font-weight: 700;
}

.panel-menu-link.active {
  background: #0d6e6e;
  color: #fff;
  border-color: #0d6e6e;
  box-shadow: 0 8px 18px rgba(13, 110, 110, 0.24);
  transform: translateX(-2px);
}

.menu-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.65);
}

.panel-content {
  display: grid;
  gap: 12px;
}

.member-project-box {
  display: grid;
  gap: 8px;
}

.member-project-box .project-card {
  margin: 0;
}

.member-project-update {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: var(--border);
  border-radius: 10px;
  background: #f4f8fd;
  color: #304357;
  font-size: 0.82rem;
  padding: 8px 10px;
}

.panel-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
}

.panel-menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: var(--border);
  background: #f6f9fd;
  cursor: pointer;
  font-size: 1.2rem;
}

.panel-overlay {
  display: none;
}

.panel-notify-link {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: var(--border);
  background: #f6f9fd;
  display: inline-grid;
  place-items: center;
}

.notify-icon {
  font-size: 1.15rem;
}

.notify-badge {
  position: absolute;
  top: -6px;
  left: -6px;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #e04f4f;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  display: inline-grid;
  place-items: center;
  padding: 0 4px;
}

.inbox-shell {
  display: grid;
  gap: 12px;
}

.inbox-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.inbox-filter {
  border: var(--border);
  background: #f5f8fc;
  color: #33485d;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}

.inbox-filter.active {
  background: #0d6e6e;
  color: #fff;
  border-color: #0d6e6e;
}

.inbox-list {
  display: grid;
  gap: 10px;
}

.inbox-item {
  border: var(--border);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.inbox-item.unread {
  background: #eef8f8;
  border-color: #b8e2e2;
}

.inbox-item.read {
  background: #f8fafc;
}

.inbox-item-main {
  display: grid;
  gap: 4px;
}

.inbox-item-main p {
  margin: 0;
}

.inbox-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.inbox-time {
  color: #6d7f91;
  font-size: 0.8rem;
  white-space: nowrap;
}

.inbox-mark-btn {
  border: var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  color: #274259;
  font-weight: 700;
  cursor: pointer;
}

.pay-on-time {
  color: #12743f;
  font-weight: 800;
}

.pay-delayed {
  color: #b45309;
  font-weight: 800;
}

.pay-early {
  color: #2563eb;
  font-weight: 800;
}

.task-reminder {
  border: var(--border);
  border-radius: 12px;
  background: #f8fbff;
  padding: 10px;
  display: grid;
  gap: 6px;
}

.task-reminder + .task-reminder {
  margin-top: 10px;
}

.task-reminder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.task-badge {
  border-radius: 999px;
  background: #e5eef8;
  color: #2b4d70;
  font-size: 0.74rem;
  font-weight: 800;
  padding: 3px 8px;
}

.members-toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.members-pagination {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.member-row-link {
  color: #0d6e6e;
  font-weight: 800;
}

.members-table-wrap tbody tr:nth-child(even) {
  background: #f5f7fa;
}

.members-mobile-cards {
  display: none;
}

.member-mobile-card {
  border: var(--border);
  border-radius: 12px;
  background: #f9fbff;
  padding: 10px;
  display: grid;
  gap: 6px;
}

.member-mobile-card + .member-mobile-card {
  margin-top: 8px;
}

.member-mobile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.member-mobile-line {
  font-size: 0.9rem;
}

.status-editor {
  display: grid;
  gap: 10px;
}

.status-upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-upload-btn {
  position: relative;
  overflow: hidden;
}

.status-upload-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.message-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

#project-root .project-media {
  height: 340px;
  max-height: 340px;
}

#project-root .project-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .panel-shell {
    grid-template-columns: 1fr;
  }

  .panel-sidebar {
    position: static;
  }

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

@media (max-width: 650px) {
  .stat-grid,
  .state-samples {
    grid-template-columns: 1fr;
  }

  .members-toolbar {
    grid-template-columns: 1fr;
  }

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

  .members-mobile-cards {
    display: block;
  }

  .members-pagination {
    flex-wrap: wrap;
  }
}

@media (max-width: 900px) {
  .media-preview {
    height: 220px;
    max-height: 220px;
  }

  .gallery-modal-media {
    height: 300px;
    max-height: 300px;
  }

  #project-root .project-media {
    height: 240px;
    max-height: 240px;
  }

  .panel-menu-toggle {
    display: inline-grid;
    place-items: center;
  }

  .panel-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: min(82vw, 300px);
    height: 100vh;
    z-index: 80;
    transform: translateX(110%);
    transition: transform 0.28s ease;
    border-radius: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .panel-sidebar h3 {
    margin: 0 0 6px;
  }

  .panel-sidebar .panel-menu {
    margin-top: 0;
    padding-top: 0;
  }

  .panel-menu-open .panel-sidebar {
    transform: translateX(0);
  }

  .panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, 0.45);
    z-index: 70;
  }

  .panel-menu-open .panel-overlay {
    display: block;
  }
}
