/* Views: kanban, gallery, calendar, form */

/* ================= kanban ================= */
.kanban-view {
  flex: 1;
  overflow: hidden;
  display: flex;
  background: #f7f7f8;
}
.kanban-board {
  display: flex;
  gap: 10px;
  padding: 12px;
  overflow-x: auto;
  align-items: flex-start;
  flex: 1;
}
.kanban-col {
  width: 264px;
  flex: 0 0 264px;
  background: #f0f0f2;
  border-radius: var(--radius-m);
  border: 1px solid #e7e7ea;
  border-top: 3px solid #d9d9dc;
  display: flex;
  flex-direction: column;
  max-height: 100%;
  transition: box-shadow 120ms ease, border-color 120ms ease;
}
.kanban-col.drop-target { box-shadow: 0 0 0 2px var(--blue); }
.kanban-col.collapsed { width: 200px; flex-basis: 200px; }

.kanban-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 10px 7px;
  user-select: none;
}
.kanban-chev { width: 20px; height: 20px; }
.kanban-chip { display: inline-flex; max-width: 140px; overflow: hidden; }
.kanban-chip .tag-chip { max-width: 100%; }
.kanban-count { font-size: 11px; color: var(--t3); background: #e2e2e5; border-radius: 9px; padding: 1px 7px; }
.kanban-add { width: 22px; height: 22px; opacity: 0; }
.kanban-head:hover .kanban-add { opacity: 1; }

.kanban-body {
  padding: 0 8px 8px;
  overflow-y: auto;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.kanban-col.collapsed .kanban-body { display: none; }

.kanban-card {
  background: #fff;
  border-radius: var(--radius-m);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.06);
  padding: 9px 10px;
  cursor: pointer;
  transition: box-shadow 100ms ease, transform 100ms ease;
}
.kanban-card:hover { box-shadow: 0 0 0 1px rgba(0,0,0,0.08), 0 3px 8px rgba(0,0,0,0.10); transform: translateY(-1px); }
.kanban-card.dragging { opacity: 0.35; }
.kanban-card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--t1);
  margin-bottom: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.kanban-card-field { font-size: 12px; color: var(--t2); margin-bottom: 3px; overflow: hidden; }
