* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: linear-gradient(135deg, #0079bf 0%, #5067c5 100%);
  min-height: 100vh;
  color: #172b4d;
}

/* ---------- app shell: drawer + main area ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

.project-drawer {
  width: 220px;
  flex: 0 0 220px;
  background: rgba(0, 0, 0, 0.2);
  padding: 16px 12px;
  overflow-y: auto;
  transition: width 0.15s ease, padding 0.15s ease, flex-basis 0.15s ease;
}

.project-drawer.closed {
  width: 0;
  flex: 0 0 0;
  padding: 16px 0;
  overflow: hidden;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  white-space: nowrap;
}

.add-project-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}

.add-project-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

.project-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  white-space: nowrap;
}

.project-item {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
}

.project-item:hover {
  background: rgba(255, 255, 255, 0.16);
}

.project-item.active {
  background: rgba(255, 255, 255, 0.32);
}

.project-name-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 13px;
  min-width: 0;
  outline: none;
  cursor: text;
}

.project-delete-btn {
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-size: 11px;
  flex-shrink: 0;
}

.project-delete-btn:hover {
  color: #fff;
}

.project-members-btn {
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  font-size: 12px;
  flex-shrink: 0;
  padding: 0 2px;
}

.project-members-btn:hover {
  color: #fff;
}

.plan-note {
  margin-top: 10px;
  padding: 10px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.85);
  font-size: 11px;
  line-height: 1.5;
  cursor: pointer;
}

.plan-note:hover {
  color: #fff;
}

.plan-note .link-btn {
  display: block;
  color: #fff;
  text-decoration: underline;
  margin-top: 2px;
  padding: 0;
}

.public-share-banner {
  background: #4bce97;
  color: #0b3b2a;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 8px 12px;
}

.public-share-banner a {
  color: #0b3b2a;
}

/* Public read-only share mode: hide everything that assumes a logged-in
   member (drawer, add/trash/logout/user controls). The board/table/etc.
   views themselves already render read-only when there's no current user. */
.public-share-mode #project-drawer,
.public-share-mode #drawer-toggle-btn,
.public-share-mode #add-column-btn,
.public-share-mode #trash-btn,
.public-share-mode #user-info,
.public-share-mode #logout-btn,
.public-share-mode #member-avatars {
  display: none !important;
}

/* ---------- members / invite modal ---------- */

.members-content h2 {
  margin-bottom: 12px;
}

.members-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  max-height: 220px;
  overflow-y: auto;
}

.member-group-label {
  font-size: 11px;
  font-weight: 600;
  color: #6b778c;
  text-transform: uppercase;
  margin: 10px 0 6px;
}

.member-group-label:first-child {
  margin-top: 0;
}

.member-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f4f5f7;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
}

.member-row span:first-child {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-role-badge {
  font-size: 11px;
  background: #dfe1e6;
  color: #172b4d;
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}

.member-remove-btn {
  border: none;
  background: none;
  color: #b04632;
  cursor: pointer;
  font-size: 12px;
  flex-shrink: 0;
}

.invite-form {
  display: flex;
  gap: 6px;
  border-top: 1px solid #eee;
  padding-top: 12px;
}

.invite-form input[type="email"] {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #dcdfe4;
  border-radius: 6px;
  font-size: 13px;
  min-width: 0;
}

.invite-form select {
  padding: 8px 6px;
  border: 1px solid #dcdfe4;
  border-radius: 6px;
  font-size: 13px;
}

.public-share-section {
  border-top: 1px solid #eee;
  padding-top: 12px;
  margin-bottom: 12px;
}

.public-share-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #172b4d;
  cursor: pointer;
}

.public-share-link-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.public-share-link-row input {
  flex: 1;
  padding: 7px 9px;
  border: 1px solid #dcdfe4;
  border-radius: 6px;
  font-size: 12px;
  min-width: 0;
  color: #5e6c84;
  background: #f4f5f7;
}

/* ---------- plans comparison modal ---------- */

.plans-content {
  width: 780px;
  max-width: 94vw;
}

.plans-columns {
  display: flex;
  gap: 14px;
  margin: 18px 0 10px;
}

.plan-column {
  flex: 1;
  border: 1px solid #dcdfe4;
  border-radius: 10px;
  padding: 16px;
  min-width: 0;
}

.plan-column.highlight {
  border-color: #5067c5;
  background: #f5f6ff;
}

