:root {
  color-scheme: light;
  --ink: #0f2740;
  --muted: #667494;
  --line: #cfe0ec;
  --bg: #e8f5f7;
  --panel: #ffffff;
  --primary: #18889b;
  --primary-dark: #0c6170;
  --primary-soft: #e8f7fb;
  --danger: #b42318;
  --header: #2f9aad;
  --header-dark: #24899c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #dff1f4 0, #edf8fa 220px, #f7fbfc 100%);
  color: var(--ink);
  font-family: "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  font-size: 14px;
}

a {
  color: var(--primary-dark);
  text-decoration: none;
}

.hero {
  background: linear-gradient(180deg, var(--header), var(--header-dark));
  color: #fff;
  border-bottom: 1px solid rgba(7, 66, 79, 0.2);
}

.hero-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1200px;
  min-height: 156px;
  margin: 0 auto;
  padding: 26px 24px 22px;
}

.hero-title {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hero form {
  align-self: flex-start;
  margin-top: 66px;
}

.brand {
  display: inline-flex;
  width: fit-content;
  font-size: 32px;
  line-height: 1.15;
  font-weight: 700;
  color: #fff;
}

.product-name,
.portal-name,
.login-user {
  color: #eefbfe;
  font-weight: 700;
}

.product-name {
  font-size: 13px;
}

.portal-name {
  font-size: 15px;
}

.login-user {
  font-size: 13px;
}

.header-button {
  min-width: 108px;
  border-color: rgba(255, 255, 255, 0.85);
  background: #fff;
  color: var(--primary-dark);
}

.tabbar {
  background: rgba(255, 255, 255, 0.58);
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.tabbar-inner {
  display: flex;
  gap: 10px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 24px;
  overflow-x: auto;
}

.tabbar a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #072b4d;
  font-weight: 700;
  white-space: nowrap;
}

.tabbar a.active,
.tabbar a:hover {
  border-color: var(--line);
  background: #fff;
  color: var(--primary-dark);
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 26px 24px 54px;
}

h1 {
  margin: 0 0 8px;
  color: #082642;
  font-size: 24px;
  line-height: 1.25;
}

h2 {
  margin: 30px 0 14px;
  font-size: 18px;
}

p {
  margin: 0 0 18px;
  color: var(--muted);
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.secondary {
  background: #fff;
  color: var(--primary-dark);
}

.ghost,
.link-button {
  border: 0;
  background: transparent;
  color: var(--primary-dark);
  padding: 0;
  min-height: 0;
}

.heading-row,
.button-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.button-row {
  align-items: center;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 12px;
  margin: 20px 0 30px;
}

.metrics div,
.login-panel,
.detail-grid div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px;
  box-shadow: 0 1px 0 rgba(9, 56, 77, 0.03);
}

.metrics span,
.detail-grid span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.metrics strong {
  font-size: 28px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.table-wrap table {
  border: 0;
  border-radius: 0;
}

.license-table {
  min-width: 1140px;
  table-layout: fixed;
}

.license-table .col-license-id {
  width: 135px;
}

.license-table .col-app-name {
  width: 155px;
}

.license-table .col-company-name {
  width: 170px;
}

.license-table .col-user-name {
  width: 82px;
}

.license-table .col-status {
  width: 76px;
}

.license-table .col-date {
  width: 90px;
}

.license-table .col-updated-at {
  width: 136px;
}

.license-table .col-actions {
  width: 206px;
}

.license-table th,
.license-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.license-table th:last-child,
.license-table td.actions {
  position: sticky;
  right: 0;
  z-index: 1;
  box-shadow: -1px 0 0 var(--line);
}

.license-table th:last-child {
  z-index: 2;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: #576683;
  background: #f5fafc;
  font-weight: 600;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--panel);
}

.license-table td.actions {
  overflow: visible;
  padding-left: 10px;
  padding-right: 10px;
}

.actions form {
  margin: 0;
}

.table-action {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
  line-height: 1;
}

.status {
  display: inline-flex;
  padding: 3px 9px;
  border-radius: 999px;
  background: #e6f4f1;
  color: #0f5f58;
  font-weight: 700;
}

.status.suspended,
.status.reissued {
  background: #fff3e5;
  color: #9a4b00;
}

.status.pending {
  background: #eef4ff;
  color: #1849a9;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(140px, 180px) minmax(240px, 2fr) auto;
  gap: 12px;
  align-items: end;
  margin: 12px 0 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.filter-actions {
  display: flex;
  gap: 8px;
}

.wide {
  max-width: 920px;
}

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

label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #1d314d;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(24, 136, 155, 0.16);
  border-color: #7bbccd;
}

textarea {
  min-height: 88px;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px 16px;
  background: #fbfdfe;
}

.check {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  margin-right: 18px;
}

.check input {
  width: auto;
}

.login-panel {
  max-width: 420px;
  margin: 56px auto;
}

.flash {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
}

.flash.error {
  border-color: #f3b7b0;
  color: var(--danger);
}

.flash.success {
  border-color: #abd5c8;
  color: #0f5f58;
}

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

.danger-action {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0;
}

.danger-action button {
  border-color: var(--danger);
  background: var(--danger);
}

.approval-panel {
  margin-top: 18px;
}

.approval-note {
  margin: 12px 0 18px;
}

.confirm-action {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0;
}

.form-actions {
  justify-content: flex-start;
}

@media (max-width: 760px) {
  .hero-inner,
  .heading-row,
  .button-row {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-inner {
    min-height: auto;
    padding: 22px 18px;
  }

  .hero form {
    margin-top: 8px;
  }

  .brand {
    font-size: 28px;
  }

  .tabbar-inner {
    padding: 8px 14px;
  }

  .metrics,
  .filter-bar,
  .grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}
