/* =============================================
   WorkFlow Pro - メインスタイルシート
   Jugaadデザインベース（オレンジ #F4720B）
   ============================================= */

/* カスタムプロパティ */
:root {
  --primary:       #F4720B;
  --primary-dark:  #D65E00;
  --primary-light: #FFF3E0;
  --sidebar-bg:    #1E2A3B;
  --sidebar-hover: #2D3F57;
  --sidebar-text:  #CBD5E0;
  --sidebar-active:#F4720B;
  --success:       #28A745;
  --warning:       #FFC107;
  --danger:        #DC3545;
  --info:          #17A2B8;
  --body-bg:       #F5F6FA;
  --card-shadow:   0 2px 10px rgba(0,0,0,.08);
  --radius:        10px;
  --font-jp:       'Noto Sans JP', 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
}

/* =========================================
   グローバル
   ========================================= */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font-jp);
  background: var(--body-bg);
  color: #333;
  margin: 0;
  padding: 0;
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: underline; }

/* =========================================
   ログイン画面
   ========================================= */
.login-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #F4720B 0%, #E8650A 50%, #FF8C3A 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 48px 44px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .logo-text {
  font-size: 28px;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: -1px;
}

.login-logo .logo-sub {
  font-size: 12px;
  color: #888;
  margin-top: 4px;
}

.login-card .form-control {
  height: 48px;
  border-radius: 8px;
  border: 1.5px solid #E0E0E0;
  font-size: 15px;
  transition: border-color .2s;
}

.login-card .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(244,114,11,.15);
}

.btn-login {
  background: var(--primary);
  border: none;
  color: #fff;
  height: 48px;
  width: 100%;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  transition: background .2s, transform .1s;
  cursor: pointer;
}
.btn-login:hover { background: var(--primary-dark); transform: translateY(-1px); }

/* =========================================
   レイアウト（サイドバー型）
   ========================================= */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* --- サイドバー --- */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--sidebar-bg);
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 1000;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transition: width .3s;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo .logo-mark {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-logo .logo-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.sidebar-logo .logo-name small {
  display: block;
  font-size: 10px;
  color: var(--sidebar-text);
  font-weight: 400;
}

.sidebar-section {
  padding: 16px 12px 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #5A7390;
  font-weight: 600;
}

.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0 8px;
}

.sidebar-nav li { margin: 2px 0; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  transition: background .15s, color .15s;
  text-decoration: none;
}

.sidebar-nav a:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.sidebar-nav a.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.sidebar-nav .bi { font-size: 16px; flex-shrink: 0; }

.sidebar-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  border-radius: 10px;
  font-size: 10px;
  padding: 1px 6px;
  font-weight: 700;
}

.sidebar-user {
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,.1);
  padding: 14px 12px;
}

.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  overflow: hidden;
}