.plan-column.current {
  border-color: #4bce97;
  background: #f2fbf6;
}

.plan-column h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.plan-feature-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plan-feature-list li {
  font-size: 12px;
  color: #42526e;
  padding-bottom: 8px;
  border-bottom: 1px dashed #e0e2e6;
  line-height: 1.5;
}

.plan-select-btn {
  width: 100%;
  border: none;
  border-radius: 6px;
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: #5067c5;
  color: #fff;
}

.plan-select-btn:hover {
  background: #3f52a3;
}

.plan-select-btn:disabled {
  background: #dfe1e6;
  color: #6b778c;
  cursor: default;
}

@media (max-width: 700px) {
  .plans-columns {
    flex-direction: column;
  }
}

.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.drawer-toggle-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  margin-right: 12px;
  flex-shrink: 0;
}

.drawer-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: rgba(0, 0, 0, 0.15);
}

.app-header h1 {
  color: #fff;
  font-size: 20px;
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- view tabs ---------- */

.view-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 24px;
  background: rgba(0, 0, 0, 0.08);
}

.view-tab {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.view-tab:hover {
  background: rgba(255, 255, 255, 0.28);
}

.view-tab.active {
  background: #fff;
  color: #172b4d;
  font-weight: 600;
}

.view-tab.locked {
  opacity: 0.55;
  cursor: pointer;
}

.view-tab.locked::after {
  content: " 🔒";
}

.view-panel.hidden {
  display: none;
}

.add-column-btn {
  background: rgba(255, 255, 255, 0.25);
  border: none;
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.add-column-btn:hover {
  background: rgba(255, 255, 255, 0.4);
}

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

.member-avatar-stack {
  display: flex;
  align-items: center;
  cursor: pointer;
  margin-right: 2px;
}

.avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid rgba(255, 255, 255, 0.7);
  margin-left: -8px;
  flex-shrink: 0;
}

.member-avatar-stack .avatar-circle:first-child {
  margin-left: 0;
}

.avatar-circle.avatar-more {
  background: #dfe1e6 !important;
  color: #42526e;
  font-size: 11px;
}

.avatar-circle.small {
  width: 22px;
  height: 22px;
  font-size: 11px;
  border-width: 0;
}

.user-info {
  color: #fff;
  font-size: 13px;
  opacity: 0.9;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}

.user-info:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* header button */

.header-right button {
    transition: 0.2s ease-in-out;
}

.logout-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.trash-btn {
  position: relative;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  padding: 9px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.trash-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.trash-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #eb5a46;
  color: #fff;
  font-size: 10px;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 10px;
  min-width: 14px;
  text-align: center;
}

.danger-btn {
  background: #b04632;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
}

.danger-btn:hover {
  background: #942f1d;
}

.danger-btn.small {
  padding: 6px 10px;
  font-size: 12px;
}

.confirm-content .modal-actions {
  gap: 8px;
}

.trash-content {
  width: 480px;
  max-width: 92vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.trash-content h2 {
  margin-bottom: 4px;
}

.trash-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: 10px 0;
}

.trash-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.trash-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #f4f5f7;
  border-radius: 8px;
  padding: 10px 12px;
}

.trash-item-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.trash-item-meta {
  font-size: 12px;
  color: #6b778c;
}

.trash-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.restore-btn {
  border: 1px solid #dcdfe4;
  background: #fff;
  color: #172b4d;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.restore-btn:hover {
  background: #eef0f3;
}

.trash-empty {
  color: #6b778c;
  font-size: 14px;
  text-align: center;
  padding: 24px 0;
}

/* ---------- login page (2-column, plain HTML/CSS) ---------- */

.auth-page {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  background: #fff;
}

