:root {
  --bg: #FAF6EF;
  --surface: #FFFFFF;
  --surface-alt: #F3ECDF;
  --border: #E9DFCC;
  --text: #3B342B;
  --text-muted: #8C8171;
  --accent: #D97748;
  --accent-dark: #B85C33;
  --accent-soft: #F5DDC8;
  --green: #6FA37B;
  --green-dark: #4F7F5C;
  --green-soft: #DCEADD;
  --amber: #D89A4E;
  --amber-dark: #A6742E;
  --amber-soft: #F6E7CC;
  --red: #C96B5C;
  --red-dark: #A34B3E;
  --red-soft: #F4DBD4;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Noto Sans JP', sans-serif;
  color: var(--text);
  background: var(--bg);
}

h1, h2, h3, .zen { font-family: 'Zen Maru Gothic', sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }
button { font-family: 'Noto Sans JP', sans-serif; border: none; cursor: pointer; background: none; }

.app-shell { display: flex; min-height: 100vh; background: var(--bg); }

.sidebar {
  width: 264px; min-width: 264px; min-height: 100vh;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 26px 16px; gap: 3px;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 26px; }
.sidebar .brand-name { font-weight: 700; font-size: 17px; line-height: 1.2; }
.sidebar .brand-sub { font-size: 11px; color: var(--text-muted); }
.navrow {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px;
  cursor: pointer; color: var(--text-muted); font-size: 14px;
}
.navrow.active { background: var(--green-soft); font-weight: 700; color: var(--text); }
.navrow svg { flex-shrink: 0; }
.sidebar .me {
  margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 14px 10px;
  border-top: 1px solid var(--border);
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center; font-weight: 700;
  color: var(--accent-dark); font-size: 13px; flex-shrink: 0;
}
.me-name { font-size: 13px; font-weight: 500; }
.me-dept { font-size: 11px; color: var(--text-muted); }

.main { flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  min-height: 76px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 40px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.topbar-title { font-size: 20px; font-weight: 700; }
.topbar-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.content { flex: 1; padding: 26px 40px 40px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; }

.badge { font-size: 11px; font-weight: 700; padding: 4px 12px; border-radius: 10px; display: inline-block; }
.badge-lg { font-size: 11.5px; font-weight: 700; padding: 5px 12px; border-radius: 12px; display: inline-block; }

.tab { padding: 9px 20px; border-radius: 20px; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.tabbar { display: flex; gap: 8px; background: var(--surface-alt); padding: 5px; border-radius: 24px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; color: var(--text-muted); font-weight: 700; padding: 0 14px 10px; border-bottom: 1px solid var(--border); }
td { padding: 11px 14px; font-size: 12.5px; border-bottom: 1px solid var(--border); }

.btn {
  padding: 8px 18px; border-radius: 12px; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-soft { background: var(--surface-alt); color: var(--accent-dark); }
.btn-green { background: var(--green); color: #fff; }
.btn-outline { background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 22px; }
.kpi-card { padding: 20px; }
.kpi-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; margin-bottom: 14px; }
.kpi-value { font-size: 26px; font-weight: 700; margin-bottom: 4px; }
.kpi-label { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.kpi-sub { font-size: 11.5px; color: var(--text-muted); }

.tone-red .kpi-icon { background: var(--red-soft); color: var(--red-dark); }
.tone-red .kpi-value { color: var(--red-dark); }
.tone-green .kpi-icon { background: var(--green-soft); color: var(--green-dark); }
.tone-green .kpi-value { color: var(--green-dark); }
.tone-accent .kpi-icon { background: var(--accent-soft); color: var(--accent-dark); }
.tone-accent .kpi-value { color: var(--accent-dark); }

.alert-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 12px; margin-bottom: 10px; }
.footnote { font-size: 11.5px; color: var(--text-muted); margin-top: 16px; line-height: 1.6; }

.loading { padding: 40px; text-align: center; color: var(--text-muted); font-size: 13px; }
.error-banner { background: var(--red-soft); color: var(--red-dark); padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-size: 13px; }

/* --- モバイル(スマホ画面)用 --- */
.mobile-shell {
  width: 390px; min-height: 100vh; margin: 0 auto; background: var(--bg);
  display: flex; flex-direction: column; position: relative;
}
.mobile-header { padding: 20px 20px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.mobile-content { flex: 1; padding: 18px 20px 100px; overflow-y: auto; }
.mobile-tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 390px; height: 78px; background: var(--surface); border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-around; padding-bottom: 14px;
}

/* ログイン画面 */
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 380px; padding: 40px 32px; text-align: center; }
