/* Shared archive list UI — search, filters, status groups, cards, details sheet */

.mi-wrap {
  width: 100%;
  animation: archiveFadeUp 0.35s ease both;
}

.mi-toolbar {
  margin-bottom: 14px;
}

.mi-toolbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mi-search-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.mi-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.mi-search-input {
  width: 100%;
  height: 42px;
  padding: 0 14px 0 38px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
}

.mi-search-input:focus {
  border-color: var(--accent);
}

.mi-tool-btn {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s, background 0.15s;
}

.mi-tool-btn:hover {
  border-color: var(--border-hover);
}

.mi-tool-btn.is-active {
  border-color: var(--accent);
  background: rgba(255, 130, 0, 0.07);
}

.mi-cal-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.mi-state {
  padding: 40px 0;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}

.mi-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.mi-value {
  font-size: 14px;
  color: var(--text-primary);
  margin-top: 2px;
  line-height: 1.4;
}

.mi-field {
  margin-bottom: 10px;
}

.mi-status-group {
  margin-bottom: 12px;
}

.mi-status-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-family: var(--font);
  transition: opacity 0.15s, transform 0.15s;
}

.mi-status-header:hover {
  opacity: 0.92;
}

.mi-status-header:active {
  transform: scale(0.99);
}

.mi-status-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mi-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mi-status-name {
  font-size: 13px;
  font-weight: 700;
}

.mi-status-count {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.7;
}

.mi-status-arrow {
  font-size: 11px;
  display: inline-block;
  transition: transform 0.2s ease;
}

.mi-status-body[hidden] {
  display: none !important;
}

.mi-status-body:not([hidden]) {
  display: grid;
  gap: 10px;
  padding: 10px 0 4px;
}

.mi-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 16px 15px;
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  overflow: hidden;
}

.mi-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent);
  border-radius: 4px 0 0 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.mi-card:hover {
  background: var(--surface2);
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.mi-card:hover::before {
  opacity: 1;
}

.mi-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.mi-card-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
}

.mi-card-date {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}

.mi-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.mi-open {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--border);
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.mi-open:hover {
  background: rgba(255, 90, 0, 0.12);
  border-color: rgba(255, 90, 0, 0.12);
}

.mi-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.mi-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
  border: 1px solid transparent;
}

.mi-cal-dropdown {
  position: fixed;
  z-index: 99999;
  width: min(260px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  padding: 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 12px 36px rgba(17, 17, 17, 0.18);
  box-sizing: border-box;
  overflow-x: hidden;
}

.mi-cal-dropdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.mi-cal-clear {
  background: none;
  border: none;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
}

.mi-cal-input {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface2);
  font-size: 14px;
  padding: 0 12px;
  outline: none;
  box-sizing: border-box;
}

.mi-cal-apply {
  margin-top: 10px;
  width: 100%;
  height: 38px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.mi-details-wrap {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.mi-details-wrap[hidden] {
  display: none !important;
}

.mi-details-panel {
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: var(--safe-bottom);
}

.mi-details-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 12px auto 0;
  flex-shrink: 0;
}

.mi-details-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 12px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.mi-details-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  color: var(--muted);
}

.mi-open.mi-details-close {
  width: auto;
  height: auto;
  padding: 8px 16px;
  flex-shrink: 0;
  background: rgba(255, 90, 0, 0.1);
  border: 1px solid rgba(255, 90, 0, 0.24);
  border-radius: 999px;
  color: #ff5a00;
  font-size: inherit;
}

.mi-details-wrap .mi-open {
  color: #ff5a00;
}

.mi-details-wrap .mi-open:hover {
  background: rgba(255, 90, 0, 0.14);
  border-color: rgba(255, 90, 0, 0.34);
  color: #ff5a00;
}

#miDetailsBody {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

@keyframes archiveFadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 520px) {
  .mi-meta {
    grid-template-columns: 1fr;
  }
}