.auth-visual {
  flex: 1 1 50%;
  position: relative;
  background: linear-gradient(135deg, #0079bf 0%, #5067c5 100%);
  overflow: hidden;
}

.auth-visual-overlay {
  height: 100%;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
  box-sizing: border-box;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
}

.auth-brand-icon {
  font-size: 26px;
}

.auth-visual-bottom h1 {
  font-size: 32px;
  line-height: 1.35;
  margin: 0 0 14px;
}

.auth-visual-bottom p {
  font-size: 15px;
  line-height: 1.7;
  opacity: 0.9;
  max-width: 440px;
  margin: 0 0 22px;
}

.auth-visual-footer {
  font-size: 12px;
  opacity: 0.7;
}

.auth-form-side {
  flex: 1 1 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  overflow-y: auto;
  box-sizing: border-box;
}

.auth-form-inner {
  width: 100%;
  max-width: 380px;
}

.auth-form-inner h2 {
  margin: 0 0 6px;
  font-size: 24px;
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f4f5f7;
  color: #172b4d;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  margin-bottom: 16px;
}

@media (max-width: 860px) {
  .auth-page {
    flex-direction: column;
    overflow-y: auto;
  }

  .auth-visual {
    flex: 0 0 200px;
  }

  .auth-visual-bottom h1 {
    font-size: 22px;
  }

  .auth-visual-bottom p {
    display: none;
  }

  .auth-form-side {
    flex: 1;
    padding: 28px 24px;
  }
}

.google-btn {
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  margin-top: 14px;
  background: #fff;
  border: 1px solid #dcdfe4;
  border-radius: 6px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: #172b4d;
}

.google-btn:hover {
  background: #f4f5f7;
}

/* ---------- email/password auth form ---------- */

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: #8993a4;
  font-size: 12px;
  margin: 16px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid #dcdfe4;
}

.auth-divider span {
  padding: 0 10px;
}

.email-auth-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.email-auth-form input {
  padding: 9px 10px;
  border: 1px solid #dcdfe4;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

.full-width {
  width: 100%;
  border: none;
  border-radius: 6px;
  padding: 9px 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.auth-error {
  color: #b04632;
  font-size: 12px;
  margin: 0;
}

.auth-toggle-row {
  text-align: center;
  font-size: 12px;
  color: #6b778c;
  margin: 4px 0 0;
}

.link-btn {
  border: none;
  background: none;
  color: #5067c5;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  text-decoration: underline;
}

.link-btn.small {
  display: block;
  margin: 4px auto 0;
  color: #6b778c;
}

/* ---------- profile modal ---------- */

.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.avatar-circle.large {
  width: 56px;
  height: 56px;
  font-size: 22px;
  border-width: 0;
  background-size: cover;
  background-position: center;
}

.profile-email {
  font-size: 13px;
  color: #6b778c;
  word-break: break-all;
}

.profile-plan-info {
  font-size: 13px;
  color: #172b4d;
  background: #f4f5f7;
  border-radius: 6px;
  padding: 8px 10px;
}

.profile-plan-actions {
  display: flex;
  gap: 12px;
  margin-top: 6px;
}

.profile-plan-actions .link-btn.small {
  display: inline;
  margin: 0;
}

.pending-downgrade {
  color: #b04a00;
  font-weight: 600;
}

.billing-toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  background: #172b4d;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  max-width: 90vw;
  text-align: center;
}

.billing-toast.error {
  background: #b04a00;
}

.board {
  display: flex;
  gap: 16px;
  padding: 20px 24px;
  overflow-x: auto;
  align-items: flex-start;
}

.column {
  background: #ebecf0;
  border-radius: 10px;
  width: 272px;
  flex: 0 0 272px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 100px);
}

.column.drag-over {
  outline: 2px dashed #5067c5;
}

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 4px 6px;
}

.column-title {
  font-weight: 600;
  font-size: 14px;
  border: none;
  background: transparent;
  width: 100%;
  outline: none;
  cursor: text;
}

.delete-column-btn {
  background: none;
  border: none;
  color: #6b778c;
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
}

.delete-column-btn:hover {
  color: #b04632;
}

.card-list {
  overflow-y: auto;
  flex: 1;
  min-height: 10px;
  padding-bottom: 4px;
}

.card {
  background: #fff;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
  box-shadow: 0 1px 0 rgba(9, 30, 66, 0.25);
  cursor: grab;
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
  position: relative;
}

.card.dragging {
  opacity: 0.4;
}

.card-drop-placeholder {
  border: 2px dashed #5067c5;
  border-radius: 6px;
  background: rgba(80, 103, 197, 0.08);
  margin-bottom: 8px;
  flex-shrink: 0;
}

.card-cover {
  margin: -10px -12px 8px -12px;
  border-radius: 6px 6px 0 0;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  background-color: #dfe1e6;
}

.card-cover.color-cover {
  height: 32px;
}

.card-cover.image-cover {
  height: 100px;
}

.card .card-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  border: none;
  background: none;
  color: #6b778c;
  cursor: pointer;
  font-size: 13px;
  display: none;
}

.card:hover .card-delete {
  display: block;
}

.card:hover {
  background: #f4f5f7;
}

