:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-alt: #f1efe7;
  --border: #e5e1d6;
  --text: #1f2a28;
  --text-muted: #64716d;
  --primary: #1f6f66;
  --primary-dark: #164f48;
  --primary-soft: #e3f1ee;
  --accent: #d98e4a;
  --accent-soft: #fbeee0;
  --danger: #b3454b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 28, 0.04), 0 4px 16px rgba(20, 30, 28, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic Medium", "Yu Gothic", sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

/* ===== ログイン画面 ===== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 20%, #245e56 0%, #16403a 55%, #102e2a 100%);
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  padding: 40px 32px;
}
.login-brand {
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 4px;
  text-transform: uppercase;
}
.login-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 24px;
}
.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.field input, .field select {
  width: 100%;
  padding: 11px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: var(--surface);
  color: var(--text);
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--primary);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 18px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--primary); border: 1.5px solid var(--primary-soft); }
.btn-accent { background: var(--accent); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: default; }
.error-text { color: var(--danger); font-size: 13px; margin-top: 10px; }

/* ===== ダッシュボード ===== */
.layout {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #1a4d46 0%, #123833 100%);
  color: #eef6f4;
  padding: 24px 20px;
}
.sidebar-brand {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}
.sidebar-sub {
  font-size: 12px;
  color: #a9c9c3;
  margin-bottom: 32px;
}
.sidebar-logout {
  margin-top: 40px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.25);
  color: #dcece8;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}

.main {
  flex: 1;
  padding: 32px 40px;
  max-width: 920px;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
}
.page-desc {
  color: var(--text-muted);
  margin: 0 0 28px;
  font-size: 13px;
}

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}
.panel-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 16px;
}
.inline-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.inline-form .field { flex: 1; margin-bottom: 0; }

.corp-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}
.corp-header {
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-alt);
}
.corp-name { font-weight: 700; font-size: 16px; }
.corp-meta { font-size: 12px; color: var(--text-muted); }

.facility-row {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.facility-name { font-weight: 600; }
.facility-code {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-alt);
  padding: 2px 8px;
  border-radius: 6px;
}
.facility-actions button {
  font-size: 12px;
  padding: 6px 10px;
}

.empty-state {
  padding: 40px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.url-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.url-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-alt);
  border-radius: 8px;
  padding: 8px 10px;
}
.url-row .url-label {
  font-size: 12px;
  color: var(--text-muted);
  width: 90px;
  flex-shrink: 0;
}
.url-row code {
  flex: 1;
  font-size: 12px;
  overflow-x: auto;
  white-space: nowrap;
}
.url-row button {
  flex-shrink: 0;
  font-size: 12px;
  padding: 5px 10px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 28, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}
.modal-title { font-weight: 700; font-size: 16px; margin: 0 0 16px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
