/* ============================================
   請求管理システム 共通スタイル
   ============================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Hiragino Sans', 'Meiryo', 'Yu Gothic', sans-serif;
  background: #f0f2f5;
  color: #333;
  font-size: 14px;
  line-height: 1.6;
}

a { color: #4f46e5; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── ヘッダー ─── */
.header {
  background: #1a1a2e;
  color: white;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.header-logo {
  font-size: 16px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-logo span { font-size: 12px; opacity: 0.6; font-weight: normal; margin-left: 4px; }
.header-user {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: #ccc;
}
.header-user a { color: #aaa; font-size: 12px; }
.header-user a:hover { color: white; }

/* 管理者ヘッダー */
.header.admin-header { background: #1a1a2e; border-bottom: 3px solid #4f46e5; }
/* クライアントヘッダー */
.header.client-header { background: #064e3b; border-bottom: 3px solid #059669; }

/* ─── レイアウト ─── */
.layout {
  display: flex;
  min-height: calc(100vh - 56px);
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: white;
  border-right: 1px solid #e5e7eb;
  padding: 16px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: #555;
  font-size: 14px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.nav-item:hover { background: #f9fafb; color: #333; text-decoration: none; }
.nav-item.active { background: #ede9fe; color: #4f46e5; border-left-color: #4f46e5; font-weight: bold; }
.nav-item.active-green { background: #d1fae5; color: #059669; border-left-color: #059669; font-weight: bold; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.main {
  flex: 1;
  padding: 28px;
  overflow-x: auto;
}

/* ─── ページタイトル ─── */
.page-title { font-size: 20px; font-weight: bold; margin-bottom: 4px; }
.page-desc { color: #888; font-size: 13px; margin-bottom: 20px; }

/* ─── カード ─── */
.card {
  background: white;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.card-title {
  font-size: 14px;
  font-weight: bold;
  color: #555;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid #f3f4f6;
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

/* ─── 統計カード ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: white;
  border-radius: 10px;
  padding: 18px 20px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.stat-label { font-size: 12px; color: #888; margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: bold; color: #1a1a2e; line-height: 1; }
.stat-sub   { font-size: 12px; color: #aaa; margin-top: 4px; }
.stat-card.danger .stat-value { color: #dc2626; }

/* ─── テーブル ─── */
.table-wrap { overflow-x: auto; }
table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}
table.tbl th {
  background: #f9fafb;
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  color: #888;
  font-weight: bold;
  border-bottom: 1px solid #e5e7eb;
}
table.tbl td {
  padding: 11px 14px;
  border-bottom: 1px solid #f3f4f6;
  color: #333;
}
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tr:hover td { background: #fafafa; }

/* ─── ボタン ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 7px;
  border: none;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { opacity: 0.85; text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn-primary  { background: #4f46e5; color: white; }
.btn-success  { background: #059669; color: white; }
.btn-danger   { background: #dc2626; color: white; }
.btn-outline  { background: white; color: #4f46e5; border: 1.5px solid #4f46e5; }
.btn-gray     { background: #f3f4f6; color: #555; border: 1px solid #e5e7eb; }
.btn-sm       { padding: 5px 12px; font-size: 12px; border-radius: 5px; }
.btn-block    { width: 100%; justify-content: center; }

/* ─── フォーム ─── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; color: #666; font-weight: bold; margin-bottom: 5px; }
.form-label .required { color: #dc2626; margin-left: 4px; }
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  font-size: 14px;
  background: white;
  color: #333;
  transition: border-color 0.15s;
  font-family: inherit;
}
.form-control:focus { outline: none; border-color: #4f46e5; box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }
.form-control.green:focus { border-color: #059669; box-shadow: 0 0 0 3px rgba(5,150,105,0.1); }
.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 180px; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ─── バッジ ─── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: bold;
  white-space: nowrap;
}
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-gray   { background: #f3f4f6; color: #6b7280; }

/* ─── ログイン画面 ─── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1a2e 0%, #2d2d4e 100%);
  padding: 20px;
}
.login-wrap.client-bg {
  background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
}
.login-box {
  background: white;
  border-radius: 14px;
  padding: 36px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo-icon { font-size: 40px; margin-bottom: 8px; }
.login-logo-title { font-size: 20px; font-weight: bold; color: #1a1a2e; }
.login-logo-sub { font-size: 12px; color: #888; margin-top: 4px; }
.login-divider { border: none; border-top: 1px solid #f0f0f0; margin: 20px 0; }

/* ─── アラート ─── */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ─── ウェルカムバナー ─── */
.welcome-banner {
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 20px;
  color: white;
}
.welcome-banner.admin  { background: linear-gradient(135deg, #4f46e5, #3730a3); }
.welcome-banner.client { background: linear-gradient(135deg, #059669, #047857); }
.welcome-banner .greeting { font-size: 13px; opacity: 0.8; }
.welcome-banner .company  { font-size: 20px; font-weight: bold; margin: 2px 0; }
.welcome-banner .last-login { font-size: 12px; opacity: 0.6; }

/* ─── 空状態 ─── */
.empty-state {
  text-align: center;
  padding: 40px;
  color: #aaa;
}
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 13px; }

/* ─── レスポンシブ ─── */
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid #e5e7eb; padding: 8px 0; }
  .nav-item { padding: 10px 16px; }
  .main { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { flex-direction: column; }
  .form-row .form-group { min-width: unset; }
  .login-box { padding: 28px 24px; }
}