.add-card-btn {
  background: none;
  border: none;
  text-align: left;
  color: #5e6c84;
  padding: 8px 6px;
  cursor: pointer;
  font-size: 14px;
  border-radius: 4px;
  width: 100%;
}

.add-card-btn:hover {
  background: rgba(9, 30, 66, 0.08);
}

.card-input {
  width: 100%;
  border: none;
  border-radius: 6px;
  padding: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  box-shadow: 0 1px 0 rgba(9, 30, 66, 0.25);
  margin-bottom: 6px;
}

.card-input-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.card-input-actions button {
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
}

.confirm-add {
  background: #5067c5;
  color: #fff;
}

.cancel-add {
  background: none;
  color: #6b778c;
  padding-left: 12px;
  padding-right: 12px;
  border-radius: 6px;
}

.card-text {
  margin-bottom: 6px;
}

.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #dfe1e6;
  color: #172b4d;
}

.priority-high {
  background: #ffdad6;
  color: #b04632;
}

.priority-medium {
  background: #fff0b3;
  color: #8f6a00;
}

.priority-low {
  background: #d3f1e0;
  color: #1a7f4e;
}

.due-badge {
  background: #e0e8ff;
  color: #354ba0;
}

.member-badge {
  background: #e6f0ff;
  color: #2b5cad;
}

.comment-badge {
  background: #eee;
  color: #444;
}

/* ---------- modals ---------- */

.hidden {
  display: none !important;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 30, 66, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-content {
  background: #fff;
  border-radius: 10px;
  width: 520px;
  max-width: 92vw;
  max-height: 86vh;
  overflow-y: auto;
  padding: 20px 24px;
}

.modal-content.small {
  width: 360px;
}

/* ---------- card modal: 2-column layout (PC) ---------- */

.modal-content.wide {
  width: 760px;
  max-width: 94vw;
  max-height: 86vh;
  padding: 0;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-close-x {
  position: absolute;
  top: 14px;
  right: 14px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 16px;
  color: #6b778c;
  z-index: 2;
  padding: 4px;
}

.modal-close-x:hover {
  color: #172b4d;
}

.modal-cover-banner {
  height: 160px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #dfe1e6;
  border-radius: 10px 10px 0 0;
  flex-shrink: 0;
}

.cover-swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.cover-swatch {
  width: 36px;
  height: 24px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  padding: 0;
}

.cover-swatch:hover {
  filter: brightness(1.08);
}

.cover-swatch.active {
  outline: 2px solid #172b4d;
  outline-offset: 1px;
}

.cover-actions-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.modal-columns {
  display: flex;
  min-height: 0;
  max-height: 86vh;
}

.modal-left {
  flex: 1.3;
  padding: 24px 20px 24px 24px;
  overflow-y: auto;
  border-right: 1px solid #eee;
}

.modal-left .modal-field {
  margin-bottom: 16px;
}

.modal-right {
  flex: 1;
  padding: 20px 20px 20px 20px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.modal-right-header {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 12px;
  padding-right: 24px;
}

.comment-input-top {
  margin-bottom: 12px;
  flex-shrink: 0;
}

.modal-right .comment-list {
  flex: 1;
  overflow-y: auto;
  max-height: none;
  margin-bottom: 0;
}

@media (max-width: 700px) {
  .modal-content.wide {
    width: 94vw;
  }

  .modal-columns {
    flex-direction: column;
    overflow-y: auto;
  }

  .modal-left {
    border-right: none;
    border-bottom: 1px solid #eee;
    overflow-y: visible;
  }

  .modal-right {
    padding-top: 16px;
  }

  .modal-right .comment-list {
    max-height: 260px;
  }
}

.modal-content h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.modal-sub {
  margin: 0 0 12px;
  font-size: 13px;
  color: #6b778c;
}

.modal-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
}

.modal-title-input {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
  border: none;
  outline: none;
  padding: 6px 0;
  border-radius: 6px;
  font-family: inherit;
  width: 100%;
  margin-bottom: 12px;
}

.modal-title-input:focus,
#name-input:focus {
  background: #f4f5f7;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #5e6c84;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.modal-field input[type="date"],
.modal-field select,
.modal-field textarea,
.modal-field input[type="text"],
#name-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #dcdfe4;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  margin-bottom: 8px;
}

.modal-field textarea {
  resize: vertical;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.chip {
  background: #e4e6ea;
  border-radius: 14px;
  padding: 4px 10px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chip button {
  border: none;
  background: none;
  cursor: pointer;
  color: #6b778c;
  font-size: 12px;
  padding: 0;
}

.comment-list {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
}

.comment-item {
  background: #f4f5f7;
  border-radius: 8px;
  padding: 8px 10px;
  border-left: 3px solid #c1c7d0;
}

.comment-meta {
  font-size: 11px;
  color: #6b778c;
  margin-bottom: 4px;
}

.comment-text {
  font-size: 14px;
  white-space: pre-wrap;
}

.comment-attachment {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #d3d8de;
}

.comment-attachment::before {
  content: "📎 添付ファイル";
  display: block;
  font-size: 10px;
  color: #8993a4;
  margin-bottom: 4px;
}

.comment-attachment .attachment-item {
  background: #ffffff;
  border: 1px solid #dfe1e6;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(9, 30, 66, 0.15);
  border-top-color: #5067c5;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.upload-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #5e6c84;
  margin-top: 6px;
}

.file-input-label.disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* ---------- attachments ---------- */

.attachment-badge {
  background: #eee3ff;
  color: #5b3aa0;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.attachment-item {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #f4f5f7;
  border-radius: 6px;
  padding: 4px 6px;
  max-width: 220px;
}

.attachment-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  display: block;
}

.attachment-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #dfe1e6;
  border-radius: 4px;
  font-size: 16px;
  flex-shrink: 0;
}

.attachment-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.attachment-name {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #172b4d;
  font-size: 12px;
}

.attachment-size {
  color: #6b778c;
  font-size: 10px;
}

.attachment-remove {
  border: none;
  background: none;
  cursor: pointer;
  color: #6b778c;
  font-size: 12px;
  flex-shrink: 0;
  padding: 2px 4px;
}

.attachment-remove:hover {
  color: #b04632;
}

.file-input-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px dashed #b9c0ca;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  color: #5e6c84;
}

