:root {
  --md-sys-color-primary: #1a73e8;
  --md-sys-color-on-primary: #fff;
  --md-sys-color-primary-container: #d9e8ff;
  --md-sys-color-on-primary-container: #0a3d7a;
  --md-sys-color-surface: #f8f9fb;
  --md-sys-color-surface-container: #fff;
  --md-sys-color-surface-container-low: #f1f3f4;
  --md-sys-color-surface-container-high: #eef0f3;
  --md-sys-color-on-surface: #202124;
  --md-sys-color-on-surface-variant: #5f6368;
  --md-sys-color-outline: #dadce0;
  --md-sys-color-outline-variant: #e8eaed;
  --sidebar-width: 248px;
  font-family: "Roboto", "Noto Sans JP", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: #f1f3f4; color: var(--md-sys-color-on-surface); }
button, input, textarea { font: inherit; }
.material-symbols-outlined { font-family: "Material Symbols Outlined"; font-weight: normal; font-style: normal; font-size: 20px; line-height: 1; letter-spacing: normal; text-transform: none; display: inline-block; white-space: nowrap; word-wrap: normal; direction: ltr; -webkit-font-feature-settings: "liga"; -webkit-font-smoothing: antialiased; }

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 24px 18px;
  background: #ffffff;
  border-right: 0;
  min-width: 0;
}
.brand {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 0 26px;
  margin: 0;
  gap:8px;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background-image: url('icon.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  flex: 0 0 auto;
}
.brand-title { font-weight:bold; font-size:16px; }
.sidebar-label {
  color: #3c4043;
  font-size: 15px;
  font-weight: 500;
  padding: 8px 22px 12px;
}
.tab-list { display: flex; flex-direction: column; gap: 4px; overflow: auto; padding: 0 0 10px; }
.workspace-tab {
  border: 0;
  width: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-radius: 16px;
  background: transparent;
  color: #202124;
  cursor: pointer;
  text-align: left;
  transition: background .3s ease;
}
.workspace-tab:hover { background: rgba(255,255,255,.62); }
.workspace-tab.active-shell { background: #fff; padding: 8px; min-height: auto; border-radius: 24px; }
.workspace-tab.active {
  background: #1a73e8;
  color: #fff;
  min-height: 50px;
  padding: 0 20px;
  border-radius: 25px;
}
.workspace-tab .tab-icon { font-size: 20px; color: #6b7075; flex: 0 0 auto; }
.workspace-tab.active .tab-icon { color: #fff; }
.workspace-tab .tab-name { min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.workspace-tab .count { font-size: 12px; color: #7a7f83; }
.workspace-tab.active .count { color: rgba(255,255,255,.88); }
.sidebar-bottom { margin-top: auto; padding: 18px 6px 2px; border-top: 1px solid #dadce0; }
#addWorkspaceBtn { width: 100%; --md-outlined-button-container-height: 44px; }

.main {
  min-width: 0;
  min-height: 100vh;
  padding: 28px clamp(28px, 5vw, 72px) 56px;
}
.main-inner { width: min(1120px, 100%); margin: 0 auto; }

.page-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 6px 2px 16px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.page-head-copy { min-width: 0; flex: 1; }
.eyebrow { color: #70757a; font-size: 12px; margin-bottom: 5px; }
.page-title { margin: 0; font-size: clamp(26px, 3vw, 34px); line-height: 1.2; font-weight: 500; letter-spacing: -.5px; }
.page-actions { display: flex; align-items: center; gap: 8px; padding-top: 2px; }

.memo-area { padding: 18px 0 16px; }
.memo-box {
  width: 100%;
  min-height: 48px;
  resize: vertical;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: 14px;
  background: #fff;
  padding: 13px 14px;
  outline: none;
  color: #202124;
  line-height: 1.7;
  box-shadow: 0 1px 2px rgba(60,64,67,.06);
  transition: border-color .15s, box-shadow .15s;
}
.memo-box:focus { border-color: #1a73e8; box-shadow: 0 0 0 1px #1a73e8; }
.memo-box::placeholder { color: #9aa0a6; }

.links-panel {
  display:block
}
.links-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 10px;
}
.links-head-title { flex: 1; min-width: 0; }
.links-head-title strong { font-size: 15px; font-weight: 600; }
.links-head-title span { margin-left: 8px; color: #80868b; font-size: 12px; }
#addLinkBtn { --md-outlined-button-container-height: 38px; --md-outlined-button-leading-icon-size: 18px; }
#addLinkBtn .material-symbols-outlined { font-size: 18px; }
.link-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-radius: 16px;
  overflow:hidden;
}
.link-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 4px;
  transition: background .15s ease;
  background: #ffffff;
}
.link-row:hover { background: #eceeef; }
.link-icon {
  width: 38px;
  height: 38px;
  border-radius: 99px;
  background: #f6f8fa;
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  overflow: hidden;
}
.link-icon img { width: 22px; height: 22px; object-fit: contain; }
.link-main { min-width: 0; flex: 1; cursor: pointer; }
.link-title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-url { margin-top: 3px; color: #80868b; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-actions { display: flex; align-items: center; position: relative; }
.menu-button { --md-icon-button-icon-size: 20px; --md-icon-button-state-layer-size: 40px; }
md-menu { position: fixed; z-index: 1000; }

.empty { padding: 46px 24px 52px; text-align: center; color: #5f6368; }
.empty-icon { width: 52px; height: 52px; border-radius: 16px; background: #fff; color: #1a73e8; display: grid; place-items: center; margin: 0 auto; }
.empty strong { display: block; margin-top: 14px; color: #3c4043; font-weight: 600; }
.empty p { margin: 8px auto 18px; max-width: 430px; font-size: 13px; line-height: 1.65; }

md-dialog {
  --md-dialog-container-color: #fff;
  --md-dialog-container-shape: 28px;
  --md-dialog-headline-color: #202124;
  --md-dialog-supporting-text-color: #5f6368;
  --md-dialog-container-elevation-shadow: 0 24px 70px rgba(32,33,36,.24);
  --md-dialog-container-max-width: min(520px, calc(100vw - 32px));
}
.dialog-body { display: flex; flex-direction: column; gap: 18px; padding: 2px 24px 8px; min-width: min(430px, calc(100vw - 80px)); box-sizing: border-box; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 8px 8px 8px 0; }

@media (max-width: 760px) {
  :root { --sidebar-width: 100%; }
  .app { display: block; min-height: 100svh; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: auto;
    padding: max(10px, env(safe-area-inset-top)) 12px 10px;
    background: rgba(241,243,244,.96);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid #dadce0;
  }
  .brand { min-height: 40px; padding: 0 4px 8px; }
  .brand-mark { width: 28px; height: 28px; border-radius: 9px; }
  .sidebar-label { display: block; padding: 6px 4px 7px; font-size: 12px; color: #5f6368; }
  .tab-list { flex-direction: row; gap: 8px; overflow-x: auto; overflow-y: hidden; padding: 0 0 3px; scrollbar-width: none; }
  .tab-list::-webkit-scrollbar { display: none; }
  .workspace-tab,
  .workspace-tab.active {
    min-height: 42px;
    max-width: 180px;
    padding: 0 15px;
    border-radius: 21px;
  }
  .workspace-tab.active-shell { background: #fff; padding: 4px; border-radius: 25px; }
  .workspace-tab .tab-icon { display: none; }
  .workspace-tab .count { display: none; }
  .sidebar-bottom { border-top: 0; padding: 0; margin-top: 0; position: absolute; top: max(10px, env(safe-area-inset-top)); right: 12px; }
  #addWorkspaceBtn { width: auto; --md-outlined-button-container-height: 40px; }

  .main { min-height: auto; padding: 16px 14px calc(34px + env(safe-area-inset-bottom)); }
  .main-inner { width: 100%; }
  .page-head { padding: 0 0 16px; align-items: flex-start; gap: 10px; }
  .eyebrow { font-size: 11px; margin-bottom: 3px; }
  .page-title { font-size: 27px; }
  .page-actions md-filled-button { --md-filled-button-container-height: 40px; }
  .memo-area { padding: 14px 0; }
  .memo-box { min-height: 100px; border-radius: 14px; }
  .links-panel { border-radius: 16px; }
  .links-head { padding: 10px 10px 10px 14px; }
  .link-list { padding: 3px 6px 7px; }
  .link-row { min-height: 66px; padding: 6px 5px 6px 6px; gap: 10px; }
  .link-icon { width: 38px; height: 38px; flex-basis: 38px; border-radius: 11px; }
  .link-title { font-size: 14px; }
  .link-url { font-size: 11px; }
  #addLinkBtn { --md-outlined-button-container-height: 38px; --md-outlined-button-leading-icon-size: 18px; }
  .dialog-body { min-width: 0; width: min(100%, 420px); padding-left: 20px; padding-right: 20px; }
}

@media (max-width: 420px) {
  .page-head { align-items: center; }
  .page-actions md-filled-button { --md-filled-button-label-text-size: 13px; }
  .link-url { max-width: 55vw; }
}

.overview-greeting { font-size: 22px; font-weight: 700; color: #202124; padding: 6px 2px 12px; }
.overview-meta { display: flex; align-items: center; gap: 8px; padding: 0 2px 18px; flex-wrap: wrap; }
.overview-meta-link { font-size: 13px; color: #5f6368; text-decoration: none; }
.overview-meta-link:hover { text-decoration: underline; }
.overview-meta-sep { color: #80868b; font-size: 13px; }
