:root {
  --navy: #2673F2;        /* DRI Real Estate brand color — rgb(38,115,242) */
  --gold: #c9a84c;
  --bg: #f6f6f4;
  --card: #ffffff;
  --border: #d8d8d8;
  --mid: #555;
  --dark: #1a1a1a;
  --green: #2d7d46;
  --amber: #c27a00;
  --red: #b02a37;
  --blue: #1155cc;
  --teal: #00798c;
  --purple: #663399;
  --shadow: 0 2px 12px rgba(0,0,0,.06);
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--dark);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

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

header.topbar {
  background: var(--navy);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
header.topbar .brand {
  color: var(--gold);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .04em;
}
header.topbar .who { font-size: 13px; opacity: .85; }
header.topbar a { color: #fff; white-space: nowrap; }
header.topbar .right { display: flex; gap: 14px; align-items: center; }

nav.mainnav {
  display: flex; gap: 2px; border-bottom: 2px solid var(--border);
  margin: 0 0 18px; flex-wrap: wrap;
}
nav.mainnav a {
  padding: 9px 14px; text-decoration: none; font-weight: 600; font-size: 14px;
  color: var(--mid); border-bottom: 2px solid transparent; margin-bottom: -2px;
}
nav.mainnav a[aria-current="page"] { color: var(--navy); border-bottom-color: var(--navy); }

main { max-width: 920px; margin: 0 auto; padding: 16px; }
main.full { max-width: 1200px; }

h1 { font-size: 22px; margin: 4px 0 14px; }
h2 { font-size: 16px; margin: 18px 0 8px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 200px; }

label { display: block; font-size: 12px; color: var(--mid); margin-bottom: 4px; }
input, select, textarea {
  width: 100%;
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(38,115,242,.15);
}

button, .btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 14px;
  cursor: pointer;
  font-family: inherit;
  transition: background .12s ease, box-shadow .12s ease, transform .05s ease;
}
a.btn:hover { text-decoration: none; }
button:hover:not(:disabled), .btn:hover { background: #1d5fd0; }
button:active:not(:disabled), .btn:active { transform: translateY(1px); }
button:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 3px solid rgba(38,115,242,.35); outline-offset: 2px;
}
button.secondary, .btn.secondary {
  background: #fff; color: var(--navy); border: 1px solid var(--navy);
}
button.secondary:hover:not(:disabled), .btn.secondary:hover { background: #eef4fe; }
button.danger, .btn.danger { background: var(--red); }
button.danger:hover:not(:disabled), .btn.danger:hover { background: #9a2530; }
button.small, .btn.small { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
button.quiet-danger, .btn.quiet-danger {
  background: #fff; color: var(--red); border: 1px solid #e7bcc1;
}
button.quiet-danger:hover:not(:disabled), .btn.quiet-danger:hover { background: #fdf1f2; }
button:disabled, .btn:disabled { opacity: .5; cursor: not-allowed; }

.muted { color: var(--mid); font-size: 13px; }
.error { color: var(--red); font-size: 13px; }
.ok    { color: var(--green); font-size: 13px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
th { font-size: 12px; color: var(--mid); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f2f6fe; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
  background: #eee; color: #333;
}
.badge.off_plan   { background: #fef08a; color: #854d0e; }
.badge.completed  { background: #d1fae5; color: #065f46; }
.badge.pending    { background: #fef3c7; color: #92400e; }
.badge.paid       { background: #d1fae5; color: #065f46; }
.badge.overdue    { background: #fee2e2; color: #991b1b; }
.badge.vacant     { background: #f3f4f6; color: #4b5563; }
.badge.listed     { background: #dbeafe; color: #1e40af; }
.badge.rented     { background: #d1fae5; color: #065f46; }
.badge.not_for_sale { background: #f3f4f6; color: #4b5563; }
.badge.under_offer  { background: #fef3c7; color: #92400e; }
.badge.sold       { background: #d1fae5; color: #065f46; }
.badge.new        { background: #dbeafe; color: #1e40af; }
.badge.contacted  { background: #e0e7ff; color: #3730a3; }
.badge.viewing    { background: #fef3c7; color: #92400e; }
.badge.offer      { background: #ffedd5; color: #9a3412; }
.badge.won        { background: #d1fae5; color: #065f46; }
.badge.lost       { background: #fee2e2; color: #991b1b; }
.badge.rental       { background: #dbeafe; color: #1e40af; }
.badge.sale         { background: #ffedd5; color: #9a3412; }
.badge.construction { background: #fef08a; color: #854d0e; }
.badge.general      { background: #f3f4f6; color: #4b5563; }

/* 顧客ポータル：次回支払いハイライト */
tr.next-due td { background: #eef4fe; font-weight: 600; }
.next-payment {
  border: 2px solid var(--navy);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: #eef4fe;
  margin-bottom: 12px;
}
.next-payment .np-amount { font-size: 24px; font-weight: 700; color: var(--navy); }
.next-payment .np-due { font-size: 13px; color: var(--mid); }
.countdown { font-weight: 700; }
.countdown.soon { color: var(--amber); }
.countdown.overdue { color: var(--red); }

/* 進捗バー（支払い済み割合） */
.progress { height: 8px; background: #e5e7eb; border-radius: 999px; overflow: hidden; margin: 6px 0; }
.progress > div { height: 100%; background: var(--navy); border-radius: 999px; }

/* タイムライン */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { border-left: 3px solid var(--border); padding: 4px 0 14px 14px; margin-left: 6px; position: relative; }
.timeline li::before {
  content: ""; position: absolute; left: -7.5px; top: 9px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--navy); border: 2px solid #fff;
}
.timeline .t-meta { font-size: 12px; color: var(--mid); margin-bottom: 2px; }
.timeline .t-body { font-size: 14px; white-space: pre-wrap; }

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px 22px;
}
.info-item .info-label { font-size: 11px; color: var(--mid); margin-bottom: 2px; }
.info-item .info-value { font-size: 14px; font-weight: 500; word-break: break-word; }
.divider { border-top: 1px solid var(--border); margin: 12px 0; }

/* Login */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: var(--navy);
}
.login-card {
  max-width: 360px; width: 100%;
  background: #fff; padding: 24px; border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-card h1 { color: var(--navy); margin: 0 0 4px; font-size: 22px; }
.login-card .sub { color: var(--mid); font-size: 13px; margin-bottom: 18px; }

@media (max-width: 600px) {
  main { padding: 12px; }
  header.topbar { padding: 10px 12px; }
  header.topbar .brand { font-size: 12px; letter-spacing: .02em; }
  header.topbar .right { gap: 10px; }
  header.topbar .who { display: none; }
  input, select, textarea { font-size: 16px; }
  button:not(.small), .btn:not(.small) { min-height: 44px; }
  table.wide { display: block; overflow-x: auto; }
}
