:root {
  --bg-accent: radial-gradient(circle at top left, rgba(242, 126, 91, 0.18), transparent 34%), radial-gradient(circle at top right, rgba(50, 93, 136, 0.16), transparent 28%), linear-gradient(180deg, #f7f3eb 0%, #ece4d7 100%);
  --panel: rgba(255, 252, 246, 0.92);
  --panel-strong: #fffdf8;
  --line: rgba(41, 51, 63, 0.14);
  --text: #19212c;
  --muted: #5b6470;
  --brand: #b14d2b;
  --blue: #325d88;
  --green: #256b52;
  --red: #9a3d2e;
  --amber: #936522;
  --shadow: 0 24px 70px rgba(38, 33, 28, 0.12);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

/* display を指定した要素でも hidden 属性を確実に効かせる。 */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Yu Gothic UI", "Hiragino Sans", "Meiryo", sans-serif;
  color: var(--text);
  background: var(--bg-accent);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 28px;
  background: rgba(17, 22, 28, 0.92);
  color: #f6f2e9;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand h1,
.topbar h2,
.section-head h3 {
  font-family: "Bahnschrift", "Arial Narrow", sans-serif;
  margin: 0;
  letter-spacing: -0.02em;
}

.brand h1 {
  font-size: 2rem;
}

.lead {
  color: rgba(246, 242, 233, 0.78);
  line-height: 1.6;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.7rem;
  color: rgba(246, 242, 233, 0.55);
}

.content .eyebrow {
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 10px;
}

.nav-link {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  text-align: left;
  padding: 14px 16px;
  border-radius: 16px;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(242, 126, 91, 0.18);
  border-color: rgba(242, 126, 91, 0.32);
  transform: translateX(4px);
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.sidebar .panel {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.compact {
  padding: 18px;
}

.panel h2,
.panel h3 {
  margin: 0;
}

.plain-list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: rgba(246, 242, 233, 0.82);
  line-height: 1.8;
}

.action-stack {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.file-input {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--text);
  cursor: pointer;
}

.sidebar .file-input {
  border-color: rgba(255, 255, 255, 0.25);
  color: rgba(246, 242, 233, 0.9);
}

.file-input input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.content {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
}

.topbar-meta {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.meta-label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.account-box {
  min-width: 200px;
}

.account-box strong {
  display: block;
  margin-bottom: 6px;
}

.account-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.link-button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: underline;
}

.refresh-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  border-radius: 16px;
  border: 1px solid rgba(147, 101, 34, 0.3);
  background: rgba(147, 101, 34, 0.12);
  color: var(--amber);
  font-weight: 700;
}

.refresh-banner button {
  padding: 8px 14px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

.metric-card {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.metric-card strong {
  display: block;
  font-size: 2rem;
  margin: 8px 0 6px;
  font-family: "Bahnschrift", "Arial Narrow", sans-serif;
}

.metric-card span {
  color: var(--muted);
  font-size: 0.9rem;
}

.dashboard-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 20px;
}

.span-2 {
  grid-column: span 2;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 16px;
}

.focus-list,
.owner-summary,
.activity-list {
  display: grid;
  gap: 12px;
}

.focus-card,
.owner-card,
.activity-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
  border-radius: 18px;
  padding: 14px 16px;
}

.focus-card h4,
.owner-card h4 {
  margin: 10px 0 6px;
}

.muted {
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

.pill.status-not_started,
.pill.status-new {
  color: var(--blue);
  background: rgba(50, 93, 136, 0.12);
}

.pill.status-in_progress,
.pill.status-triaging,
.pill.status-verifying {
  color: var(--amber);
  background: rgba(147, 101, 34, 0.14);
}

.pill.status-blocked,
.pill.status-fixing,
.pill.priority-critical,
.pill.priority-high {
  color: var(--red);
  background: rgba(154, 61, 46, 0.14);
}

.pill.status-done,
.pill.status-closed,
.pill.priority-low {
  color: var(--green);
  background: rgba(37, 107, 82, 0.13);
}

.pill.priority-medium {
  color: var(--blue);
  background: rgba(50, 93, 136, 0.12);
}

.split-layout {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 20px;
}

.filters {
  display: flex;
  gap: 10px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
}

textarea {
  resize: vertical;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid label {
  display: grid;
  gap: 8px;
}

.form-grid span {
  font-size: 0.85rem;
  color: var(--muted);
}

.full-span {
  grid-column: 1 / -1;
}

.button-row {
  display: flex;
  gap: 10px;
}

button,
.secondary {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  background: var(--brand);
  color: #fff7f3;
  font-weight: 700;
}

.secondary {
  background: rgba(25, 33, 44, 0.08);
  color: var(--text);
}

.danger {
  background: rgba(154, 61, 46, 0.12);
  color: var(--red);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 700;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: rgba(177, 77, 43, 0.05);
}

.task-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.wbs-badge {
  min-width: 44px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(25, 33, 44, 0.06);
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
}

.indent-0 { padding-left: 0; }
.indent-1 { padding-left: 16px; }
.indent-2 { padding-left: 32px; }
.indent-3 { padding-left: 48px; }

.empty-state {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.form-meta {
  font-size: 0.85rem;
  color: var(--muted);
  padding-top: 4px;
}

.timeline {
  display: grid;
  gap: 14px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 16px;
  align-items: center;
}

.timeline-item strong {
  font-family: "Bahnschrift", "Arial Narrow", sans-serif;
}

.timeline-bar {
  position: relative;
  height: 18px;
  border-radius: 999px;
  background: rgba(25, 33, 44, 0.08);
  overflow: hidden;
}

.timeline-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), #df8e55);
}

.filters {
  flex-wrap: wrap;
  align-items: center;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-size: 0.85rem;
  color: var(--muted);
}

.check input {
  width: auto;
  margin: 0;
}

tbody tr.selected {
  background: rgba(177, 77, 43, 0.12);
}

/* 自分が担当している行を左端の色帯で見分けられるようにする。 */
tbody tr.is-mine td:first-child,
.focus-card.is-mine,
.owner-card.is-mine {
  box-shadow: inset 3px 0 0 var(--blue);
}

td.overdue {
  color: var(--red);
  font-weight: 700;
}

.pill.role-admin {
  color: var(--red);
  background: rgba(154, 61, 46, 0.14);
}

.pill.role-editor {
  color: var(--blue);
  background: rgba(50, 93, 136, 0.12);
}

.pill.role-viewer {
  color: var(--muted);
  background: rgba(25, 33, 44, 0.08);
}

.form-grid.readonly {
  opacity: 0.6;
}

.dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 460px;
  width: calc(100% - 32px);
  background: var(--panel-strong);
  color: var(--text);
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgba(17, 22, 28, 0.45);
}

.dialog h3 {
  margin: 0;
  font-family: "Bahnschrift", "Arial Narrow", sans-serif;
}

.timeline-fill.status-done {
  background: linear-gradient(90deg, var(--green), #4f9c7c);
}

.timeline-fill.status-blocked {
  background: linear-gradient(90deg, var(--red), #c4705d);
}

.project-switcher select {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
  color: #f6f2e9;
  margin-top: 12px;
}

.project-switcher select option,
.project-switcher select optgroup {
  color: var(--text);
  background: var(--panel-strong);
}

.project-switcher-note {
  margin: 10px 0 0;
  font-size: 0.78rem;
  color: rgba(246, 242, 233, 0.6);
}

.inline-field {
  display: grid;
  gap: 6px;
}

.inline-field span {
  font-size: 0.78rem;
  color: rgba(246, 242, 233, 0.6);
}

.sidebar .inline-field select {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
  color: #f6f2e9;
}

.sidebar .inline-field select option {
  color: var(--text);
  background: var(--panel-strong);
}

.progress-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 120px;
}

.progress-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(25, 33, 44, 0.1);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), #df8e55);
}

/* --- ログイン画面 --- */

.auth-body {
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  background: rgba(17, 22, 28, 0.94);
  color: #f6f2e9;
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: var(--shadow);
}

.auth-form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

.auth-form label {
  display: grid;
  gap: 8px;
}

.auth-form span {
  font-size: 0.85rem;
  color: rgba(246, 242, 233, 0.7);
}

.auth-error {
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(154, 61, 46, 0.28);
  color: #ffd9d0;
  font-size: 0.9rem;
}

.auth-note {
  margin-top: 20px;
  font-size: 0.8rem;
  color: rgba(246, 242, 233, 0.55);
}

@media (max-width: 1180px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .split-layout,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }
}

@media (max-width: 720px) {
  .content,
  .sidebar {
    padding: 20px;
  }

  .topbar,
  .topbar-meta,
  .section-head,
  .filters,
  .button-row {
    flex-direction: column;
    align-items: stretch;
  }

  .form-grid,
  .timeline-item {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }
}