.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.user-name  { font-size: 13px; color: #fff; font-weight: 600; line-height: 1.2; }
.user-role  { font-size: 11px; color: var(--sidebar-text); }

/* --- メインコンテンツ --- */
.main-content {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --- トップバー --- */
.topbar {
  background: #fff;
  border-bottom: 1px solid #EEE;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
  color: #2D3748;
  flex: 1;
}

.topbar-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #F5F6FA;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  position: relative;
  color: #555;
  transition: background .15s;
}
.topbar-btn:hover { background: #E9ECEF; }

.notif-dot {
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  position: absolute;
  top: 5px; right: 5px;
  border: 1.5px solid #fff;
}

/* --- ページコンテンツ --- */
.page-body {
  padding: 24px;
  flex: 1;
}

/* =========================================
   カード
   ========================================= */
.card {
  background: #fff;
  border-radius: var(--radius);
  border: none;
  box-shadow: var(--card-shadow);
}

.card-header {
  background: #fff;
  border-bottom: 1px solid #F0F0F0;
  padding: 16px 20px;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body { padding: 20px; }

/* =========================================
   ステータスバッジ
   ========================================= */
.badge-status {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.status-draft    { background: #F0F0F0; color: #666; }
.status-pending  { background: #FFF3CD; color: #856404; }
.status-approved { background: #D4EDDA; color: #155724; }
.status-rejected { background: #F8D7DA; color: #721C24; }
.status-returned { background: #CCE5FF; color: #004085; }
.status-withdrawn{ background: #F0F0F0; color: #6C757D; }
.status-paid     { background: #D4EDDA; color: #155724; }

/* =========================================
   テーブル
   ========================================= */
.table-wf {
  width: 100%;
  border-collapse: collapse;
}

.table-wf th {
  background: #F8F9FA;
  padding: 10px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: #666;
  border-bottom: 2px solid #EAEAEA;
  white-space: nowrap;
}

.table-wf td {
  padding: 12px 14px;
  border-bottom: 1px solid #F0F0F0;
  vertical-align: middle;
}

.table-wf tr:hover td { background: #FAFAFA; }

.table-wf tr:last-child td { border-bottom: none; }

/* =========================================
   ボタン
   ========================================= */
.btn-primary-wf {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary-wf:hover { background: var(--primary-dark); color: #fff; transform: translateY(-1px); text-decoration: none; }

.btn-outline-wf {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-outline-wf:hover { background: var(--primary); color: #fff; text-decoration: none; }

.btn-sm-wf {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
}

/* =========================================
   フォーム
   ========================================= */
.form-label-wf {
  font-size: 13px;
  font-weight: 600;
  color: #444;
  margin-bottom: 6px;
  display: block;
}

.form-label-wf .required {
  color: var(--danger);
  margin-left: 3px;
}

.form-control-wf {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #DDD;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color .2s, box-shadow .2s;
  font-family: var(--font-jp);
  background: #fff;
}

.form-control-wf:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(244,114,11,.12);
}

textarea.form-control-wf { resize: vertical; min-height: 80px; }

/* =========================================
   アラート
   ========================================= */
.alert-wf {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13.5px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-success { background: #D4EDDA; color: #155724; border-left: 4px solid #28A745; }
.alert-error   { background: #F8D7DA; color: #721C24; border-left: 4px solid #DC3545; }
.alert-warning { background: #FFF3CD; color: #856404; border-left: 4px solid #FFC107; }
.alert-info    { background: #D1ECF1; color: #0C5460; border-left: 4px solid #17A2B8; }

/* =========================================
   ページネーション
   ========================================= */
.pagination-wf {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}

.pagination-wf a,
.pagination-wf span {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all .15s;
}

.pagination-wf a { color: #555; background: #fff; border: 1px solid #DDD; }
.pagination-wf a:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.pagination-wf .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* =========================================
   ダッシュボード KPIカード
   ========================================= */
.kpi-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform .2s;
}
.kpi-card:hover { transform: translateY(-2px); }

.kpi-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.kpi-icon.orange { background: #FFF3E0; color: var(--primary); }
.kpi-icon.green  { background: #E8F5E9; color: #28A745; }
.kpi-icon.blue   { background: #E3F2FD; color: #1565C0; }
.kpi-icon.red    { background: #FFEBEE; color: #C62828; }

.kpi-value { font-size: 28px; font-weight: 800; color: #2D3748; line-height: 1; }
.kpi-label { font-size: 12px; color: #888; margin-top: 2px; }

/* =========================================
   承認フロー可視化
   ========================================= */
.approval-flow {
  display: flex;
  align-items: flex-start;
  gap: 0;
  overflow-x: auto;
  padding: 16px 0;
}

.flow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 100px;
  position: relative;
}

.flow-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 20px;
  right: -24px;
  width: 48px;
  height: 2px;
  background: #DDD;
}

.flow-step.done::after  { background: var(--success); }
.flow-step.active::after{ background: var(--warning); }

.flow-circle {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px solid #DDD;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: #fff;
  margin-bottom: 8px;
  font-weight: 700;
  transition: all .2s;
}

.flow-step.done   .flow-circle { border-color: var(--success); background: var(--success); color: #fff; }
.flow-step.active .flow-circle { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.flow-step.pending .flow-circle { border-color: #DDD; background: #F5F5F5; color: #999; }

.flow-label { font-size: 11px; text-align: center; color: #666; max-width: 80px; word-break: break-all; }

/* =========================================
   ファイルアップロード
   ========================================= */
.file-drop-zone {
  border: 2px dashed #DDD;
  border-radius: 10px;
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: #FAFAFA;
}

.file-drop-zone:hover, .file-drop-zone.dragging {
  border-color: var(--primary);
  background: var(--primary-light);
}

.file-drop-zone .bi { font-size: 32px; color: #CCC; margin-bottom: 8px; }
.file-drop-zone p { color: #888; font-size: 13px; margin: 0; }

/* =========================================
   経費明細テーブル（動的行追加）
   ========================================= */
.expense-row { background: #FAFAFA; }
.expense-row:nth-child(even) { background: #F5F5F5; }

.category-badge {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.cat-transport    { background: #E3F2FD; color: #1565C0; }
.cat-accommodation{ background: #F3E5F5; color: #6A1B9A; }
.cat-meal         { background: #FFF3E0; color: #E65100; }
.cat-entertainment{ background: #E8F5E9; color: #2E7D32; }
.cat-supplies     { background: #F5F5F5; color: #424242; }
.cat-other        { background: #F0F0F0; color: #555; }

/* =========================================
   検索バー
   ========================================= */
.search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #fff;
  border: 1.5px solid #E0E0E0;
  border-radius: 8px;
  padding: 4px 12px;
  transition: border-color .2s;
}
.search-bar:focus-within { border-color: var(--primary); }
.search-bar input {
  border: none;
  outline: none;
  font-size: 14px;
  flex: 1;
  background: transparent;
  font-family: var(--font-jp);
  min-width: 0;
}
.search-bar .bi { color: #999; }

/* =========================================
   モバイルレスポンシブ
   ========================================= */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-240px); transition: transform .3s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-body { padding: 16px; }
  .kpi-card  { padding: 14px 16px; }
  .kpi-value { font-size: 22px; }
  .table-wf { font-size: 12px; }
  .table-wf th, .table-wf td { padding: 8px 10px; }
  .topbar { padding: 0 16px; }
  .topbar-title { font-size: 16px; }
}

/* =========================================
   スクロールバー
   ========================================= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #F0F0F0; }
::-webkit-scrollbar-thumb { background: #CCC; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #AAA; }

/* =========================================
   ローディングオーバーレイ
   ========================================= */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(2px);
}

.spinner-wf {
  width: 44px; height: 44px;
  border: 4px solid #F0F0F0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================
   フォームビルダー
   ========================================= */
.field-row {
  background: #fff;
  border: 1px solid #E8E8E8;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: grab;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color .15s, box-shadow .15s;
}

.field-row:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(244,114,11,.1); }
.field-row.dragging { opacity: .5; }
.field-row .drag-handle { color: #CCC; cursor: grab; font-size: 16px; }

/* =========================================
   グラフエリア
   ========================================= */
.chart-container { position: relative; width: 100%; }

/* =========================================
   補完クラス（btn-wf, card-wf, stat-card等）
   ========================================= */

/* card-wf */
.card-wf {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--card-shadow);
  margin-bottom: 0;
}

/* page-header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 8px;
}
.page-title {
  font-size: 20px;
  font-weight: 800;
  color: #2D3748;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* section-title */
.section-title {
  font-size: 15px;
  font-weight: 700;
  color: #2D3748;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-light);
}

/* btn-wf系 */
.btn-wf {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
  font-family: var(--font-jp);
  line-height: 1;
}
.btn-wf:hover { text-decoration: none; transform: translateY(-1px); }
.btn-wf.btn-primary   { background: var(--primary); color: #fff; }
.btn-wf.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-wf.btn-secondary { background: #6C757D; color: #fff; }
.btn-wf.btn-outline   { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-wf.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-wf.btn-danger    { background: var(--danger); color: #fff; }
.btn-wf.btn-danger:hover { background: #B71C1C; }
.btn-wf.btn-sm        { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn-wf.w-100         { width: 100%; justify-content: center; }
.btn-wf.mt-2          { margin-top: 8px; }

/* form-group-wf */
.form-group-wf {
  margin-bottom: 16px;
}

/* label required */
.form-label-wf.required::after {
  content: ' *';
  color: var(--danger);
}

/* stat-card */
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform .2s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-body { flex: 1; }
.stat-value { font-size: 24px; font-weight: 800; color: #2D3748; line-height: 1; }
.stat-label { font-size: 12px; color: #888; margin-top: 2px; }

/* pager */
.pager {
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 16px;
}
.pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #DDD;
  color: #555;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all .15s;
}
.pager-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); text-decoration: none; }
.pager-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* label-wf */
.label-wf {
  font-size: 11px;
  font-weight: 700;
  color: #AAA;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 2px;
}

/* form-control-sm */
.form-control-wf.form-control-sm { padding: 5px 8px; font-size: 13px; }

/* nav-tabs override */
.nav-tabs .nav-link { color: #666; font-weight: 600; font-size: 13.5px; }
.nav-tabs .nav-link.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }
.nav-tabs .nav-link:hover { color: var(--primary); }