.file-input-label:hover {
  background: #f4f5f7;
}

.file-input-hidden {
  display: none;
}

.field-hint {
  font-size: 11px;
  color: #8993a4;
  margin: 4px 0 0;
}

.comment-input-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.comment-input-row .comment-input-top {
  flex: 1;
  margin-bottom: 0;
}

.attach-icon-btn {
  cursor: pointer;
  font-size: 16px;
  padding: 6px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

.attach-icon-btn:hover {
  background: #eef0f3;
}

.pending-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: #eef2ff;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  margin-bottom: 8px;
}

.pending-file button {
  border: none;
  background: none;
  cursor: pointer;
  color: #6b778c;
}

/* ---------- table view ---------- */

#table-view {
  padding: 20px 24px;
  overflow-x: auto;
}

.kanban-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}

.kanban-table th,
.kanban-table td {
  text-align: left;
  padding: 10px 14px;
  font-size: 13px;
  border-bottom: 1px solid #eee;
}

.kanban-table th {
  background: #f4f5f7;
  color: #5e6c84;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
}

.kanban-table th.sortable-th {
  cursor: pointer;
  user-select: none;
}

.kanban-table th.sortable-th:hover {
  color: #172b4d;
}

.kanban-table .sort-arrow {
  font-size: 10px;
  margin-left: 2px;
}

.kanban-table tbody tr {
  cursor: pointer;
}

.kanban-table tbody tr:hover {
  background: #f4f5f7;
}

.table-empty {
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
  padding: 40px 0;
  font-size: 14px;
}

/* ---------- calendar view ---------- */

#calendar-view {
  padding: 20px 24px;
}

.calendar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.calendar-label {
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  min-width: 120px;
}

.calendar-nav-btn,
.calendar-today-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.calendar-nav-btn:hover,
.calendar-today-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

.calendar-grid-wrap {
  background: rgba(255, 255, 255, 0.15);
  padding: 6px;
  border-radius: 8px;
}

.calendar-weekday-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-weekday {
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 4px 0 8px;
}

.calendar-week {
  position: relative;
}

.calendar-week-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-cell {
  background: #fff;
  min-height: 90px;
  padding: 6px;
  box-sizing: border-box;
  border-top: 1px solid #e4e7ec;
  border-right: 1px solid #e4e7ec;
  position: relative;
}

.calendar-week:first-child .calendar-cell {
  border-top: none;
}

.calendar-week-days .calendar-cell:nth-child(7n) {
  border-right: none;
}