.kanban-card-field .chips { gap: 2px; }
.kanban-card-field .tag-chip { height: 17px; padding: 0 7px; font-size: 10.5px; }
.kanban-card-field .rating-star svg { width: 12px; height: 12px; }
.kanban-new-card {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: var(--radius-m);
  color: var(--t3);
  font-size: 12.5px;
  transition: background 90ms ease, color 90ms ease;
}
.kanban-new-card:hover { background: #e4e4e7; color: var(--t1); }
.kanban-insert-line {
  position: absolute;
  left: 4px; right: 4px;
  height: 3px;
  border-radius: 2px;
  background: var(--blue);
  z-index: 5;
}
.kanban-ghost {
  position: fixed;
  z-index: 3200;
  pointer-events: none;
  background: #fff;
  border-radius: var(--radius-m);
  box-shadow: 0 6px 20px rgba(0,0,0,0.22);
  padding: 9px 12px;
  width: 220px;
  font-size: 13px;
  font-weight: 500;
  transform: rotate(1.5deg);
}

/* ================= gallery ================= */
.gallery-view { flex: 1; overflow-y: auto; padding: 16px; background: #fff; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
  gap: 14px;
}
.gallery-card {
  background: #fff;
  border: 1px solid var(--b2);
  border-radius: var(--radius-l);
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  transition: box-shadow 120ms ease, transform 120ms ease, border-color 120ms ease;
}
.gallery-card:hover {
  box-shadow: 0 0 0 1px #cfe0fc, 0 4px 14px rgba(45,127,249,0.14);
  transform: translateY(-2px);
  border-color: transparent;
}
.gallery-cover {
  height: 108px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.85);
}
.gallery-cover-mark { opacity: 0.9; }
.gallery-card-body { padding: 10px 12px 12px; }
.gallery-title {
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gallery-field {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12px;
  color: var(--t2);
  margin-bottom: 5px;
  min-height: 16px;
}
.gallery-field-icon { display: inline-flex; color: var(--t4); margin-top: 1px; flex: 0 0 auto; }
.gallery-field-val { min-width: 0; max-width: 100%; overflow: hidden; }
.gallery-field-val .chips { gap: 3px; flex-wrap: wrap; }
.gallery-field-val .tag-chip { height: 17px; padding: 0 7px; font-size: 10.5px; }
.gallery-field-val .ellipsis { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery-field-val .rating-star svg { width: 12px; height: 12px; }
.gallery-field-val a.cell-link { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ================= calendar ================= */
.calendar-view { flex: 1; display: flex; flex-direction: column; background: #fff; overflow: hidden; }
.calendar-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.calendar-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--b2);
}
.calendar-title { font-size: 15px; font-weight: 600; min-width: 150px; }
.cal-today { margin-left: 4px; }
.calendar-by { font-size: 12px; color: var(--t3); }
.calendar-by b { color: var(--t2); font-weight: 500; }

.calendar-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(96px, 1fr);
  overflow: auto;
}
.calendar-dow {
  position: sticky;
  top: 0;
  background: #fafafa;
  border-bottom: 1px solid var(--b2);
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--t3);
  z-index: 2;
}
.calendar-day-cell {
  border-right: 1px solid var(--b4);
  border-bottom: 1px solid var(--b4);
  padding: 4px 5px;
  overflow: hidden;
  position: relative;
  transition: background 90ms ease;
}
.calendar-day-cell.out { background: #fafafb; }
.calendar-day-cell.out .cal-day-num { color: #c9c9ce; }
.calendar-day-cell.today .cal-day-num {
  background: var(--blue);
  color: #fff;
  border-radius: 50%;
}
.calendar-day-cell.hover-drop { background: #eef4ff; box-shadow: inset 0 0 0 2px var(--blue); }
.cal-day-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }
.cal-day-num { font-size: 11.5px; color: var(--t2); width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; }
.cal-day-add { opacity: 0; width: 18px; height: 18px; }
.calendar-day-cell:hover .cal-day-add { opacity: 1; }
.cal-day-list { display: flex; flex-direction: column; gap: 2px; }
.cal-record {
  font-size: 11px;
  line-height: 1.25;
  background: #eef4ff;
  color: #1a5fd0;
  border-radius: 4px;
  padding: 2px 6px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: filter 90ms ease;
}
.cal-record:hover { filter: brightness(0.96); }
.cal-record.dragging { opacity: 0.4; }
.cal-record.ghost {
  position: fixed;
  z-index: 3200;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
}
.cal-more {
  font-size: 10.5px;
  color: var(--t3);
  padding: 1px 6px;
  border-radius: 4px;
}
.cal-more:hover { background: #f0f0f2; color: var(--t2); }

/* ================= form ================= */
.form-view { flex: 1; display: flex; overflow: hidden; background: #f7f7f8; }
.form-layout { flex: 1; display: flex; min-width: 0; }

.form-panel {
  width: 248px;
  flex: 0 0 248px;
  border-right: 1px solid var(--b1);
  background: #fff;
  padding: 12px 10px;
  overflow-y: auto;
}
.form-panel-list { display: flex; flex-direction: column; gap: 2px; }
.form-panel-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border-radius: 5px;
  font-size: 12.5px;
  color: var(--t2);
  cursor: grab;
  transition: background 90ms ease;
}
.form-panel-row:hover { background: #f0f0f2; color: var(--t1); }
.form-panel-row .rownum-grip { display: inline-flex; color: var(--t4); opacity: 0; }
.form-panel-row:hover .rownum-grip { opacity: 1; }
.form-panel-row .spacer { flex: 1; }
.form-panel-row.drop-above { box-shadow: inset 0 2px 0 var(--blue); }
.form-panel-row.drop-below { box-shadow: inset 0 -2px 0 var(--blue); }
.form-panel-add { margin-top: 10px; }
.form-panel-add .select.sm { height: 28px; width: 100%; font-size: 12.5px; }

.form-preview-area {
  flex: 1;
  overflow-y: auto;
  display: flex;
  justify-content: center;
  padding: 36px 24px 60px;
}
.form-card {
  width: 460px;
  max-width: 100%;
  background: #fff;
  border: 1px solid var(--b2);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  padding: 30px 32px 24px;
  height: fit-content;
}
.form-title {
  width: 100%;
  border: none;
  outline: none;
  font-size: 21px;
  font-weight: 700;
  color: var(--t1);
  padding: 4px 6px;
  margin-left: -6px;
  border-radius: var(--radius-m);
  background: transparent;
}
.form-title:hover { background: #f4f4f6; }
.form-title:focus { background: #fff; box-shadow: 0 0 0 2px var(--blue-ring); }
.form-desc {
  width: 100%;
  border: none;
  outline: none;
  resize: vertical;
  font-size: 13px;
  color: var(--t2);
  padding: 4px 6px;
  margin: 2px 0 8px -6px;
  border-radius: var(--radius-m);
  background: transparent;
  font-family: var(--font);
  line-height: 1.5;
}
.form-desc:hover { background: #f4f4f6; }
.form-desc:focus { background: #fff; box-shadow: 0 0 0 2px var(--blue-ring); }

.form-field-block { padding: 10px 0 4px; border-top: 1px solid var(--b4); }
.form-field-block:first-of-type { border-top: none; }
.form-field-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--t1); margin-bottom: 5px; }
.form-required { color: #d02b20; margin-left: 2px; }
.form-field-desc { font-size: 11.5px; color: var(--t3); margin: -2px 0 6px; line-height: 1.4; }
.form-control .text-input { height: 36px; }
.form-control textarea.text-input { min-height: 70px; }
.form-error { color: #d02b20; font-size: 11.5px; margin-top: 5px; min-height: 0; }
.form-field-block.invalid .text-input,
.form-field-block.invalid .form-select-box { border-color: #d02b20; box-shadow: 0 0 0 2px rgba(208,43,32,0.18); }

.form-select-box {
  width: 100%;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #cbcbd0;
  border-radius: var(--radius-m);
  padding: 0 10px;
  cursor: pointer;
  background: #fff;
  transition: border-color 90ms ease, box-shadow 90ms ease;
}
.form-select-box:hover { border-color: #a9aab0; }
.form-select-box .chev { margin-left: auto; color: var(--t3); display: inline-flex; }

.form-check-row { display: flex; align-items: center; gap: 9px; cursor: pointer; padding: 6px 0; }
.form-date-btn { width: 100%; justify-content: flex-start; height: 36px; border: 1px solid #cbcbd0; }
.form-date-btn:hover { background: #f7f7f9; }
.form-date-btn.muted { color: var(--t3); }

.form-link-box { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.form-link-add { color: var(--t3); }
.form-link-add:hover { color: var(--t1); background: #f0f0f2; }
.link-chip-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 4px;
  margin-right: -3px;
  border-radius: 3px;
  color: inherit;
  opacity: 0.55;
}
.link-chip-x:hover { opacity: 1; background: rgba(0,0,0,0.08); }

.form-submit-row { margin-top: 18px; border-top: 1px solid var(--b4); padding-top: 18px; }
.form-submit { min-width: 120px; justify-content: center; height: 32px; }
.form-foot-note { text-align: center; color: var(--t4); font-size: 11px; margin-top: 14px; }

.form-success { text-align: center; padding: 44px 10px 30px; }
.form-success-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #e5f6e9;
  color: #2f9e44;
  display: flex;
  align-items: center;
  justify-content: center;
}
.form-success-icon svg { stroke-width: 2.4; }
.form-success-title { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.form-success-sub { font-size: 13px; color: var(--t2); margin-bottom: 22px; }

@media (max-width: 1080px) {
  .form-panel { display: none; }
}
