:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #6b7280;
  --line: #e2e8f0;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --accent: #0f766e;
  --warn: #b45309;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", "Meiryo", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}

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

/* Header */
.app-header {
  background: #0b2545;
  color: #fff;
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: 56px;
  box-shadow: var(--shadow);
}
.app-header .logo { font-weight: 700; font-size: 18px; letter-spacing: .02em; }
.app-header .logo span { color: #7dd3fc; }
.app-header nav { margin-left: 32px; display: flex; gap: 4px; }
.app-header nav a {
  color: #cbd5e1;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
}
.app-header nav a:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.app-header nav a.active { background: var(--brand); color: #fff; }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }
.page-title { font-size: 22px; margin: 0 0 4px; }
.page-desc { color: var(--muted); margin: 0 0 24px; font-size: 14px; }

.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.breadcrumb a { color: var(--muted); }

/* Cards (home) */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.card h2 { margin: 0 0 8px; font-size: 18px; }
.card p { color: var(--muted); font-size: 14px; margin: 0 0 16px; flex: 1; }
.card .sublinks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.card .sublinks a {
  font-size: 13px; padding: 6px 10px; background: #eef2ff; border-radius: 6px;
}
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; vertical-align: middle; }
.badge.wip { background: #fef3c7; color: var(--warn); }
.badge.ready { background: #d1fae5; color: var(--accent); }

/* Panel */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.panel-header {
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.panel-header h3 { margin: 0; font-size: 15px; }
.panel-body { padding: 18px; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); }
th { background: #f8fafc; color: #475569; font-weight: 600; font-size: 13px; white-space: nowrap; }
tbody tr:hover { background: #f8fafc; }
.table-scroll { overflow-x: auto; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
label { display: block; font-size: 13px; color: #475569; margin-bottom: 4px; font-weight: 600; }
input, select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px;
  font: inherit; background: #fff;
}
.form-actions { margin-top: 18px; display: flex; gap: 10px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 7px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; cursor: pointer; background: #eef2ff; color: var(--brand);
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: #fff; border-color: var(--line); color: #475569; }

/* Shift grid */
.shift-grid { border-collapse: collapse; font-size: 12px; }
.shift-grid th, .shift-grid td { border: 1px solid var(--line); padding: 4px 6px; text-align: center; min-width: 30px; }
.shift-grid td.name, .shift-grid th.name { text-align: left; position: sticky; left: 0; background: #fff; white-space: nowrap; min-width: 90px; z-index: 1; }
.shift-grid th.name { background: #f8fafc; }
.shift-grid .weekend { background: #fef2f2; }
.shift-grid td.weekend { background: #fff5f5; }
.sh { display: inline-block; width: 22px; border-radius: 4px; font-weight: 700; }
.sh-e { background: #fde68a; }   /* 早番 */
.sh-d { background: #bfdbfe; }   /* 日勤 */
.sh-l { background: #ddd6fe; }   /* 遅番 */
.sh-n { background: #1e293b; color: #fff; }  /* 夜勤 */
.sh-a { background: #cbd5e1; }   /* 明け */
.sh-k { background: #fecaca; }   /* 公休 */
.sh-r { background: #d1fae5; }   /* 希望休 */

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; margin-top: 14px; color: #475569; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .sh { width: 26px; text-align: center; }

/* Calendar (kibou) */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; max-width: 520px; }
.cal .dow { text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px 0; }
.cal .day {
  aspect-ratio: 1 / 1; border: 1px solid var(--line); border-radius: 6px;
  display: flex; align-items: center; justify-content: center; font-size: 13px; cursor: pointer; background: #fff;
}
.cal .day.off { background: #d1fae5; border-color: #6ee7b7; font-weight: 700; color: var(--accent); }
.cal .day.blank { border: none; background: transparent; cursor: default; }
.cal .day.sun { color: #dc2626; }
.cal .day.sat { color: #2563eb; }

.note { background: #fffbeb; border: 1px solid #fde68a; color: var(--warn); padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 18px; }
.blank-state { text-align: center; padding: 80px 20px; color: var(--muted); }
.blank-state .big { font-size: 48px; margin-bottom: 12px; }
