html {overflow-y:scroll;scrollbar-gutter:stable}
#modal-title:focus {outline:none}
.modal-body .field {min-width:0;grid-template-columns:minmax(0,1fr)}
.modal-body .field select {max-width:100%;overflow:hidden;text-overflow:ellipsis}
.modal-head .icon-btn {
  -webkit-appearance:none;
  appearance:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  padding:0;
  border-radius:50%;
  box-shadow:none;
  line-height:1;
}
.modal-head .icon-btn:focus:not(:focus-visible) {outline:none}
.login-page {
  min-height:100vh;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:28px;
  padding:40px 20px;
  background:radial-gradient(ellipse at 20% 0%, #e1f1f3, transparent 65%), var(--paper);
}
.login-brand {display:flex;align-items:center;gap:12px;font-weight:700;line-height:1.5}
.login-brand img {width:42px;height:42px}
.login-brand small {font-weight:400;color:var(--muted)}
.login-card {width:min(100%, 440px);box-shadow:0 16px 60px #18313b09}
.login-card .panel-body {padding:32px}
.login-card .btn {min-height:48px;justify-content:center}
.portal-head {margin:18px 0 32px}
.app-cards {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:24px}
.app-card {display:flex;flex-direction:column;align-items:flex-start;gap:20px;padding:32px;background:#fff;border:1px solid var(--line);border-radius:18px}
.app-card .row {width:100%}
.app-card h3 {font-size:17px;font-weight:500}
.app-card p {flex:1}
.app-card .btn {min-height:48px}
.app-symbol {display:grid;place-items:center;width:54px;height:54px;border-radius:14px;background:#e7f2f5;color:var(--blue)}
.app-symbol svg {width:29px;height:29px}
.app-card.files .app-symbol {background:#edf4ea;color:#54883c}
.app-card.updates .app-symbol {background:#f0edf8;color:#68529b}
.updates-summary {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}
.updates-summary .panel-body {height:100%}
.update-current {font-size:24px;overflow-wrap:anywhere}
.updates-list {display:grid;gap:16px}
.update-card {display:grid;gap:16px;padding:22px;border:1px solid var(--line);border-radius:12px;min-width:0;overflow-wrap:anywhere}
.update-card h3 {font-size:17px}
.update-card .buttons {flex-wrap:wrap}
.update-card .btn {white-space:normal}
.update-notes {white-space:pre-wrap}
.update-key,#update-token {overflow-wrap:anywhere;word-break:break-all;max-width:100%;resize:vertical}
.update-site-facts {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
.update-site-facts dt {font-size:12px;color:var(--muted);margin-bottom:5px}
.update-site-facts dd {margin:0;font-size:15px}
.updates-audit {font-size:13px;overflow-wrap:anywhere}
.updates-audit p+p {margin-top:12px}
.stat strong.stat-label {font-size:21px;margin-top:16px}
.storage-summary {display:grid;grid-template-columns:1fr 1fr;gap:28px;align-items:center;background:white;border:1px solid var(--line);border-radius:14px;padding:24px;margin-bottom:24px}
.storage-summary progress {width:100%;height:8px;margin:12px 0 8px;accent-color:var(--blue)}
.file-toolbar {display:flex;justify-content:space-between;gap:16px;align-items:center;flex-wrap:wrap;margin:24px 0 16px}
.breadcrumbs {display:flex;align-items:center;flex-wrap:wrap;gap:4px;min-width:0}
.breadcrumbs button {max-width:100%;overflow-wrap:anywhere;white-space:normal}
.file-search {display:flex;gap:8px;max-width:100%}
.file-search input {flex:1;min-width:0}
.file-drop {display:flex;justify-content:space-between;align-items:center;gap:20px;padding:24px;border:1px dashed #8aaeb6;background:#eef6f7;border-radius:12px;margin-bottom:20px}
.file-list {border:1px solid var(--line);border-radius:14px;background:#fff;overflow:hidden}
.file-row {display:flex;align-items:center;justify-content:space-between;gap:24px;padding:22px 24px;border-bottom:1px solid var(--line)}
.file-row:last-child {border-bottom:0}
.file-name {display:flex;align-items:flex-start;gap:14px;min-width:0;flex:1}
.file-name>div {min-width:0}
.file-name h2,.file-folder {font-size:16px;font-weight:600;line-height:1.6;overflow-wrap:anywhere;text-align:left}
.file-folder {background:none;border:0;color:var(--blue);padding:0}
.file-name p {overflow-wrap:anywhere}
.file-type {color:var(--blue);padding-top:2px;flex-shrink:0}
.file-type svg {width:24px;height:24px}
.file-row>.buttons {flex-shrink:0;max-width:50%}
.file-row .btn {font-size:13px}
.btn.danger {color:#a13730;border-color:#d7a39e;background:#fff5f3}
.pending-file {display:flex;justify-content:space-between;align-items:center;gap:16px;padding-top:16px}
.pending-file>span {overflow-wrap:anywhere;min-width:0}
.pending-file small {display:block;color:var(--muted);margin-top:6px}
.upload-progress {margin:20px 0;overflow-wrap:anywhere}
.upload-progress .btn {margin-top:12px}
.file-history {margin-top:22px;overflow-wrap:anywhere}
.users-table select {max-width:180px;padding:8px;border:1px solid var(--line);border-radius:6px}
.users-table .buttons {margin-top:10px}
@media(max-width:1100px) {
  .brand {font-size:13px}
  .app-card {padding:24px}
  .file-row {align-items:flex-start;flex-direction:column;gap:16px}
  .file-row>.buttons {max-width:100%}
}
@media(max-width:760px) {
  body {font-size:16px}
  .app-cards,.storage-summary,.updates-summary {grid-template-columns:1fr;gap:18px}
  .update-card {padding:18px}
  .update-site-facts {grid-template-columns:1fr}
  .portal-head {margin:4px 0 24px}
  .app-card {padding:23px;gap:17px}
  .app-card .btn {width:100%;justify-content:center}
  .login-page {justify-content:flex-start;padding-top:48px;gap:22px}
  .login-card .panel-body {padding:25px 22px}
  .login-card h1 {font-size:24px}
  .sidebar {padding:12px 16px}
  .sidebar .brand {font-size:15px}
  .nav button {min-height:44px;font-size:14px}
  .topbar {height:auto;min-height:56px;gap:10px;flex-wrap:wrap;padding:8px 18px}
  .topbar>span {display:none}
  .topbar>.row {width:100%;justify-content:space-between;gap:10px}
  .topbar>.row>span {font-size:13px;min-width:0;overflow-wrap:anywhere}
  .main {padding:24px 16px;overflow:hidden}
  .btn {min-height:44px;padding:10px 13px}
  input,select,textarea {font-size:16px}
  .icon-btn {min-width:44px;min-height:44px}
  .storage-summary {padding:20px}
  .file-drop {flex-direction:column;align-items:stretch;padding:20px}
  .file-drop>div:first-child>strong {display:none}
  .file-drop .buttons {display:grid;grid-template-columns:1fr}
  .file-drop .btn {justify-content:center}
  .file-search {width:100%;flex-wrap:wrap}
  .file-search input {width:180px;min-width:120px}
  .file-search .btn {flex-shrink:0}
  .file-row {padding:20px 17px}
  .file-row>.buttons {display:flex;gap:8px;width:100%}
  .file-row .btn {font-size:14px}
  .file-type {display:none}
  .file-list {border:0;background:transparent;border-radius:0;overflow:visible;display:grid;gap:12px}
  .file-row,.file-list>.empty {border:1px solid var(--line);border-radius:12px;background:#fff}
  .file-row:last-child {border-bottom:1px solid var(--line)}
  .pending-file {align-items:flex-start;flex-direction:column}
  .file-history p {margin-bottom:8px}
  .stat strong.stat-label {font-size:16px;margin-top:13px}
  .page-head .buttons {flex-wrap:wrap;width:100%}
  .toolbar>.buttons {width:100%;display:flex;flex-wrap:wrap}
  .toolbar>.buttons>.btn {flex:1 1 auto;white-space:normal}
  .tabs {overflow:auto;gap:16px}
  .tabs button {min-height:44px;white-space:nowrap}
  .data-table .company {min-height:44px}
  .data-table input[type=checkbox] {width:22px;height:22px}
  .data-table th,.data-table td {padding:14px 12px}
  .table-wrap {max-width:100%;overscroll-behavior-inline:contain}
  .modal-head {gap:10px}
  .modal-head h2 {font-size:19px;overflow-wrap:anywhere}
  .modal-foot {flex-wrap:wrap}
  .form-grid .field {min-width:0}
  .form-stack>.row {flex-wrap:wrap}
  .form-stack>.row>.field {flex-basis:100%}
  #toast {right:16px;bottom:18px;max-width:calc(100vw - 32px);padding:14px 18px;font-size:14px}
}
@media(prefers-reduced-motion:reduce) {
  * {scroll-behavior:auto!important;transition:none!important}
}

.research-cards {display:none}
@media(max-width:760px) {
  .research-cards {display:grid;gap:14px}
  .research-table {display:none}
  .research-card {background:#fff;border:1px solid var(--line);padding:20px;border-radius:12px;overflow-wrap:anywhere}
  .research-card h2 {margin-top:12px}
  .research-card h2 button {font-size:18px;min-height:44px}
  .mobile-select {min-height:44px;align-items:center}
  .mobile-select input {width:22px;height:22px;margin:0}
  .mobile-fact {margin:18px 0}
  .mobile-fact strong {font-size:12px;color:var(--muted)}
  .mobile-fact p {font-size:14px;display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;overflow:hidden}
  .research-card .buttons .btn {width:100%;justify-content:center}
  .users-table,.users-table tbody,.users-table tr,.users-table td {display:block;width:100%;max-width:100%}
  .users-table thead {display:none}
  .users-table tr {padding:12px;border-bottom:1px solid var(--line)}
  .users-table td {border:0;padding:8px}
  .users-table td::before {content:attr(data-label);display:block;font-size:12px;color:var(--muted);margin-bottom:5px}
  .users-table select {width:100%;max-width:100%;min-height:44px;font-size:16px}
}

@media(max-width:760px) {
  .nav {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;overflow:visible}
  .nav button {flex-direction:column;justify-content:center;text-align:center;gap:4px;padding:8px 4px;font-size:12px;line-height:1.4;white-space:normal}
  .nav svg {width:18px;height:18px}
}

@media(max-width:760px) {
  .panel-title {flex-direction:column;align-items:flex-start;gap:12px}
  .panel-title .btn {flex-shrink:0}
}

.file-thumbnail {display:flex;flex:0 0 80px;width:80px;height:80px;align-items:center;justify-content:center;border:1px solid var(--line);border-radius:10px;overflow:hidden;background:#f5f8f8}
.file-thumbnail img {display:block;width:100%;height:100%;object-fit:contain}
.file-thumbnail img[hidden] {display:none}
.file-thumbnail.unavailable::after {content:'画像';font-size:12px;color:var(--muted)}
@media(max-width:760px) {
  .file-thumbnail {flex-basis:64px;width:64px;height:64px}
  .file-name {width:100%;gap:12px}
}

/* Monthly history keeps its summary above actions at every viewport width. */
.project-row.monitor-run-card {
  grid-template-columns:minmax(0,1fr);
  gap:16px;
}
.monitor-run-card>*,.monitor-run-summary>* {min-width:0}
.monitor-run-summary {display:grid;gap:9px;overflow-wrap:anywhere}
.monitor-run-heading {display:flex;align-items:center;flex-wrap:wrap;gap:10px}
.monitor-run-card .monitor-run-heading h3 {margin:0;white-space:nowrap}
.monitor-run-progress {white-space:nowrap}
.monitor-run-counts {display:flex;flex-wrap:wrap;gap:6px 20px;font-size:14px}
.monitor-run-counts>span {white-space:nowrap}
.monitor-run-review {color:var(--muted)}
.monitor-run-actions {
  display:grid;
  grid-template-columns:minmax(0,1fr);
  gap:12px;
  padding-top:16px;
  border-top:1px solid var(--line);
}
.monitor-run-actions .buttons {min-width:0;align-items:stretch;justify-content:flex-start}
.monitor-run-card .monitor-run-actions .btn {
  min-width:0;
  max-width:100%;
  align-self:stretch;
  white-space:normal;
  overflow-wrap:anywhere;
  text-align:center;
  line-height:1.5;
}
@media(max-width:760px) {
  .monitor-run-actions .buttons {display:grid;grid-template-columns:minmax(0,1fr);gap:8px}
  .monitor-run-card .monitor-run-actions .btn {width:100%;justify-self:stretch}
}
