/* ========== 取引先管理 CSS ========== */

/* ---------- ヘッダー ---------- */
.p-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: var(--bg-secondary, #1e1e2e);
  border-bottom: 1px solid var(--border, #333);
  position: sticky;
  top: 0;
  z-index: 100;
}
.p-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.p-header-left h1 {
  font-size: 1.25rem;
  margin: 0;
  color: var(--text-primary, #e0e0e0);
}
.p-count {
  font-size: 0.85rem;
  color: var(--text-secondary, #aaa);
  background: var(--bg-tertiary, #2a2a3a);
  padding: 2px 10px;
  border-radius: 12px;
}
.p-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.p-nav-link {
  color: var(--text-secondary, #aaa);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}
.p-nav-link:hover {
  color: var(--text-primary, #fff);
  background: var(--bg-tertiary, #2a2a3a);
}
.p-theme-toggle {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.p-theme-toggle:hover {
  background: var(--bg-tertiary, #2a2a3a);
}

/* ---------- ツールバー ---------- */
.p-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: var(--bg-primary, #161625);
  border-bottom: 1px solid var(--border, #333);
}
.p-toolbar-left {
  flex: 1;
}
.p-search {
  width: 100%;
  max-width: 400px;
  padding: 8px 14px;
  border: 1px solid var(--border, #444);
  border-radius: 8px;
  background: var(--bg-secondary, #1e1e2e);
  color: var(--text-primary, #e0e0e0);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}
.p-search:focus {
  border-color: var(--accent, #6c8aff);
}
.p-search::placeholder {
  color: var(--text-secondary, #666);
}

/* ---------- ボタン ---------- */
.p-btn {
  padding: 8px 16px;
  border: 1px solid var(--border, #444);
  border-radius: 8px;
  background: var(--bg-secondary, #1e1e2e);
  color: var(--text-primary, #e0e0e0);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.p-btn:hover {
  background: var(--bg-tertiary, #2a2a3a);
}
.p-btn-primary {
  background: linear-gradient(135deg, #4a6cf7, #6c8aff);
  color: #fff;
  border: none;
  font-weight: 600;
}
.p-btn-primary:hover {
  background: linear-gradient(135deg, #3a5ce7, #5c7aef);
  transform: translateY(-1px);
}
.p-btn-sm {
  padding: 4px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.15s;
}
.p-btn-edit:hover {
  background: var(--bg-tertiary, #2a2a3a);
}

/* ---------- テーブル ---------- */
.p-table-wrap {
  padding: 0 24px 24px;
  overflow-x: auto;
}
.p-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 16px;
}
.p-table thead th {
  position: sticky;
  top: 52px; /* ヘッダー高さ分 */
  background: var(--bg-secondary, #1e1e2e);
  color: var(--text-secondary, #aaa);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 2px solid var(--border, #333);
  z-index: 10;
}
.p-table tbody tr {
  transition: background 0.15s;
}
.p-table tbody tr:hover {
  background: var(--bg-tertiary, rgba(108, 138, 255, 0.05));
}
.p-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.06));
  color: var(--text-primary, #e0e0e0);
  font-size: 0.85rem;
  vertical-align: middle;
}

/* 列幅 */
.col-name {
  min-width: 180px;
  font-weight: 500;
}
.col-invoice {
  min-width: 150px;
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--text-secondary, #aaa);
}
.col-postal {
  min-width: 80px;
}
.col-address {
  min-width: 240px;
}
.col-tel,
.col-fax {
  min-width: 130px;
}
.col-actions {
  width: 60px;
  text-align: center;
}

.p-empty {
  text-align: center;
  padding: 40px !important;
  color: var(--text-secondary, #666);
  font-size: 0.9rem;
}

/* ---------- モーダル ---------- */
.p-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.p-modal {
  background: var(--bg-secondary, #1e1e2e);
  border-radius: 16px;
  border: 1px solid var(--border, #333);
  width: 100%;
  max-width: 540px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  animation: modalIn 0.2s ease-out;
}
@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.p-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border, #333);
}
.p-modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-primary, #e0e0e0);
}
.p-modal-close {
  background: none;
  border: none;
  color: var(--text-secondary, #aaa);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.p-modal-close:hover {
  color: var(--text-primary, #fff);
}
.p-modal-body {
  padding: 20px 24px;
}
.p-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border, #333);
}

/* ---------- フォーム ---------- */
.p-form-group {
  margin-bottom: 14px;
}
.p-form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary, #aaa);
  margin-bottom: 4px;
  font-weight: 500;
}
.required {
  color: #ff6b6b;
}
.p-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border, #444);
  border-radius: 8px;
  background: var(--bg-primary, #161625);
  color: var(--text-primary, #e0e0e0);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.p-input:focus {
  border-color: var(--accent, #6c8aff);
}
.p-form-row {
  display: flex;
  gap: 14px;
}
.p-form-half {
  flex: 1;
}

/* ---------- ライトテーマ ---------- */
[data-theme="light"] {
  --bg-primary: #f5f5f8;
  --bg-secondary: #ffffff;
  --bg-tertiary: #eef0f5;
  --text-primary: #1a1a2e;
  --text-secondary: #666;
  --border: #ddd;
  --accent: #4a6cf7;
}
[data-theme="dark"] {
  --bg-primary: #161625;
  --bg-secondary: #1e1e2e;
  --bg-tertiary: #2a2a3a;
  --text-primary: #e0e0e0;
  --text-secondary: #aaa;
  --border: #333;
  --accent: #6c8aff;
}

body {
  margin: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
}
