@import url("https://fonts.googleapis.com/css2?family=Noto+Sans:wght@100..900&family=Noto+Sans+JP:wght@100..900&display=swap");

/* =========================
   Common Base
========================= */

:root {
  --blue: #2d4486;
  --blue-deep: #22366d;
  --blue-soft: #eef2fb;

  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel2: #f8f9fc;

  --text: #111827;
  --muted: #5b6475;
  --line: rgba(45, 68, 134, 0.14);

  --danger: #e5484d;
  --danger-deep: #cb2d34;

  --radius: 10px;
  --radius-sm: 7px;

  --font-base:
    "Noto Sans", "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI",
    system-ui, sans-serif;

  --z-menu: 60;
  --mainboard-base-width: 1440;

  --page-padding-top: 20px;
  --page-padding-x: 24px;
  --page-padding-bottom: 32px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;

  font-family: var(--font-base);
  font-kerning: normal;
  font-feature-settings: "kern", "palt";

  background: var(--bg);
  color: var(--text);
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

[hidden] {
  display: none !important;
}

/* =========================
   Scale Frame
========================= */

#appScaleRoot,
#appScaleFrame {
  width: 100%;
  height: 100%;
  min-height: 0;
}

#appScaleRoot {
  background: var(--bg);
}

#appScaleFrame {
  transform-origin: top left;
}

/* =========================
   App Layout
========================= */

.appShell {
  display: flex;

  width: 100%;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;

  background: var(--bg);
}

.sideMenu {
  display: flex;
  flex: 0 0 260px;
  flex-direction: column;
  gap: 12px;

  width: 260px;
  min-width: 260px;
  height: 100dvh;
  min-height: 0;
  padding: 14px;

  overflow-y: auto;

  background: var(--panel);
  border-right: 1px solid var(--line);
}

.sideMenu.fixed {
  position: relative;
  top: auto;
}

.mainArea {
  flex: 1 1 auto;

  width: auto;
  min-width: 0;
  height: 100dvh;
  min-height: 0;
  padding: 0;

  overflow-x: hidden;
  overflow-y: auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;

  display: flex;
  align-items: center;
  gap: 12px;

  min-height: 58px;
  padding: 0 20px;

  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.pageTitle {
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
}

.hamburger {
  display: none;
  place-items: center;

  width: 40px;
  height: 40px;
  padding: 0;

  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);

  color: var(--blue);
  font-size: 20px;
  cursor: pointer;
}

/* =========================
   Common Page Spacing
========================= */

.pageContent {
  width: 100%;
  min-height: 100%;
  padding: var(--page-padding-top) var(--page-padding-x)
    var(--page-padding-bottom);
}

.storagePage {
  width: 100%;
  max-width: none;
  min-height: 100%;
  margin: 0;
  padding: 20px 24px 32px;
}

/* =========================
   Common Buttons
========================= */

.primaryButton,
.secondaryButton,
.dangerButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  min-height: 40px;
  padding: 8px 16px;

  border-radius: 9px;

  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;

  cursor: pointer;

  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.primaryButton {
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fff;
}

.primaryButton:hover:not(:disabled) {
  border-color: var(--blue-deep);
  background: var(--blue-deep);
}

.secondaryButton {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}

.secondaryButton:hover:not(:disabled) {
  border-color: rgba(45, 68, 134, 0.35);
  background: var(--blue-soft);
  color: var(--blue);
}

.dangerButton {
  border: 1px solid var(--danger);
  background: var(--danger);
  color: #fff;
}

.dangerButton:hover:not(:disabled) {
  border-color: var(--danger-deep);
  background: var(--danger-deep);
}

.primaryButton:hover:not(:disabled),
.secondaryButton:hover:not(:disabled),
.dangerButton:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 5px 12px rgba(15, 23, 42, 0.08);
}

.primaryButton:focus-visible,
.secondaryButton:focus-visible,
.dangerButton:focus-visible,
.hamburger:focus-visible {
  outline: 3px solid rgba(45, 68, 134, 0.2);
  outline-offset: 2px;
}

/* =========================
   Common App Dialog
========================= */

.appDialogBackdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 20px;
  background: rgba(15, 23, 42, 0.46);

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transition:
    opacity 0.18s ease,
    visibility 0.18s ease;
}

.appDialogBackdrop.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.appDialog {
  width: min(100%, 440px);
  max-height: min(80vh, 600px);
  overflow: hidden;

  background: var(--panel);
  border: 1px solid #dbe2ea;
  border-radius: 14px;

  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);

  transform: translateY(8px) scale(0.98);
  transition: transform 0.18s ease;
}

.appDialogBackdrop.open .appDialog {
  transform: translateY(0) scale(1);
}

.appDialogHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  padding: 18px 20px 14px;
  border-bottom: 1px solid #e5e7eb;
}

.appDialogHead h2 {
  margin: 0;

  color: #172554;
  font-size: 18px;
  font-weight: 700;
}

.appDialogClose {
  width: 34px;
  height: 34px;

  border: 0;
  border-radius: 8px;
  background: transparent;

  color: #64748b;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

.appDialogMessage {
  padding: 22px 20px;

  color: #1f2937;
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.appDialogActions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;

  padding: 14px 20px 18px;
}

.appDialogButton {
  min-width: 92px;
  min-height: 40px;
  padding: 8px 18px;

  border: 1px solid #cbd5e1;
  border-radius: 9px;

  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.appDialogButton.cancel {
  background: var(--panel);
  color: #334155;
}

.appDialogButton.confirm {
  border-color: #172554;
  background: #172554;
  color: #fff;
}

.appDialogButton.danger {
  border-color: #b91c1c;
  background: #b91c1c;
  color: #fff;
}

body.appDialogOpen,
body.modalOpen {
  overflow: hidden;
}

/* =========================
   Desktop
========================= */

@media (min-width: 901px) {
  body #appScaleFrame {
    width: 100%;
    transform: none !important;
  }

  #appScaleRoot {
    position: relative;
    overflow-x: hidden;
  }

  #appScaleFrame {
    width: calc(var(--mainboard-base-width) * 1px);
    min-height: 100vh;
    will-change: transform;
  }

  #appScaleFrame .appShell {
    width: 100%;
  }
}

/* =========================
   Tablet / Mobile
========================= */

@media (max-width: 900px) {
  :root {
    --page-padding-top: 14px;
    --page-padding-x: 14px;
    --page-padding-bottom: 24px;
  }

  #appScaleRoot,
  #appScaleFrame {
    transform: none !important;
  }

  #appScaleRoot {
    overflow: visible;
  }

  .hamburger {
    display: grid;
  }

  .sideMenu.fixed {
    left: 0;
    z-index: var(--z-menu);

    width: 260px;
    min-width: 260px;
    max-width: 86vw;

    transform: translateX(-100%);
    transition: transform 0.18s ease;

    box-shadow: 0 20px 60px rgba(45, 68, 134, 0.18);
  }

  .sideMenu.fixed.open {
    transform: translateX(0);
  }

  .pageContent {
    padding: calc(var(--page-padding-top) + env(safe-area-inset-top))
      calc(var(--page-padding-x) + env(safe-area-inset-right))
      calc(var(--page-padding-bottom) + env(safe-area-inset-bottom))
      calc(var(--page-padding-x) + env(safe-area-inset-left));
  }

  input,
  textarea,
  select {
    font-size: 16px;
  }
}

@media (max-width: 600px) {
  .appDialogBackdrop {
    align-items: center;
    justify-content: center;

    padding: calc(28px + env(safe-area-inset-top))
      calc(16px + env(safe-area-inset-right))
      calc(28px + env(safe-area-inset-bottom))
      calc(16px + env(safe-area-inset-left));
  }

  .appDialog {
    width: min(100%, 440px);
    max-height: calc(
      100dvh - 56px - env(safe-area-inset-top) - env(safe-area-inset-bottom)
    );
    border-radius: 14px;
  }

  .appDialogActions {
    flex-direction: column-reverse;
  }

  .appDialogButton {
    width: 100%;
  }
}

@media (max-width: 560px) {
  :root {
    --page-padding-top: 12px;
    --page-padding-x: 12px;
    --page-padding-bottom: 20px;
  }

  .pageTitle {
    font-size: 20px;
  }
}
