:root {
  --bg: #f5f8fc;
  --panel-bg: #ffffff;
  --line: #e2e8f0;
  --text: #1e293b;
  --sub: #64748b;
  --brand: #2cddb4;
  --brand-dark: #18b294;
  --soft: #e8eef7;
  --danger: #b91c1c;
  --danger-bg: #fff4f4;
  --font-main: "Poppins", "Noto Sans JP", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
  color: var(--text);
  font-family: var(--font-main);
}

.page-header {
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.page-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.logo {
  display: inline-flex;
  align-items: baseline;
  font-weight: 700;
  line-height: 1;
}

.brand-home-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
  outline: none;
}

.brand-home-link:focus-visible {
  box-shadow: 0 0 0 3px rgba(44, 221, 180, 0.28);
}

.brand-home-tooltip {
  position: absolute;
  left: 0;
  top: calc(100% + 10px);
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  border-radius: 8px;
  background: #0f766e;
  color: #fff;
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.22);
  padding: 7px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.brand-home-link:hover .brand-home-tooltip,
.brand-home-link:focus-visible .brand-home-tooltip {
  opacity: 1;
  transform: translateY(0);
}

.smart,
.dash,
.cv {
  font-size: 1.9rem;
}

.smart {
  color: #1f2937;
}

.dash {
  color: #94a3b8;
}

.cv {
  color: var(--brand);
}

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #9fe8d7;
  background: #effcf8;
  color: #0f766e;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.back-link:hover {
  background: #dcf9f1;
  border-color: #67d8bd;
  color: #0b5f58;
}

.main {
  padding: 28px 20px 42px;
}

.panel {
  max-width: 1100px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-bg);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
  padding: 22px;
}

.panel-head h1 {
  margin: 0;
  font-size: 1.45rem;
}

.panel-head p {
  margin: 6px 0 0;
  color: var(--sub);
  font-size: 0.92rem;
}

.toolbar {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.tabs {
  display: inline-flex;
  gap: 8px;
}

.tab-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: #334155;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
}

.tab-btn.is-active {
  border-color: transparent;
  background: var(--brand);
  color: #fff;
}

.filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.input-control {
  border: 1px solid var(--line);
  border-radius: 8px;
  height: 38px;
  padding: 0 10px;
  font-size: 0.88rem;
  color: #334155;
  background: #fff;
}

#filter-search {
  min-width: 260px;
}

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

.result-count,
.meta-note {
  margin: 0;
  font-size: 0.82rem;
  color: var(--sub);
}

.selection-mode-btn {
  margin-left: auto;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #9fe8d7;
  background: #effcf8;
  color: #0f766e;
  padding: 0 14px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.selection-mode-btn:hover {
  background: #dcf9f1;
  border-color: #67d8bd;
}

.selection-mode-btn.is-active {
  border-color: transparent;
  background: var(--brand);
  color: #fff;
}

.bulk-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: 0;
}

.bulk-toolbar[hidden] {
  display: none;
}

.selection-count {
  color: #0f766e;
  font-size: 0.82rem;
  font-weight: 700;
}

.bulk-btn {
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: #334155;
  padding: 0 10px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.bulk-btn:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.bulk-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.bulk-btn-primary {
  border-color: transparent;
  background: var(--brand);
  color: #fff;
}

.bulk-btn-primary:hover:not(:disabled) {
  background: var(--brand-dark);
}

.bulk-btn-danger {
  border-color: #f4b5b5;
  background: var(--danger-bg);
  color: var(--danger);
}

.bulk-btn-danger:hover:not(:disabled) {
  background: #ffe8e8;
}

.history-list {
  margin-top: 12px;
}

.history-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}

.history-item.is-selected {
  border-color: var(--brand-dark);
  box-shadow: 0 0 0 2px rgba(44, 221, 180, 0.12);
}

.history-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: #0f766e;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.history-select input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-dark);
}

.history-item + .history-item {
  margin-top: 10px;
}

.history-item-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.history-item-meta {
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--sub);
}

.history-item-badges {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-doc {
  background: #ecf3ff;
  color: #1e40af;
}

.badge-trash {
  background: #fff2f2;
  color: #991b1b;
}

.history-item-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.share-manage-control {
  display: contents;
}

.share-manage-toggle-btn {
  align-self: flex-start;
}

.share-manage-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-basis: 100%;
  width: 100%;
  order: 1000;
}

.share-manage-panel[hidden] {
  display: none;
}

.share-manage-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.share-manage-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: #1f2937;
}

.share-manage-fixed-expiry {
  font-size: 0.78rem;
  color: #334155;
  background: #e2e8f0;
  border-radius: 999px;
  padding: 4px 10px;
}

.share-manage-status {
  font-size: 0.78rem;
  color: #475569;
}

.share-inline-url {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  height: 36px;
  padding: 0 10px;
  font-size: 0.82rem;
  color: #334155;
  background: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.action-btn {
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: #1f2937;
  padding: 0 12px;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
}

.action-btn:hover {
  background: #f8fafc;
}

.action-btn-primary {
  border-color: transparent;
  background: var(--brand);
  color: #fff;
}

.action-btn-primary:hover {
  background: var(--brand-dark);
}

.action-btn-danger {
  border-color: #f4b5b5;
  background: var(--danger-bg);
  color: var(--danger);
}

.action-btn-danger:hover {
  background: #ffe8e8;
}

.history-empty {
  margin: 18px 0 4px;
  color: var(--sub);
  font-size: 0.9rem;
}

.history-pagination {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.pagination-info {
  font-size: 0.85rem;
  color: #475569;
  font-weight: 600;
  background: #f8fafc;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  margin-right: auto; /* Push buttons to the right */
}

.pagination-btn {
  height: 38px;
  border-radius: 999px; /* Pill shape */
  border: 1px solid transparent;
  background: #f1f5f9;
  color: #334155;
  padding: 0 18px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.pagination-btn:hover:not(:disabled) {
  background: #fff;
  border-color: var(--brand);
  color: var(--brand);
  box-shadow: 0 4px 10px rgba(44, 221, 180, 0.15);
  transform: translateY(-1px);
}

.pagination-btn:active:not(:disabled) {
  transform: translateY(0);
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: #f8fafc;
  box-shadow: none;
}

@media (max-width: 760px) {
  .main {
    padding: 18px 12px 28px;
  }

  .panel {
    padding: 14px;
  }

  .page-header-inner {
    padding: 0 12px;
  }

  .smart,
  .dash,
  .cv {
    font-size: 1.5rem;
  }

  .filters {
    width: 100%;
  }

  .input-control {
    width: 100%;
  }

  .meta-row,
  .bulk-toolbar {
    align-items: stretch;
    width: 100%;
  }

  .selection-mode-btn {
    margin-left: 0;
  }

  .bulk-toolbar {
    justify-content: flex-start;
  }

  .bulk-btn {
    flex: 1 1 auto;
  }

  #filter-search {
    min-width: 0;
  }

  .history-pagination {
    justify-content: center;
    gap: 10px;
  }

  .pagination-info {
    margin-right: 0;
    width: 100%;
    text-align: center;
  }
}