.calendar-week:first-child .calendar-cell:first-child {
  border-top-left-radius: 6px;
}

.calendar-week:first-child .calendar-cell:nth-child(7) {
  border-top-right-radius: 6px;
}

.calendar-cell.empty {
  background: rgba(255, 255, 255, 0.5);
}

.calendar-cell.today {
  outline: 2px solid #5067c5;
  outline-offset: -2px;
  z-index: 1;
}

.calendar-date-num {
  font-size: 12px;
  font-weight: 600;
  color: #5e6c84;
  height: 16px;
}

/* Reserves vertical space in the cell for the range bars overlaid on top of
   this week row, so single-day chips (added below) don't get covered. */
.calendar-range-spacer {
  height: calc(var(--lane-count, 0) * 20px);
}

.calendar-card-chip {
  background: #dfe1e6;
  border-radius: 4px;
  padding: 2px 6px;
  margin-top: 4px;
  font-size: 11px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-card-chip:hover {
  filter: brightness(0.95);
}

/* Multi-day cards: one continuous bar per card, positioned as an overlay
   spanning the days it covers within each week row (instead of a chip
   repeated in every day cell). */
.calendar-week-bars {
  position: absolute;
  left: 0;
  right: 0;
  top: 22px;
  pointer-events: none;
}

.calendar-range-bar {
  position: absolute;
  height: 16px;
  line-height: 16px;
  font-size: 10px;
  color: #fff;
  background: #5067c5;
  padding: 0 6px;
  box-sizing: border-box;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
  pointer-events: auto;
  border-radius: 4px;
}

.calendar-range-bar:hover {
  filter: brightness(1.1);
}

.calendar-range-bar.continues-before {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.calendar-range-bar.continues-after {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.calendar-range-bar.priority-high {
  background: #eb5a46;
}

.calendar-range-bar.priority-medium {
  background: #f2a94e;
}

.calendar-range-bar.priority-low {
  background: #4bce97;
}

/* ---------- timeline view ---------- */

#timeline-view {
  padding: 20px 24px;
}

.timeline-axis-labels {
  display: flex;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.85);
  font-size: 11px;
  margin-bottom: 6px;
  padding: 0 4px;
}

.timeline-container {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.timeline-label {
  width: 160px;
  flex-shrink: 0;
  color: #fff;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-track {
  position: relative;
  flex: 1;
  height: 22px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.timeline-bar {
  position: absolute;
  top: 0;
  height: 100%;
  min-width: 10px;
  background: #5067c5;
  border-radius: 4px;
  cursor: pointer;
}

.timeline-bar:hover {
  filter: brightness(1.1);
}

/* ---------- dashboard view ---------- */

#dashboard-view {
  padding: 20px 24px;
}

.dashboard-stats {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.stat-tile {
  background: #fff;
  border-radius: 8px;
  padding: 14px 18px;
  min-width: 130px;
  text-align: center;
}

.stat-tile.stat-danger .stat-number {
  color: #b04632;
}

.stat-number {
  font-size: 26px;
  font-weight: 700;
  color: #172b4d;
}

.stat-label {
  font-size: 12px;
  color: #6b778c;
  margin-top: 2px;
}

.dashboard-section {
  background: #fff;
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 16px;
}

.dashboard-section h3 {
  margin: 0 0 12px;
  font-size: 14px;
  color: #172b4d;
}

.dashboard-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
}

.dashboard-bar-label {
  width: 160px;
  flex-shrink: 0;
  color: #5e6c84;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-bar-wrap {
  flex: 1;
  background: #ebecf0;
  border-radius: 4px;
  height: 12px;
  overflow: hidden;
}

.dashboard-bar {
  height: 100%;
  background: #5067c5;
  border-radius: 4px;
}

.dashboard-upcoming-row {
  padding: 6px 0;
  font-size: 13px;
  color: #172b4d;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
}

.dashboard-attachment-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 13px;
  color: #172b4d;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
}

.dashboard-attachment-row:hover,
.dashboard-upcoming-row:hover {
  background: #f4f5f7;
}

.dashboard-attachment-icon {
  flex-shrink: 0;
}

.dashboard-attachment-name {
  flex-shrink: 0;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-attachment-size {
  flex-shrink: 0;
  color: #6b778c;
  font-size: 12px;
}

.dashboard-attachment-card {
  flex: 1;
  color: #6b778c;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-upcoming-row:hover {
  color: #5067c5;
}
